Pages: [1]   Go Down
Author Topic: Strange error with mega2560 R3  (Read 550 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 180
Posts: 8081
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?!?
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
« Last Edit: January 27, 2013, 11:34:45 pm by c0d3Man » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
« Last Edit: January 28, 2013, 08:22:14 am by c0d3Man » Logged

Pages: [1]   Go Up
Jump to: