Update on the AVR-Dx chips and PlatformIO

Changes to the system files

When removing the link to the Arduino framework from the platformio.ini, PlatformIO reverts back to the older 1.7 toolchain, which still lacks support for the AVR-Dx microcontrollers. You can override this in the platformio.ini:

[env:AVR64DA28]
platform_packages = platformio/toolchain-atmelavr@^3.70300.220127
platform = atmelmegaavr
board = AVR64DA28
board_build.f_cpu = 4000000UL
upload_protocol = custom
upload_flags = -cserialupdi
-p64da28
-PCOM4
upload_command = "C:\Program Files (x86)\AVRDUDESS\avrdude.exe" $UPLOAD_FLAGS -U flash:w:$SOURCE:i

But there is another option as well, you can change the file .platformio/platforms/atmelmegaavr/platform.json

from

 "packages": {
"toolchain-atmelavr": {
"type": "toolchain",
"owner": "platformio",
"version": "~1.70300.0",
"optionalVersions": ["~3.70300.0"]
},

to

 "packages": {
"toolchain-atmelavr": {
"type": "toolchain",
"owner": "platformio",
"version": "~3.70300.0"
},

and then have your platformio.ini simply as

[env:AVR64DA28]
platform = atmelmegaavr
board = AVR64DA28
board_build.f_cpu = 4000000UL
upload_protocol = custom
upload_flags = -cserialupdi
-p64da28
-PCOM4
upload_command = "C:\Program Files (x86)\AVRDUDESS\avrdude.exe" $UPLOAD_FLAGS -U flash:w:$SOURCE:i

Finally you can create a new board manifest in order to default to the serialupdi upload protocol and the 4 MHz default clock frequency:

file .platformio/platforms/atmelmegaavr/boards/AVR64DA28_serialupdi.json

{
"build": {
"f_cpu": "4000000L",
"mcu": "avr64da28",
"variant": "28pin-standard"
},
"hardware": {
"oscillator": "internal"
},
"name": "AVR64DA28 serial UPDI",
"upload": {
"maximum_ram_size": 8192,
"maximum_size": 65536,
"protocol": "serialupdi"
},
"url": "https://www.microchip.com/wwwproducts/en/AVR64DA28",
"vendor": "Microchip"
}

now you can shrink your platformio.ini to

[env:AVR64DA28_serialupdi]
platform = atmelmegaavr
board = AVR64DA28_serialupdi

You can find the corresponding files here: https://github.com/uwezi/AVR-Dx/tree/main/platformio

Lämna ett svar

Denna webbplats använder Akismet för att minska skräppost. Lär dig om hur din kommentarsdata bearbetas.