{"id":2628,"date":"2025-08-06T20:58:58","date_gmt":"2025-08-06T18:58:58","guid":{"rendered":"https:\/\/www.sciencetronics.com\/greenphotons\/?p=2628&#038;lang=en"},"modified":"2025-08-06T23:41:08","modified_gmt":"2025-08-06T21:41:08","slug":"taming-the-avr64ea28-with-platformio","status":"publish","type":"post","link":"https:\/\/www.sciencetronics.com\/greenphotons\/?p=2628","title":{"rendered":"Taming the AVR64EA28 with PlatformIO"},"content":{"rendered":"\n<h2>The AVR-EA family<\/h2>\n\n\n\n<p>After the AVR-DA, AVR-DB and AVR-DD, already in 2022 Microchip continued the launching of new AVR-based microcontrollers with their AVR-EA series. These have some improvements over the AVR-DA. As for the AVRxxDA28, also the AVRxxEA28 comes in a breadboard-compatible PDIP package, and since it seems to be slightly cheaper and slightly more available from distributors I was briefly considering using the AVR64EA28 for my upcoming courses this autumn, but I found some problems&#8230;<\/p>\n\n\n\n<h2>PlatformIO and VSCode<\/h2>\n\n\n\n<p>When I tried to make my first project in PlatformIO using a AVR64EA28 I was a bit surprised and a bit disappointed to find out that this chip was not supported in their list of &#8220;boards&#8221;, so I put it aside for a short while. Yesterday now I was back at my desk at work and thought again about the upcoming courses.<\/p>\n<p>I found out that the AVR-EA series should be supported by the avr-gcc compiler toolchain, but I had still no success to configure PlatformIO to accept the AVR64EA28 and to get my first blinky snippet to compile nor upload. I reached out to the <a href=\"https:\/\/github.com\/platformio\/platform-atmelmegaavr\/issues\/75\" target=\"_blank\" rel=\"noopener\">github repository<\/a> of PlatformIO where I found another <a href=\"https:\/\/github.com\/platformio\/platform-atmelmegaavr\/issues\/66\" target=\"_blank\" rel=\"noopener\">already reported issue<\/a> with PlatformIO automatically reverting to an older version of the avr-gcc toolchain by default.<\/p>\n\n\n\n<h2>Solution<\/h2>\n\n\n\n<p>To make the whole story short, with all of its twists and turns, here is the recipe on how to setup PlatformIO for the AVR-EA family on the example of the AVR64EA28 &#8211; the only chip from this family which I currently have at hand for testing.&nbsp;<\/p>\n<h3>1. Updating some internals of PlatformIO<\/h3>\n<p>This will be valid for a Windows-installation of PlatformIO &#8211; for Linux and MacOS your mileage may vary&#8230; You will have to start a new project using any of the supported megaavr-chips (e.g. the AVR64DA28) in PlatformIO first so that the base libraries are downloaded and installed into PlatformIO.<\/p>\n<p>You need to download an unofficially updated avr-gcc toolchain from the makers of the Arduino <a href=\"https:\/\/github.com\/SpenceKonde\/DxCore\" target=\"_blank\" rel=\"noopener\">DXCore<\/a> (which I will not use). The package can be found at&nbsp;<a href=\"https:\/\/spencekondetoolchains.s3.amazonaws.com\/avr-gcc-7.3.0-atmel3.6.1-azduino7b-i686-w64-mingw32.tar.bz2\" target=\"_blank\" rel=\"noopener\">https:\/\/spencekondetoolchains.s3.amazonaws.com\/avr-gcc-7.3.0-atmel3.6.1-azduino7b-i686-w64-mingw32.tar.bz2<\/a><\/p>\n<p>Unpack the archive and replace the contents of your directory\n\n<div class=\"codecolorer-container text default notranslate\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">.platformio\/packages\/toolchain-atmelavr<\/div><\/div>\n\nwith the corresponding parts from the archive. Make sure to keep the two files\n\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">.piopm<\/div><\/div>\n\nand\n\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">package.json<\/div><\/div>\n\n.<\/p>\n<p>You also need to update the pre-installed version of the uploader avrdude if you want to use the <a href=\"https:\/\/www.sciencetronics.com\/greenphotons\/?p=2609\" target=\"_blank\" rel=\"noopener\">simple serialupdi uploader<\/a> I have described here previously. You can find <a href=\"https:\/\/github.com\/avrdudes\/avrdude\/\" target=\"_blank\" rel=\"noopener\">current versions of avrdude on Github<\/a>. Get the files avrdude.exe and avrdude.conf and replace the currently installed files in&nbsp;\n\n<div class=\"codecolorer-container text default notranslate\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">.platformio\/packages\/tool-avrdude-megaavr<\/div><\/div>\n\nI took mine from the installation of <a href=\"https:\/\/github.com\/ZakKemble\/AVRDUDESS\" target=\"_blank\" rel=\"noopener\">avrdudess<\/a> which I already had on my system.<\/p>\n<p>&nbsp;<\/p>\n\n\n\n<h3>2. Setting up your &#8220;Board&#8221;<\/h3>\n\n\n\n<p>In PlatformIO everything is centered around development boards, so even if you like me want to just program the bare-iron chip itself you will need to set up a board description file. This file needs to go into\n\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">.platformio\/platforms\/atmelmegaavr\/boards<\/div><\/div>\n\n&#8211; PlatformIO will automagically bind boards and platforms together. I called my file\n\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">avr64ea28.json<\/div><\/div>\n\n&nbsp; &nbsp;&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\">\n\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">{<br \/>\n&nbsp; &quot;build&quot;: {<br \/>\n&nbsp; &nbsp; &quot;f_cpu&quot;: &quot;4000000L&quot;,<br \/>\n&nbsp; &nbsp; &quot;mcu&quot;: &quot;avr64ea28&quot;,<br \/>\n&nbsp; &nbsp; &quot;variant&quot;: &quot;28pin-standard&quot;<br \/>\n&nbsp; },<br \/>\n&nbsp; &quot;hardware&quot;: {<br \/>\n&nbsp; &nbsp; &quot;oscillator&quot;: &quot;internal&quot;<br \/>\n&nbsp; },<br \/>\n&nbsp; &quot;name&quot;: &quot;AVR64EA28&quot;,<br \/>\n&nbsp; &quot;upload&quot;: {<br \/>\n&nbsp; &nbsp; &quot;maximum_ram_size&quot;: 6144,<br \/>\n&nbsp; &nbsp; &quot;maximum_size&quot;: 65536,<br \/>\n&nbsp; &nbsp; &quot;protocol&quot;: &quot;serialupdi&quot;<br \/>\n&nbsp; },<br \/>\n&nbsp; &quot;url&quot;: &quot;https:\/\/www.microchip.com\/en-us\/product\/avr64ea28&quot;,<br \/>\n&nbsp; &quot;vendor&quot;: &quot;Microchip&quot;<br \/>\n}<\/div><\/div>\n\n<\/pre>\n\n\n\n\n\n<h3>3. Create and configure your project<\/h3>\n\n\n\n<p>Now you should be able to restart VSCode and PlatformIO and create a new project. I did not include a framework definition in my .json file, because I don&#8217;t need the Arduino framework (or similar) for my projects I plan to do with the AVRs. Therfore, after you selecte dthe board file you will not have any framework to choose from. Just let PlatformIO create the project now.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/www.sciencetronics.com\/greenphotons\/wp-content\/uploads\/2025\/08\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"753\" height=\"584\" src=\"https:\/\/www.sciencetronics.com\/greenphotons\/wp-content\/uploads\/2025\/08\/image-1.png\" alt=\"\" class=\"wp-image-2631\" style=\"width:464px;height:auto\" srcset=\"https:\/\/www.sciencetronics.com\/greenphotons\/wp-content\/uploads\/2025\/08\/image-1.png 753w, https:\/\/www.sciencetronics.com\/greenphotons\/wp-content\/uploads\/2025\/08\/image-1-300x233.png 300w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/a><\/figure>\n\n\n\n\n\n<p>The last step now is to make sure that PlatformIO will not fall back to the default avr-gcc version 1.7 toolchain, but use the updated version 3.7 toolchain we just modified. For that add the line\n\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">platform_packages = platformio\/toolchain-atmelavr<\/div><\/div>\n\nto your\n\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"text codecolorer\">platformio.ini<\/div><\/div>\n\n:<\/p>\n\n\n\n<div>\n<pre>[env:AVR64EA28]<br \/>platform_packages = platformio\/toolchain-atmelavr<br \/>platform = atmelmegaavr<br \/>board = AVR64EA28<br \/>upload_port = COM4<\/pre>\n<\/div>\n\n\n\n<h2>Conclusion<\/h2>\n\n\n\n<p>Will I use the AVR64EA28 for my courses this autumn? No probably not. I have a working solution now on my computer under my installation of both Windows and VSCode &#8211; but when my students arrive with half a dozen of different installations of MacOS, Linux and different Windows, then I cannot see how I should help them to get a working setup in all cases.<\/p>\n<p>Microchip is on their homepage still stating that they are committed to open-source and the avr-gcc toolchain, but their solution to provide device packages which seem to flawlessly only work with their own IDE does not give me strong confidence. The latest release of a full tool-chain has been 3 years ago, since then they seem to be pushing more and more towards their MPLAB as development platform &#8211; but I really want to continue on the open-source track.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The AVR-EA family After the AVR-DA, AVR-DB and AVR-DD, already in 2022 Microchip continued the launching of new AVR-based microcontrollers with their AVR-EA series. These have some improvements over the AVR-DA. As for the AVRxxDA28, also the AVRxxEA28 comes in a breadboard-compatible PDIP package, and since it seems to be slightly cheaper and slightly more [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[8],"tags":[],"class_list":["post-2628","post","type-post","status-publish","format-standard","hentry","category-everything_en","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p48grL-Go","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/posts\/2628","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2628"}],"version-history":[{"count":3,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/posts\/2628\/revisions"}],"predecessor-version":[{"id":2633,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/posts\/2628\/revisions\/2633"}],"wp:attachment":[{"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}