Calendar

December 2024
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Categories

Active supporter of WikiPedia
Support Wikipedia

Geocaching

Profile for uwezi

VSCode for everything

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 I had been looking into PlatformIO, but I failed to configure it for anything but Arduino-programming, which I didn’t want to do primarily.

PlatformIO

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 – honestly, I cannot understand why anyone still uses the classic Arduino IDE, when VSCode with PlatformIO offers great syntax highlighting, auto-completion, inline-help,…

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.  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.

Configuration

The necessary changes to the project’s platformio.ini which I use are:

For an ATmega328 with 1 MHz

[env:ATmega328P] 
platform = atmelavr 
board = ATmega328P 
board_build.f_cpu = 1000000UL 
upload_protocol = custom 
upload_flags = -pm328p 
  -Pusb 
  -B4 
  -cusbasp 
upload_command = "C:\Program Files (x86)\AVRDUDESS\avrdude.exe" $UPLOAD_FLAGS -U flash:w:$SOURCE:i

For an ATmega328 with 8 MHz

[env:ATmega328P] 
platform = atmelavr 
board = ATmega328P 
board_build.f_cpu = 8000000UL 
upload_protocol = custom 
upload_flags = -pm328p 
  -Pusb 
  -B4 
  -cusbasp 
upload_command = "C:\Program Files (x86)\AVRDUDESS\avrdude.exe" $UPLOAD_FLAGS -U flash:w:$SOURCE:i

For an ATtiny25 with 8 MHz

[env:ATmega328P] 
platform = atmelavr 
board = attiny25 
board_build.f_cpu = 8000000UL 
upload_protocol = custom 
upload_flags = -pt25 
  -Pusb 
  -B4 
  -cusbasp 
upload_command = "C:\Program Files (x86)\AVRDUDESS\avrdude.exe" $UPLOAD_FLAGS -U flash:w:$SOURCE:i

For an ATtiny13 with 1.2 MHz

[env:ATmega328P] 
platform = atmelavr 
board = attiny13 
board_build.f_cpu = 1200000UL 
upload_protocol = custom 
upload_flags = -pt13 
  -Pusb 
  -B4 
  -cusbasp 
upload_command = "C:\Program Files (x86)\AVRDUDESS\avrdude.exe" $UPLOAD_FLAGS -U flash:w:$SOURCE:i
My videos on the topic


 

We need to talk about ChatGPT

There are other, more detailed analyses, looking behind the curtains of ChatGPT, this is just a short summary of my own experiences. For more details, look e.g. here: ChatGPT: Interacting via a conversational way!

ChatGPT is this (in)famous artificial intelligence which has been all over the media lately. It describes itself as a language […]

Continue reading We need to talk about ChatGPT

Weird prices at Bauhaus

Sorry, this entry is only available in Svenska.

The TIAN MA A2C00096100 LCD

The electronics distributor https://www.pollin.de/ is often selling surplus displays, but normally these are not very well documented. The TIAN MA A2C00096100  LCD module is a 90 mm x 20 mm character display with on-board chip-on-glass controller. It has 20 alphanumeric character positions, actually 18+2 since there is a vertical 1-pixel wide bar separating the […]

Continue reading The TIAN MA A2C00096100 LCD

(Deutsch) Ach Ihr schon wieder…

Sorry, this entry is only available in German.

Nicely rendered 7-segment numbers

User cbm80amiga has uploaded a nice library to render 7-segment numbers on graphical displays – especially for Arduinos. But the code can as well be used without any Arduino in the proximity, just a slight change in the library made it an universal C++ object.

It had the ambition to follow up with further […]

Continue reading Nicely rendered 7-segment numbers

Temperature measurements with an NTC thermistor

sagecell.makeSagecell({“inputLocation”: “.sage”}); Following a discussion on Facebook I put here an online tool to calculate the output of a voltage divider consisting of a fixed resistor and an NTC thermistor following a first order Steinhart–Hart equation.

The calculations are based on a voltage divider where either the voltage over the NTC or over […]

Continue reading Temperature measurements with an NTC thermistor

Not WormFood’s AVR Baud Rate Calculator

This page without a frame: https://sciencetronics.com/uwezi/avrbaudrate.php

.errordiv { padding:10px; margin:10px; border: 1px solid #555555;color: #000000;background-color: #f8f8f8; width:500px; }#advanced_iframe {visibility:visible;opacity:1;vertical-align:top;}.ai-info-bottom-iframe { position: fixed; z-index: 10000; bottom:0; left: 0; margin: 0px; text-align: center; width: 100%; background-color: #ff9999; padding-left: 5px;padding-bottom: 5px; border-top: 1px solid #aaa } a.ai-bold {font-weight: bold;}#ai-layer-div-advanced_iframe p {height:100%;margin:0;padding:0}var ai_iframe_width_advanced_iframe = 0;var ai_iframe_height_advanced_iframe = 0;var aiIsIe8=false;var aiOnloadScrollTop=”true”;var aiShowDebug=false;
if (typeof aiReadyCallbacks === ‘undefined’) {
var aiReadyCallbacks = [];
} else if (!(aiReadyCallbacks instanceof Array)) {
var aiReadyCallbacks = [];
} function aiShowIframeId(id_iframe) { jQuery(“#”+id_iframe).css(“visibility”, “visible”); } function aiResizeIframeHeight(height) { aiResizeIframeHeight(height,advanced_iframe); } function aiResizeIframeHeightId(height,width,id) {aiResizeIframeHeightById(id,height);}var ifrm_advanced_iframe = document.getElementById(“advanced_iframe”);var hiddenTabsDoneadvanced_iframe = false;
function resizeCallbackadvanced_iframe() {}

Some Toner-Transfer PCB Highlights

Some recent highlights from my home-made circuit boards using the toner-transfer method.

0.5 mm FPC breakout board

Yes, I have been told that I am crazy before… Designed in KiCAD

0.5 mm pitch FPC breakout board – before etching

0.5 mm pitch FPC breakout board – half-way etched

Continue reading Some Toner-Transfer PCB Highlights

Canvas: Using Python to create Calculated Questions

Background

I just recently started with Canvas because Uppsala University has decided to use it as its upcoming LMS platform after a failed attempt with another product. Therefore I had already spent some time with Blackboard and was quite fond of the calculated questions type in quizzes. I quickly found out that Canvas offers […]

Continue reading Canvas: Using Python to create Calculated Questions