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. fredspeed

    fredspeed New Member

    Joined:
    Sep 1, 2009
    Messages:
    263
    Location:
    Northern Norway
    Balance:
    417Coins
    Ratings:
    +3 / 0 / -0
    Powering from usb.
    Programmer circuit will be checked. it was ok when i programmed the 8535, but that was a year ago. (could be haunted since then :D )
    If I set the fuses wrong first time, will it then be locked?
    As you said once: most electronic failures are mechanical, so i guess i find it there... :thbup:

    Fred
  2. fredspeed

    fredspeed New Member

    Joined:
    Sep 1, 2009
    Messages:
    263
    Location:
    Northern Norway
    Balance:
    417Coins
    Ratings:
    +3 / 0 / -0
    I have a second amc board and desided to solder just the programming port on it to try to program the mjoy again. Probe says ok, but it is still device missing message.

    So I hope someone could help me because it has to be a small error - the board is pro made. How can i test with my multimeter? Is there any component that can be damaged other than atmega, and is it posible to ruin atmega or locking it with wrong programming? Here is a picture of it: IMG_0051.JPG

    Fred
  3. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Again, can you verify that the programming circuit is working with an other At8535?

    Are you selecting the right device in PonyProg?

    Make sure you have 5V at the power pins.

    The connections on the Mjoy board are just straight connections to the chip pins, no components in the way.
  4. fredspeed

    fredspeed New Member

    Joined:
    Sep 1, 2009
    Messages:
    263
    Location:
    Northern Norway
    Balance:
    417Coins
    Ratings:
    +3 / 0 / -0
    I am selecting atmega16 in ponyprog
    Good to know there is no other component in the way, limiting what can be wrong.
    I will try to read on my amc tonight to check that circuit, and also check the voltage. Just thought it was a good idea to solder that prog port only.

    When I tried to program I first tried to read the fusebits, and it seemed to be reading the first time, and I set the fuses posted here. After that I only get this errors. When programming amc the tutorial said first read, then write fusebits, and then program. Now I have tried all kinds of way to get it touch with the chip. I believe the solution is easy, but I just cant find it Update tonight :)

    Fred
  5. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Ok, you didn't mention that you could successfully read and program the fuses once.

    If you misprogrammed the fuses it would explain everything. Below is how you should program them:
    fuse bits.jpg
    Note that: Unchecked means Programmed, Checked means Unprogrammed

    From the datasheet: External Crystal/Ceramic Resonator: CKSEL3..0= 1111 - 1010
    As you can see CKSEL fuses have to be all Unchecked to make them 1 = programmed.

    If you programmed the CKSEL fuses all 0000 (checked), then you selected an external clock source. In this case you will need to connect an external clock to the XTAL1 pin (pin13) because the crystal oscillator will not be started. You can try connecting a working At8535 XTAL1 pin to the At16's XTAL1 pin until you can reprogram the fuses as per the above picture. If that doesn't work a stronger clock source ~500kHz - 16MHz will do the job.
    I hope you didn't touch the lock fuses on top. :)

    Ask me how I know all this.... :lol:
  6. fredspeed

    fredspeed New Member

    Joined:
    Sep 1, 2009
    Messages:
    263
    Location:
    Northern Norway
    Balance:
    417Coins
    Ratings:
    +3 / 0 / -0
    wow!!! To be honest i do not remember what i have touch or not anymore, but I made myself a note about what fuses to check, and it is like your setup in the picture exept I wrote sut1 instead of sut0, so i guess that is the problem. So what i must do is to place a wire between my at8535 an at16? As a good student I will try for myself to find the right pins. If i need stronger clock source I might need some help to understand it better. So it might not be mechanical after all :D

    Ask me why i bought this from you :lol:

    And as I am trying to tell others too, describing everythig you do, makes it easyer to get help! (todays lesson)

    Fred
  7. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    The SUT fuses are for Start Up Time, and won't matter too much for operation. If you programmed everything the same then it should work.

    Pin13 is XTAL1, but you should already have the datasheet downloaded. Try clocking it with a working At8535, but first verify that the programming circuit works.
  8. fredspeed

    fredspeed New Member

    Joined:
    Sep 1, 2009
    Messages:
    263
    Location:
    Northern Norway
    Balance:
    417Coins
    Ratings:
    +3 / 0 / -0
    I have the datasheet and have found that pin. when first programming i did not realize it was so easy to lock it, and I might have done that!. time to shovel some snow here, but I will follow your advices, and i am pretty shure this board will be on the track again!
  9. fredspeed

    fredspeed New Member

    Joined:
    Sep 1, 2009
    Messages:
    263
    Location:
    Northern Norway
    Balance:
    417Coins
    Ratings:
    +3 / 0 / -0
    I was not able to read from my amc atmega 8535 so i guess that programming port do not work, despite i have done nothing to it after i succesfully programmed amc. My amc is working and i do not want to mess that up, thats why i made the port on my second pcb. Well I guess i must find another way to unlock it, or order a new... I believe i am not the only one doing that mistake, so I post it if i find the solution! Is it posible to just make a connection with just the crystal oscilator and caps that is used on amc?. (I have different crystals laying around)
  10. fredspeed

    fredspeed New Member

    Joined:
    Sep 1, 2009
    Messages:
    263
    Location:
    Northern Norway
    Balance:
    417Coins
    Ratings:
    +3 / 0 / -0
    Just one question: Is it posible to put the atmega16 on the atmega 8535-socket on amc to program it? The reason I ask is that I just progammed the amc (my 2nd) successfully, but was not able to program a brand nev atmega 16 on mjoy thru that same programming port.
  11. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Yes, you can program the At16 in the AMC socket, the chips are pin compatible.
  12. fredspeed

    fredspeed New Member

    Joined:
    Sep 1, 2009
    Messages:
    263
    Location:
    Northern Norway
    Balance:
    417Coins
    Ratings:
    +3 / 0 / -0
    Programming with the 8535-socket on amc reported successfull, :clap:

    But there is still a problem: Now I am back to the start with working buttons but no working potentiometer. I guess we have eliminated faulty atmega now that it is replaced and programmed successfully. I guess there must be something with the potentiometer-ports. there is no visible damage on it. (at least i can use it for my shifter now :D )

    Frakk: I hope you do not regret selling this to me, just want to make it work again. I have parts for mjoy, so if you suggest any parts to try to replace let me know. (Hopefully I do not have to)

    Regards Fred
  13. Sokol1

    Sokol1 Member

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

    You test wit a different potentiometer?

    Sokol1
  14. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Fred, you can eliminate hardware issues by measuring the voltage on the INPUT PIN of the chip. It is possible that the contacts in the sockets oxidize and cause problems, that's why you always take measurements directly from the pins. If you see a varying voltage 0-5V on the analog pins as you turn the potentiometer, the problem will be on the PC end.

    As always, look through the board for mechanical damage, make sure power is what it should be at all locations, check potentiometers, their connections and ensure these simple things are taken care of. These are the hardest problems to find because we take them for granted. :)
  15. fredspeed

    fredspeed New Member

    Joined:
    Sep 1, 2009
    Messages:
    263
    Location:
    Northern Norway
    Balance:
    417Coins
    Ratings:
    +3 / 0 / -0
    Feels like I use a lot of space at this topic, so i hope my troubleshotting also benefits others. ;D

    Tested with multimeter directly at the atmega pins:

    Between + or - at pot-socket and pin33 - 40 it is 0v to 5v depending on pot position (also measured solder joints on the back of the board. Between + or - and pin 30 it is 5v. Any place else I should measure?

    Also tested it with another pc, and it is the same!

    Fred
  16. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    All the values seem fine. Pin33..Pin40 are your 8 analog inputs. You measured only the first one (Pin40) which showed an analog voltge, the rest should be the same.

    The hardware seems to be functioning fine, I cannot think of anything that would cause this behavior other than software issues.
    If you are to replace components, try the two capacitors nearby and the 10uH inductor under the chip, but I don't think it will help.

    You could also try other 10k potentiometers and other versions of windows.


    EDIT:

    I just re-checked all your pins and you should measure 5V on the AREF pin, PIN 32. It seems to me that the capacitor is shorting it to ground. Remove the capacitor closer to the At16 and re-measure the AREF pin please.
  17. fredspeed

    fredspeed New Member

    Joined:
    Sep 1, 2009
    Messages:
    263
    Location:
    Northern Norway
    Balance:
    417Coins
    Ratings:
    +3 / 0 / -0
    Will try remove cap as soon as I have time, should I also replace it?. And sorry, I had 5v at 31 (gnd) not 30 as I posted. pin 32 is nothing when connected to pot +/- Have tried several different pots at all the pot gates. will also try with old win98.
  18. HalenTech

    HalenTech New Member

    Joined:
    Feb 11, 2011
    Messages:
    3
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hello, I am new to this forum. I have finished Mjoy16 with firmware 1.3. Board working. I need use this joystick to control motorbike handlebars. Problem is, that many games expect brake/throttle on the y axis together. Games does not find rudder or slider axes which would be perfect for this. Last axe visible to games is RotateX. So there are avaiable in game: X,Y,Z,RX. It is possible to make change in the firmware that Y axis will be computed from two inputs (pots)? If firmware change is unacceptable is there some other solution?

    Jan.
  19. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    If you send me the C source code I can modify it for you.

    Without the source, the firmware has to be written from scratch.
  20. HalenTech

    HalenTech New Member

    Joined:
    Feb 11, 2011
    Messages:
    3
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Only compiled hex. So only assembler.