View previous topic :: View next topic |
Author |
Message |
jeremywilson
Joined: 11 Jul 2011 Posts: 79 Location: United States
|
Posted: Sun Mar 11, 2018 7:17 pm Post subject: Flashing M2561 from SD Card |
|
|
Bootloader goes through the steps of flashing the program (boot.hex) as verified by the serial com output. However, program space ends up empty. MCU endlessly reboots into bootloader.
Same results on 1GB FAT16 and 8Gb FAT32 cards.
Please help! Thanks!!
(see attached files) |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Mar 12, 2018 1:14 pm Post subject: |
|
|
best to include the terminal log.
also, is the boot loader renamed? _________________ Mark |
|
Back to top |
|
|
jeremywilson
Joined: 11 Jul 2011 Posts: 79 Location: United States
|
Posted: Mon Mar 12, 2018 8:00 pm Post subject: |
|
|
boot loader is DOS_Boot2.BAS.
main program is Boot.hex (renaming to Bootdone.hex worked fine until I disabled it).
after pressing mcu reset & button on E.4, terminal shows:
BCDFPM (short pause after F, long pause after P)
M
M
M
M
M
(M repeats forever)
reading the program memory with AVR Studio & JTAGICE confirms program space is empty (except where bootloader is). |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Fri Mar 16, 2018 10:26 am Post subject: |
|
|
i would recommend to start with a normal boot loader.
if that works, try this one. i also would shrink it down so it uses either bin or hex files.
a good way to debug is to run the code a a normal program.
then disable the actual erasing/writing but instead and much more debug info to see where it goes wrong.
when you say flash is empty, check if no fuse byte (or actual lock byte) disables the programming. _________________ Mark |
|
Back to top |
|
|
jeremywilson
Joined: 11 Jul 2011 Posts: 79 Location: United States
|
Posted: Sun Mar 18, 2018 10:15 pm Post subject: |
|
|
Quote: | i would recommend to start with a normal boot loader. |
The attached bootloader works fine.
The program that I'm trying to load from the SD works fine when programmed without bootloader.
SD card routines work, too.
Quote: | a good way to debug is to run the code a a normal program.
then disable the actual erasing/writing but instead and much more debug info to see where it goes wrong. |
I will try this. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Mar 20, 2018 9:16 pm Post subject: |
|
|
i have no idea who made the bootloader. but what i find odd is this :
!lds r0, {vl} 'store them into r0 and r1 registers
!lds r1, {vh}
usually this is done when writing to the page buffer, it is not required for all operations.
So i would compare to the original boot loader and modify accordingly. _________________ Mark |
|
Back to top |
|
|
jeremywilson
Joined: 11 Jul 2011 Posts: 79 Location: United States
|
Posted: Sat Mar 24, 2018 4:44 am Post subject: |
|
|
Finally had a chance to work on it today.
Found the problem right away. The BOOTSZ fuse was set to 1024.
Works like a charm now.
|
|
Back to top |
|
|
|