1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Tutorial Mjoy16 USB AVR Joystick

Discussion in 'DIY peripherals' started by tronicgr, Jan 3, 2008.

  1. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    I have just figured this out. With HEX only, i get the same CRC. With HEX and EEPROM file, i get a new combined CRC which is perfectly normal. The STK-clone is the PARALLEL port programmer Mindaugas uses. It is the one with 4 resistors and 4 wires. Exactly the same..

    I have just programmed the same ATmega16 to constantly blink a LED, and it work fine. I did it to see if the ATmega16 had a problem with the clock, but it did blink it at a correct rate, so i believe the clock and programmer work. I am using parallel port programming (4 330Ohms resistors and 4 parallel port wires), which is exactly the same as STK200/300..

    Will try once more!

    Because i want to disable the Center axis on boot feature, as describe in the manual..

    Thank you Frakk!
  2. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Sorry I mixed up the STK with other programmers. Your schematic looks fine, double check resistors, capacitors and diodes, the connection to the USB port (don't mix up D+ and D-). Have you tried it on a different computer?
  3. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    yes, I have just come back from a different computer.. No luck! :sos:

    Thank you for getting into the trouble of troubleshooting my stupidity! I know that this will be something very small i have not noticed, i appreciate your help!

    Edit: if anyone is on the programming phase of his MJOY construction, could you please tell me what CRC does your programmed ATmega16 has?
  4. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    Hi Nucma,

    What I ALWAYS get wrong is the pin numbering on the D-Sub connectors. I know you say the Ponyprog is working for simple programs, but just double check that you have wired the adapter using the teensy weensy pin numbers on the soldering side of the D-Sub connector and NOT any of the drawings.

    I am not an expert though as I am suffering badly with simple connections to my joystick. My Mjoy works perfectly with jumpers mimicking buttons, but when I have the buttons all connected up in a fashion which I think is fine (with one diode per button), NONE of the buttons on my joystick work at all but everthing works perfectly using the my throttle buttons!!! My brain hurts and I feel your pain.

    Regards,
    George.
  5. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    Also, Nucma,

    You don't have the 330 ohm resistors duplicated do you? In other words both on the MJoy board AND in the Programmer? Mindaugas' circuit diagram has them on the MJoy, and the AVR ISP diagram you published earlier has them in the connector.

    George.

    Back to my problem now :(
  6. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    George, good luck to both of us!!
    I do not have the 330 Ohms double, only on the programmer...
    I will open the plastic case of the D-sub connector tomorrow morning.. But my guess is that the programmer works since it does program AND reads the data from the uC... And the saga continues :swim:
  7. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    NuMca,

    You have picture of this assembled PCB?

    I programmed one Mjoy16 a few moments, all work OK.
    But I don't know how check CRC...

    Sokol1
  8. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    Goodmorning Sokol,
    the CRC is written on the lower bar of Ponyprog after the programming is done. To be sure, after finishing programming the uC, click Read Device and you will have a refreshed CRC on the bottom of the PonyProg window..

    Look here, on the LOWER RIGHT SIDE: CRC: 1D21h
    [​IMG]

    I will borrow a camera and upload some pictures of the PCB in a few hours!
  9. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    NuMcA,

    Checked, my CRC is 56DDh.

    [​IMG]

    If I check .HEX files - before write > Open Program (FLASH) File, CRC is EA4Eh.

    Tested with 3 .HEX download from different pages, ie:

    http://www.powernet.pl/~krzysiek/elektr ... mjoy16.htm
    http://www.powernet.pl/~krzysiek/elektr ... W_v1.3.zip

    File caled MJoy16-C1 SW v1.3

    My test bench:

    [​IMG]

    One thing: Using LPT1 programmer, when done, unplug USB cable FIRST - that is used as power source (+5v, GND) only - and LPT1 cable AFTER.

    In Mjoy(ATMEGA8), reverse order when unplug cables cause that microcontroller is locked in 1 MHZ frequency, that only is possible unlock using ATMEL programer.
    I dont't know if affect Mjoy16 (ATMEGA16), but in any way, I follow this procedure, and have not been having problems.

    Sokol1
  10. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    I have just come back from university. I will take some photos and post them!

    EDIT: i just realized that the 3V3 Zener diodes i have are the BZX85C. Are they compatible with the 1N4733A found on the schematic ?? :blush: ( i used Mjoy16_v1.pdf )
  11. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
  12. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    NuMcA,

    My test bech is one complete Mjoy16 - with pull-up resistor and jumpers for Center and Mode, only missing keymatrix - inconvenient to put into joystick. ;D

    Sokol1
  13. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    Yes, that is what i am looking for. A test bench with ZIF to program and test the MCU and if testing is ok, i will later solder the programmed MCU onto the PCB. I have to keep the PCB as flat as possible, i don't want to use ISP adapters on it..
  14. xb5967

    xb5967 New Member

    Joined:
    Nov 17, 2009
    Messages:
    5
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Frakk,
    Thanks for the tip on wiring. I checked my serial connector and found a bad wire. Rewired it and WOW every thing worked. I now have a Mjoy controller. Thanks again for your help on that.

    Some of you are having the same problems I had. One word of advice that I recieved form here that was the most helpful is check you work. that means check more than once. I checked my AMC programmer, all was fine. Frakk recommended to check it again and I found the bad wire. I can't tell you how many times I checked my board because I thought I might have over looked something. The guys here ARE good people, in my case Frakk and Senetor, they got me up and running. THANKS Guys.
  15. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    xb, I'm happy to hear you got it working!

    NuMcA, for prototyping I would recommend using only the breadboard, no ZIF socket, only the neccessary components. I'm pretty sure your problem will be solved by double checking ALL of the port connections, Parallel and USB, double check the circuit (use the original circuit in Mindaugas' manual).

    George: Check the polarity of the diodes on your buttons! Diodes are like a one way valve, if you connect them in reverse they are open circuit. Just reverse the two wires going to the switch and see if they work
  16. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    I discovery one thing: Mjoy is very resistent!

    Yesterday I build my pedal version whit 3 axis only.
    But the lady in print shop reduce my layout about 8%...
    I found this when try to put socket, and decide insist - whit difficult put socket and crystal - but due the stress of this, I made several mistakes in place components:

    Invert Data- and Data+ pins in ATMEGA8, put a 2,2k resistor in place of 4,7k and
    put these resistor in place of one zener diode!!!

    Several checks, change crystal, many de-solder, solder, programing (around 10 times) finally I find inverted resistor x diode, and fix.

    And Mjoy (MPed) - in spite this torture work! :yippiee:

    Sokol1
  17. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Sokol, it is not the Mjoy that is resistent... it is electronics (except for some ESD sensitive components).
    Re-soldering some components will not break anything :D As long as you connect the circuit the way it should be, everything should work.

    Don't forget: 95% of electrical errors are mechanic
  18. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    CH Joystick MJoy16 alteration ready to go!

    Yesterday I wrote yesterday to Nucma: What I ALWAYS get wrong is the pin numbering on the D-Sub connectors, and that I could not get the external joystick to work with my MJoy16. Well I have fixed it, and the problem was (wait for it ...) that I got the pin numbering on my D-Sub connector wrong - again!! :blush: One day, one day, I will get my D-Sub connectors right the FIRST time!

    Final connections this weekend. :cheers:

    I just noticed: this has taken me 7 months! :no:

    Regards,
    George.
  19. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    Diode polarity; Hat identifier pins

    Thanks for the advice, Frakk.

    I never do anything the easy way, so I have a complicated diode setup because some of my joystick hats are identified by a pin from PC0 to PC7, and others by a pin PB0 to PB4. Thus some of the hats have their Up, Right, Down, Left positions mapped vertically and some horizontally in the mapping matrix. (See my spreadsheet and the diagram below if you want to clarify what I mean.) This way Hat 2Up on my CH Joystick can send a Direct X Button 2 message rather than Button 9 which would otherwise be sent (if I had all of the hats and buttons laid out horizontally as in the right half of the spreadsheet - which is the Throttle mapping), and older games do not have a mapping capability: i.e. Button 2 will always fire Cannon in Fighter Squadron.

    The diodes therefore are sometimes anode to switch and sometimes cathode to switch, but it all works the way I want.

    Why bother with all this? See my next post.

    Regards,
    George

    Attached Files:

  20. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    Warning re Autohotkey, SVMapper and PPJoy

    A warning: Autohotkey and SVMapper cannot map a DirectX Button to another DirectX Button: say Button 9 from to Button 2.

    The only program which can do that is PPJoy by creating a Virtual Joystick. Unfortunately PPJoy can only be installed on Windows XP and earlier - no Vista, and no Windows 7 - so it is now THREE operating systems old, and the bloke who made it has received about ONE postcard and no donations for his work, and it is how no longer being developed.

    Regards,
    George.