-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ATMega4808 and bootloader with UPDI #49
Comments
Have you selected the correct bootloader option in your platformio.ini file? You should have the line Have a look at this for the explanation https://github.com/MCUdude/MegaCoreX/blob/master/PlatformIO.md |
Yes, have run it as blank (no ref to bootloader), and as no_bootloader and as uart1 / uart1_def, which is the bootloader installed. There are slight differences, in some cases the in-built LED is illuminated in others it is not. Sorry should add, if I program no bootloader via arduino, (the workaround) then I can program via platformio as detailed above, and a build with/without bootloader works as described in the above workaround. but it does not write over an existing bootloader installed on the chip |
Could you try to include the flag I made a pull request so it is included by default, but it is not yet merged. |
Doesn't appear to work. The 4808 has a bootloader from Arduino installed, if I load with: Then it builds and transfers ok, but doesn't flash (it's just std blink) this is the same if I set no bootloader and uart1. build blink in arduino ide with no bootloader, then both no bootloader and uart1 bootloader may be loaded. it appears as if platformio can't overwrite an arduino installed bootloader. |
In platformio, installing the bootloader and the application is a 2 step process :
|
uploading with UPDI erases automatically the bootloader, |
Nope, neither of these last two suggestions work. Yes I can write the bootloader No I cannot overwrite an existing Arduino bootloader All of the above works though if i don't use UPDI for writing code |
The Arduino bootloader, as well as the Platformio bootloader (I think they are the same) enables the upload of a program using the serial port. If you are using UPDI, you will overwrite all of the memory, including the bootloader. When using UPDI with the Arduino IDE, it may re-upload the bootloader each time, so that's why it is working there but not Platformio. Once the bootloader is installed, please do not use UPDI. If you want to use UPDI, you do not need the bootloader. |
Arduino IDE selects which way you upload the program Selecting " burn bootloader" the ide will use updi to put the bootloader |
@matou78 correction :
The IDE uses UPDI if the selected board is |
If one uses the Arduino IDE to load a bootloader (or hex including a bootloader) into a 4808 (perhaps also other chips as well) by default it places the bootload at0x0 and the main program at 0x200.
If you now try to load a program via platformio/vscode using UPDI, it loads this into memory at 0x0 and not 0x200, unfortunately the chip still looks for the start of the code at 0x200 therefore when trying to upload code from platformio it does not work (although it does upload successfully - it doesn't direct the chip to start in the correct place).
The workaround (a bit unreliable) is to upload blink or similar from Arduino IDE with the nobootloader option selected - a few times, at which point platformio can now be used to upload code via UPDI, it does mean platformio needs Arduino IDE to configure the chip first.
Options:
The text was updated successfully, but these errors were encountered: