-
Reference: This is most likely not an avrdude issue but a Arduino STK500 V2 bootloader firmware issue.
|
Beta Was this translation helpful? Give feedback.
Replies: 27 comments
-
Bootloader FW source codes: It is a minor fix of the original Arduino version which has EEPROM bug. |
Beta Was this translation helpful? Give feedback.
-
BTW, I have some HW stability issues with this bootloader before with one paticular board. But this board seems to work normally under Arduino, so the issue may be different. It seems to be limited to terminal mode.
CLI mode works fine.
|
Beta Was this translation helpful? Give feedback.
-
I was worrying about timeout in terminal mode but using pipeline does not help.
|
Beta Was this translation helpful? Give feedback.
-
I think this is a limitation of the Arduino STK500v2 bootloader limitation (no support of page erase) No issues with urboot bootloader.
|
Beta Was this translation helpful? Give feedback.
-
No issues using the Optiboot bootloader from MegaCore either.
|
Beta Was this translation helpful? Give feedback.
-
As mentioned in the comments of PR #1376, that PR does not help for this issue.
|
Beta Was this translation helpful? Give feedback.
-
I will conclude this to be a limitation of the Arduino STK500v2 bootloader for ATmega2560. |
Beta Was this translation helpful? Give feedback.
-
I was wrong previously in #1337. Therefore, I would like to double check with you if I am right or wrong here. I think that this is an Arduino STK500 V2 bootloader limitation and not an avrdude issue. Thanks. |
Beta Was this translation helpful? Give feedback.
-
I think you are right, @mcuee.
But yes, if you have the source of the wiring bootloader it will become obvious what it does when asked to do a CE. |
Beta Was this translation helpful? Give feedback.
-
The bootloader code is here. It is a minor EEPROM fix of the original Arduino source code. It does not support CE. https://github.com/MCUdude/MegaCore/blob/master/avr/bootloaders/stk500v2/stk500boot.c#L974-L979
|
Beta Was this translation helpful? Give feedback.
-
I am not sure if we can fix the bootloader or provide a work-around in the Or we can just leave this as it is if you feel it is not worth the time to fix a very old bootloader. Other than the EEPROM read issue, there are also other issues reported in Arduino. And the original repo which is the base for Arduino stk500v2 bootloader. |
Beta Was this translation helpful? Give feedback.
-
One work-around is to use |
Beta Was this translation helpful? Give feedback.
-
Yes
In fact,
|
Beta Was this translation helpful? Give feedback.
-
New tests with a refresh bootloader, using
|
Beta Was this translation helpful? Give feedback.
-
BTW, the following fix does not help.
|
Beta Was this translation helpful? Give feedback.
-
Ah, I see. I do wonder why the terminal cache decides it needs to do a read/CE/write cycle. That is not necessary if the bootloader erases the page before writing it. The code you pointed me to, @mcuee, has (on my reading) a few peculiarities
better be
With above (untested!) suggested code the That are the kind of problems that are really hard to work-around in AVRDUDE, and I would prefer people fix their wiring bootloader. |
Beta Was this translation helpful? Give feedback.
-
I agree with you. I will try your suggestions and incorporate some of the changes mentioned in other places to see if I can get the wiring bootloader working better. For Arduino people, they probably do not care about this issue. And they do not really care about EEPROM read/write using avrdude either. So I guess they will not fix it. But @MCUdude may be interested to fix the bootloader in MegaCore. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
With your fix, it seems to work now. I have also incorporated the changes from the following two places.
|
Beta Was this translation helpful? Give feedback.
-
Maybe you want to give the above mod a try. Thanks. The following is the zip file contains the mod to the Arduino stk500v2 bootloader directory. I use your file as the starting point. |
Beta Was this translation helpful? Give feedback.
-
What's the big deal about a wiring bootloader for the m2560 et al? Urboot works, and at a fraction of used space, too? @mcuee: I don't get the |
Beta Was this translation helpful? Give feedback.
-
The only reason is that Arduino ships the ancient stk500v2 bootloader with their Arduino Mega (Mega2560). So all the clones will do the same as well. @MCUdude is mainly using Optiboot with MegaCore but he added the STK500v2 bootloader last year so as to make it possible to use MegaCore with any Arduino Mega 2560 without replacing the bootloader or uploading using an ISP programmer Then I informed him about the EEPROM issue and he updated the stk500v2 bootloader a bit later. |
Beta Was this translation helpful? Give feedback.
-
It is from the original code and the following fixes it for ATmega2560 but leaves that code for smaller Flash parts. I guess it may be related to the size of bootloader section in some parts. But even in that case, the proper fix is probably to define
In any case, this Arduino stk500v2 bootloader is only popular in ATmega1280/2560 and similar larger Flash part. |
Beta Was this translation helpful? Give feedback.
-
I agree. So I created an issue here. |
Beta Was this translation helpful? Give feedback.
-
BTW, there is a fork here. No idea how good it is. But stk500v2 is used in the XMega For Arduino project along with Caterina (USB AVR109 protocol) More interestingly there is a port for PIC32 MIPS32 core MCUs. |
Beta Was this translation helpful? Give feedback.
-
I am not so sure about rhe avrdude version they are using. One of the above repo says avrdude 5.8. There is a website which has the 5.10 binary and corresponding avrdude.conf file. The avrdude.conf file here has some entries for PIC32 MCUs.
|
Beta Was this translation helpful? Give feedback.
-
And interestingly we were discussing stk500v2 bootloader for PIC32 recently here. |
Beta Was this translation helpful? Give feedback.
Bootloader FW source codes:
https://github.com/MCUdude/MegaCore/tree/master/avr/bootloaders/stk500v2
It is a minor fix of the original Arduino version which has EEPROM bug.
https://github.com/arduino/ArduinoCore-avr/tree/master/bootloaders/stk500v2