AVR-Dx micrcontrollers

History

When i started this blog 15 years ago, one of my first entries from May 2010 was about my first steps with Atmel microcontrollers. Since then these microcontrollers have become a substantial part of my work and spare time. Since 2012 I have taken over the course responsibility of a course at Uppsala University which was based first around the ATmega16, later I switched to the popular ATmega328, known from the Arduino Uno and its nano-cousins. During the pandemic I developed my own ‚duino based on the ATmega32U4 but everything was still based on the traditional AVR chips.

In the meantime Atmel has been taken over by Microchip and while I was hoping that the AVR series would at least not be discontinued in favor of the PIC and ATSAM series, Microchip came out with more modern yet still 8-bit microcontrollers – first a couple ATtinys and then the AVR-DA, AVR-DB, and so on. I was reluctant to look into these new devices because they were not compatible with my favorite USBasp family of programmers, but now recently there has been a new need at work for a microcontroller with more pins – we discussed the ATmega2560, but quite soon our PhD student and me ventured into the AVR-Dx series.   

Getting started

In order to get started I ordered a few 28-pin variants, the AVR64DA28, AVR64DB28 and AVR64EA28 from Reichelt in Germany, and I modified a USB-UART dongle to function as a UPDI programmer. And while I was in Germany to start cleaning out the house of my late father I connected the first test circuit and after about 10 minutes I had my first blinking LED.

Now my plan for the autumn semester is to not only use this family of microcontrollers for a couple of research projects, which was my original intention with microcontrollers 15 years ago, but to also restructure my microcontroller course to be centered around a new star, the AVR64DA28 which is still compatible with standard breadboards without the need for adapter sockets.

Programmer

The new chips need a new programmer, a single-wire UPDI interface, which can easily be constructed from a USB-UART dongle, and yet it is still supported by the avrdude tool, which was a prerequisite for my course intentions where I want to use primarily open-source tools.

So the principle is quite simple. I purchased a couple of very cheap USB-UART dongles with USB-C connectors and CH340E chips to update the material for my courses and other students‘ projects. What could be simpler than adding a resistor and a diode to these? I wired up two prototypes directly on the backside of the boards. I connected the first one using a USB-A to USB-C cable to my computer for the first tests and it worked flawlessly.

Problems arose when we tried the same programmer on our PhD students computer which only has USB-C outlets. Suddenly the programmer did not even light up its power LED and the computer did not recognize it. My first suspicion was of course a short-circuit on the PhD student’s breadboard, but no, that was not the cause. I later found out that these USB-UART dongles were just made too cheaply, the manufacturer had „forgotten“ the mandatory pull-down resistors on the CC pins, which means that a computer’s USB-C port simply will not even turn on its standard 5 V power supply on these ports. We helped ourselves with a stack of USB-C → USB-A → USB-C adapter stack for now…

Settings

Like in the past I want to use VSCode and PlatformIO for everything and here I found out what settings I need to be using for the platformio.ini file:

[env:AVR64DA28]
platform = atmelmegaavr
board = AVR64DA28
framework = arduino
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

What more?

The interfacing to the internal hardware of the AVR-Dx devices is still similar to the good old ATmega328 and its friends, but it is sufficiently different for standard libraries to not work out of the box. There are certainly plenty of Arduino libraries around which have already been ported during the past 5 years of the existence of the new chips, but my favorite libraries like the ones by Peter Fleury are not updated yet as far as I can tell. So some of my first efforts in order to give myself some debug possibilities was to modify Peter Fleury’s LCD library for standard alphanumeric LCDs, here is the first draft.

 

Kommentar verfassen

Diese Seite verwendet Akismet, um Spam zu reduzieren. Erfahre, wie deine Kommentardaten verarbeitet werden..