Honda Insight Forum banner
1 - 3 of 3 Posts

·
Registered
Joined
·
1,386 Posts
Discussion Starter · #1 · (Edited)
While searching for a 5V MCU that had a 12+ bit ADC and was in stock, I stumbled across the AVR128DA28-E/SP. This is similar to the part one would find in an Uno or Mega, but quite a bit faster and with improved peripherals. And, this particular one is a 28 pin DIP, which means you can plug it into a socket on a protoboard and add exactly what you need.

Features:
and
  • Multiple serial ports
  • DAC
  • Programmable with a dirt cheap serial cable that can also power it
  • 24 MHz, might be overclockable
  • Potential for source-level debugging
  • Here, read all the things for yourself (see also the README in the link in the first bullet for even more info)

You can get the AVR128DA48-CNANO "Curiosity Nano" from Microchip which looks like a stretched Arduino Mini/Micro/Nano. You can also buy several different size boards from Spence Konde, the person who did the heavy lifting to port this to Arduino - and order a programming cable at the same time, or just use a USB to serial adapter you already have.

I used this serial adapter but it is not a recommendation, just an example and the first one I grabbed. There are many types and the interface to them is documented by the same developer. You need a Schottky diode (pictured below) to make the serial cable work.

To make this part available in Arduino's Boards Manager you have to go into Arduino Preferences and add this boards manager URL:

Handwriting Font Parallel Pattern Rectangle

Above: simple schematic of what's below, using a cheap USB serial adapter to both power and program it. (Does not provide a serial terminal.)

Passive circuit component Circuit component Hardware programmer Electronic component Line

Above: not much needed to get this going. All those extra pins on the bottom and side are not needed; they exist from earlier iterations.

This is typical blink code that is shown running above:

Code:
#define SWITCH 6
#define LED 7

void setup() {
  // put your setup code here, to run once:
  pinMode(SWITCH, INPUT_PULLUP);
  pinMode(LED, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(LED, LOW);
  delay(1000);
  digitalWrite(LED, HIGH);
  delay(1000);
  while (!digitalRead(SWITCH));   // freeze if switch pressed
}
 
  • Like
Reactions: Natalya

·
Linsight Designer
Joined
·
2,949 Posts
It's too bad the DIP28 pinouts isn't compatible with the 328p... that would allow one to swap uCs with an Arduino Uno.

It looks like the silicon errata rap sheet is a mile long... gone are the days where Atmel (now Microchip) had a competent V&V team.

I like the increase serial and 12b ADC, but honestly for such a modest speed bump (24 MHz vs 16 MHz), I'll stick with the MEGA2560. And then if I outgrew the 2560 on any given project, I'd just jump up to a Cortex M0, etc.
 

·
Registered
Joined
·
1,386 Posts
Discussion Starter · #3 ·
@mudder You are absolutely correct in that if you are building multiple boards you have a lot more options including 5V Cortex M0 parts. I'm not sure what motivates the AVR128DA line but price might.

But having a 1.8-5.5V part in a DIP package for same-day prototyping or tiny projects where you just need to talk to one or two pins in a 5V system, where you can just dead-bug the chip right in, this thing rocks.

I have a specially modified BCM that I use for IMA troubleshooting that provides me the ten stick pair voltages in real time. This requires tapping 5V analog and digital signals. If one were to choose a 3.3V MCU for this, Interfacing across the 3.3 to 5V boundary is a challenge from a signal integrity perspective and in the case of analog signals either loads the source or requires buffering or the use of an outboard 5V tolerant ADC (like the ADC1x15) and level conversion of the I2C lines back to the 3.3V MCU. A 5V to 3.3V converter is also needed to power the MCU.

Since I don't want to do all that for rev 2, I sought a 5V MCU with a built-in 12 bit ADC (and on a whim added DIP packaging as a filter) which led to this. (Mouser returns about 20 Cortex M0 parts that are 5V tolerant but no DIP packaging.)

I too was initially disappointed that this did not plug into an Uno board, but more than making up for this is the ability to program with a single wire, power and ground. It can be flashed directly - no boot loader. The 1 ms boot delay after reset that I measured is configurable from 0 to 64 ms (0 or 2^n where n = 0..5). So no waiting at reset while the boot loader boots because there is no boot loader.

Also making up for not plugging into an Arduino board is the DIP version that can be soldered into a protoboard or simply dead-bugged. Add a cap and 1.8-5V and you are done.

You can program these with nothing more than a $1 USB to Serial adapter (5V-tx-rx-gnd), a Schottky diode, and two wires to the chip (UPDI and ground).

A third wire (3.3 or 5V) if you also want to power it from the USB adapter, and a cap across power and ground at the chip for good measure.

I ended up going overboard and building a "programmer" with a ZIF socket and an LED that I can switch out of the circuit that I can use to tell if the part was programmed if I want to consume a pin for that.

But in fact all you need is that USB to serial adapter, a Schottky, and two pins on the target to attach it to.

I have yet to see how the ADC performs. It is 12 bits so I'm hoping at least 11 of those are usable (noise-wise) which is far better than the implementation in the Uno and Mega.

Then there is the ability to do source-level debugging, stepping through code in the target, breakpoints, watches, etc. This is possible with this chip but Microchip does not appear to have published the protocol so it hasn't found its way into the Arduino 2.0 IDE which is supporting source-level debugging for newer parts. Hopefully this will change, because importing an Arduino project into MPLABx you would think would be easy enough. But I gave it an hour of my time (with MPLABx already installed and building runnable code) and was not able to get it to work. You can debug projects written in MPLABx, but you can't use their code generator without getting stuck with their non-open-source license written into the generated source, so the Arduino IDE becomes the IDE of choice unless you already have a working toolchain that uses something else.
 
1 - 3 of 3 Posts
Top