{"id":2270,"date":"2023-09-17T23:08:10","date_gmt":"2023-09-17T21:08:10","guid":{"rendered":"https:\/\/www.sciencetronics.com\/greenphotons\/?p=2270"},"modified":"2025-06-16T18:37:44","modified_gmt":"2025-06-16T16:37:44","slug":"vscode-for-everything","status":"publish","type":"post","link":"https:\/\/www.sciencetronics.com\/greenphotons\/?p=2270","title":{"rendered":"VSCode for everything"},"content":{"rendered":"<h2><del>Atmel<\/del> Microchip Studio<\/h2>\n<p><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">1 1\/2 years ago now I have finally abandoned Microchip (Atmel) Studio for programming AVR microcontrollers.<\/span><\/span><\/p>\n<p><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">I have been using Atmel Studio from the very first day I have been programming AVR microcontrollers and I have been following it through the version 4 to 7. But already a couple of years ago I had been looking into PlatformIO, but I failed to configure it for anything but Arduino-programming, which I didn&#8217;t want to do primarily.<\/span><\/span><\/p>\n<h2>PlatformIO<\/h2>\n<p>However, in the meantime I have been programming more and more Python as well, and discovered the advantages VSCode has over IDLE which I had been using so far. So together with my students I looked again into VSCode and PlatformIO. By default it is still configured for the Arduino framework ans as such it should completely replace the Arduino IDE &#8211; honestly, I cannot understand why anyone still uses the classic Arduino IDE, when VSCode with PlatformIO offers great syntax highlighting, auto-completion, inline-help,&#8230;<\/p>\n<p>But how can I use PlatformIO for my full toolchain from writing the code to uploading it using avrdude? The secret lies in the configuration file platformio.ini, which is part of every PlatformIO project.\u00a0<span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\"> A student of mine showed me how to configure platformio and I had to find out that the avrdude which comes with platformio is somewhat limited in its functionality. <\/span><\/span><\/p>\n<h2>Configuration<\/h2>\n<p><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">The necessary changes to the project&#8217;s platformio.ini which I use are: <\/span><\/span><\/p>\n<h4>For an ATmega328 with 1 MHz<\/h4>\n<pre><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">[env:ATmega328P] \r\n<\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">platform = atmelavr \r\n<\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">board = ATmega328P \r\nboard_build.f_cpu = 1000000UL \r\nupload_protocol = custom \r\nupload_flags = -pm328p \r\n<\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">\u00a0 -Pusb \r\n\u00a0 <\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">-B4 \r\n\u00a0 -cusbasp \r\nupload_command = \"C:Program Files (x86)AVRDUDESSavrdude.exe\" $UPLOAD_FLAGS -U flash:w:$SOURCE:i\r\n\r\n<\/span><\/span><\/pre>\n<h4>For an ATmega328 with 8 MHz<\/h4>\n<pre><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">[env:ATmega328P] \r\n<\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">platform = atmelavr \r\n<\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">board = ATmega328P \r\nboard_build.f_cpu = 8000000UL \r\nupload_protocol = custom \r\nupload_flags = -pm328p \r\n<\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">\u00a0 -Pusb \r\n\u00a0 <\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">-B4 \r\n\u00a0 -cusbasp \r\nupload_command = \"C:Program Files (x86)AVRDUDESSavrdude.exe\" $UPLOAD_FLAGS -U flash:w:$SOURCE:i<\/span><\/span><\/pre>\n<h4>For an ATtiny25 with 8 MHz<\/h4>\n<pre><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">[env:ATmega328P] \r\n<\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">platform = atmelavr \r\n<\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">board = attiny25 \r\nboard_build.f_cpu = 8000000UL \r\nupload_protocol = custom \r\nupload_flags = -pt25 \r\n<\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">\u00a0 -Pusb \r\n\u00a0 <\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">-B4 \r\n\u00a0 -cusbasp \r\nupload_command = \"C:Program Files (x86)AVRDUDESSavrdude.exe\" $UPLOAD_FLAGS -U flash:w:$SOURCE:i<\/span><\/span><\/pre>\n<h4>For an ATtiny13 with 1.2 MHz<\/h4>\n<pre><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">[env:ATmega328P] \r\n<\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">platform = atmelavr \r\n<\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">board = attiny13 \r\nboard_build.f_cpu = 1200000UL \r\nupload_protocol = custom \r\nupload_flags = -pt13 \r\n<\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">\u00a0 -Pusb \r\n\u00a0 <\/span><\/span><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">-B4 \r\n\u00a0 -cusbasp \r\nupload_command = \"C:Program Files (x86)AVRDUDESSavrdude.exe\" $UPLOAD_FLAGS -U flash:w:$SOURCE:i<\/span><\/span><\/pre>\n<pre>My videos on the topic\r\n\r\n<iframe loading=\"lazy\" title=\"YouTube video player\" src=\"\/\/www.youtube.com\/embed\/BKO1rYMPF_k?si=H9EB2MCsnbXCH4cj\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe>\r\n<iframe loading=\"lazy\" title=\"YouTube video player\" src=\"\/\/www.youtube.com\/embed\/jO473BruTis?si=b5orNxafa9fYn32s\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/pre>\n<pre><span class=\"yt-core-attributed-string yt-core-attributed-string--white-space-pre-wrap\" role=\"text\"><span class=\"yt-core-attributed-string--link-inherit-color\">\u00a0<\/span><\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Atmel Microchip Studio 1 1\/2 years ago now I have finally abandoned Microchip (Atmel) Studio for programming AVR microcontrollers. I have been using Atmel Studio from the very first day I have been programming AVR microcontrollers and I have been following it through the version 4 to 7. But already a couple of years ago [&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":[46,22,11],"tags":[],"class_list":["post-2270","post","type-post","status-publish","format-standard","hentry","category-avr","category-computers_en","category-electronics_en","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p48grL-AC","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/posts\/2270","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=2270"}],"version-history":[{"count":3,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/posts\/2270\/revisions"}],"predecessor-version":[{"id":2302,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/posts\/2270\/revisions\/2302"}],"wp:attachment":[{"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}