Go Down

Topic: Strange error with mega2560 R3 (Read 768 times) previous topic - next topic

c0d3Man

So I finally got the 16U2 replaced on my board [the original died for no reason and the warranty had slipped my mind till some time after my first attempt to replace the chip] but successfully got a replacement reworked onto the board, programmed it, and tested it with the loop back, it works perfectly. Problem is that for some reason, I can't upload to the board with bootloader, but I can upload code through a DAPA cable no problem, so after messing with serial communication, it seams that my board is sending serial data at a baud rate exactly 8x faster than what I tell it to, I have to program it to 1200 baud to achieve 9600, anyone have any clue what is happening here? the most I can think is maybe a misconfigured fuse, but other than that I'm stumped... any help would be appreciated

johnwasser

There is a fuse to initialize the system clock pre-scaler to divide by 8.  Perhaps the 16U2 firmware expects that fuse to be set?!?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

c0d3Man

#2
Jan 28, 2013, 05:02 am Last Edit: Jan 28, 2013, 05:34 am by c0d3Man Reason: 1
I thought that to, don't remember what happened when I set the clock divide, but I changed it back for some reason, also, forgot to mention that the bootloader doesn't seem to be starting up right, it doesn't do its triple flash then stop, it just keeps blinking (fairly quickly too);

EDIT: I find it strange though that I would need to set that bit, as the fuses are labeled as lfuse:0xFF hfuse:0xD8 efuse:0xFD in the boards.txt file, and the clock divide changes lfuse to 0x7F...

EDIT 2: This is very strange, it fixes my issue with not being able to upload with the bootloader and the baud rate issue, but now the timing is funny, delay(1000) seems to delay for about 8 seconds, and delay(100) is closer to a second, would really like to know what is going on with my board...

c0d3Man

#3
Jan 28, 2013, 06:51 am Last Edit: Jan 28, 2013, 02:22 pm by c0d3Man Reason: 1
So I think I figured out my problem, I never set the fuses on the 16u2, which means its still running at a mere 2MHz, this would explain why everything was behaving the way they where, the 2560 was sending data faster than the 16u2 could catch and translate it, I had just thrown the chip into DFU mode and burned the firmware onto it, guess I need to check my ICSP header tomorrow to see what is wrong so that I can set the fuses...

Go Up