[AVR] STK500V2 bootlaoder works once only for Atmega2560

Status
Not open for further replies.

Narendra1190

Member level 2
Joined
Jan 23, 2014
Messages
44
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,288
Visit site
Activity points
1,666
Hi all Embedded Genius!

I have downloaded STK500V2 bootloader from below link.
Link : https://github.com/joede/stk500v2-bootloader

I have changed makefile as per requirement as below.

MCU : atmega2560
BOOTLOADER_ADDRESS = 0x3F800 (as bootloader program is 1954 byte so selected bootloader address of 1024 word from datasheet Pg. No :322)

After Building the project. Flashed Hex file to Atmega2560 through USBASP programmer using ISP port.
Hfuse: 0xDC
Lfuse: 0xFF
Efuse:0xFF
Lockbits : 0x0F

When reset button is presesed, LED start blinking and stays ON as there is no application program loaded. It shows bootloader is always ready to flash application program.

Now, I can load Application program to flash memory using Serial port through avrdude commands at 115200 baud rate.
I am using AVRDUDESS application to load program by selecting programmer "ATMEL STK500 version 2x firmware" or "USBASP" as per requirement.
After loading first program to flash memory, I have to press reset button to make it work and It works fine.
I can load as many Application program when fresh bootloader is ready but without pressing reset button.
If i press reset button the last flased Application program comes in life.


I can not flash new application program now.
I have tried pressing reset button to confirm bootloader is running at first 3 seconds of power on.
led blinks 3 times as per bootloader program then it goes in to main application and run the main program.
The only way is to load new Application is " CHIP ERASE" through ISP port using USBASP and do same process again but work for once only everytime.

I think main program is corrupting/Overwriting bootloader program but wonder why LED blinks in correct way like bootloader is working well.
I have locked LPM and SPM memory to protect bootloader from overwriting by application program.(Lockbits : 0x0F as per datasheet Page No :

Thank you for Reading.
Experts suggestions and guidance are most welcome.
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…