I think I’ve covered the material needed for a beginner to analyze and choose microcontrollers. However, a beginner may not be comfortable with reading datasheets, or families of datasheets. As such, I’ll help beginners through microcontroller families.

This skill where you can download a few spec-sheets, analyze them, and understand them is an absolutely necessary skill. There’s hundreds of chips released every year from many manufacturers. And while practice with a specific chip is the only way to true expertise, there’s still the “breadth” of knowledge that comes in handy when selecting chips.

In this guide, I’m going to deep dive into AVR EA, the newest 8-bit AVR microcontroller from Microchip. But with commentary to help beginners understand the “big picture”, how to evaluate this line and compare/contrast with other lines of chips.

Why so many chips?

Beginners might be flabbergasted to learn that there are 1498 available AVR-chips for sale, despite only ever being made by Atmel/Microchip. Of these, 1298 chips are the 8-bit AVR with mostly the same assembly language since the early 00s.

AVR itself refers to the instruction set (https://ww1.microchip.com/downloads/en/devicedoc/atmel-0856-avr-instruction-set-manual.pdf), the assembly language / machine code that makes up all of these chips. Development tools (compilers, linkers, IDEs) are built on top of this ISA and therefore cannot change very much in practice.

But many other features and specifications: the number of timers, 8-bit ADC vs 12-bit ADCs, DACs, UARTs, SPI, etc. etc. can and do shift on a regular basis. And ultimately, that’s what leads to this chip proliferation. Its almost always possible to find a chip that does exactly what you want it to do, at the lowest price, at the lowest power-usage. So there’s a lot of marketing and swapping of features to create a perfect chip for every application.

Microchip’s AVR EA Family: (2nd) Newest 2023 era chip family

So lets get started at looking at the AVR EA. (Oh no, while I was writing the AVR EB was released and I’m too lazy to switch now… oh well…).

The webpage is a great starting point (https://www.microchip.com/en-us/products/microcontrollers-and-microprocessors/8-bit-mcus/avr-mcus/avr-ea ), but this only introduces the AVR EA family in general. We still have … well…

All the other chips within the family. Now the main thing here is 28pin, 32-pin, and 48-pin pinouts… as well as 16kB, 32kB, and 64kB of Flash. Fortunately, the AVR Instruction set, and all the hardware (ex: Timer specifications, RTC, GPIO configurations, etc. etc.) are shared with recent chips (AVR EA shares very similar drivers with the AVR DD, AVR DA, and AVR DB chips released in the last 3 years).

The homepage contains the following line:

The AVR EA family of MCUs is a great option for closed-loop control system designs and secondary monitoring devices for safety reasons.

I agree with Microchip here, but how and why is this the case? What features from AVR EA make it ideal for this? Well, all in due time.

Curiosity Nano / Development Boards

All manufacturers create a “Development Environment” to help speed up experimentation with new chips. AVR EA is no exception, with the ~$25-ish AVR EA Curiosity Nano.

https://www.microchip.com/en-us/development-tool/ev66e56a

There is a USB programmer on board that works with MPLab and the legacy Atmel Studio IDEs, so you can easily develop from scratch (even without buying a special purpose programmer like Atmel ICE or building an AVRDude).

Microchip also releases schematics and PCB designs for these development boards. We can see that the AVR EA Curiosity Nano is a 4-layer board for example. All the relevant docs are in that area.

Chip Programmer

If you leave the prototyping stage and start making custom PCBs, you’ll likely find a programmer useful for your later-stage prototypes on your custom boards.

https://www.microchip.com/en-us/development-tool/PG164100

MPLab Snap is the $35 lower-cost programmer from Microchip. I’ve never used this tool, I’m using a legacy “Atmel-ICE” (which used to be the $35 range, but it looks like MPLab Snap is replacing it). For Atmel-ICE, I’ve never had a problem just connecting over USB, running the wires to my board header and sending the code through. I’d expect MPLab Snap to be similarly easy.

Programming and Software

Atmel Studio (now Microchip Studio) is my preferred IDE, but it is considered legacy. Microchip Studio still is a free download and still work with AVR EA chips today (just tested with my Version4 of my Battery-tester project).

https://www.microchip.com/en-us/tools-resources/develop/microchip-studio

I’ve only ever used the free and open-source GCC compiler for AVR.

Microchip has been pushing hard for https://www.microchip.com/en-us/tools-resources/develop/mplab-x-ide , and I’d expect it to replace Microchip-Studio any day now. I do prefer the Visual-Studio based IDE though, but its hard to complain about free tools that work.

Microchip also sells their XC8 compiler, and there’s other compilers like Keil or IAR. But professional compilers are $1000+, and likely outside the range of hobbyists / beginners who are just getting started. In either case, the $0 GCC compiler and toolchain exists and works with both the $0 Microchip Studio IDE and $0 MPLab X IDE. There is a free version of XC8 as well that is missing a few features, but should be usable-enough for beginners.

All of these tools provide the C-programming language (and maybe even C++ programming language), as well as linkers (combining .o object files together), the ability to create libraries, and a few libraries to help handle basic problems (Printf, atoi, etc. etc.).

Some people prefer Arduino software, I don’t know much about it and have always preferred the low-level C stuff personally.

Can we talk about AVR EA yet?

Oh wow, yeah, I guess that’s a lot of cruft beginners need to know before they get to the chip. Lets start talking about the chip now!

Digikey has thousands in stock across 66 SKUs. Larger quantities can be ordered directly from Microchip in 5000+ at-a-time quantities (though it can take some weeks for larger quantities to arrive). Both Digikey and Microchip offer the Curiosity Nano development board that I talked about earlier, and that might be a better place to get started than the raw chips.

But anyone thinking ahead to the custom-PCB phase of your project should see the SOIC, SSOP, TQFP, and VQFN packages of various sizes are all available. With some at extended temperature ranges as well.

https://www.microchip.com/en-us/product/avr64ea32

The AVR64EA32 in TQFP was what I used for a most recent project. The 64kB Flash and 32-pin layout shares much in common with AVR DA, DB, DD, and older chips (very similar layout, size, pinout, and pcb-footprint), so I prefer using that over-and-over again in different projects of mine.

HTML Version: https://onlinedocs.microchip.com/oxy/GUID-838DDB25-4D69-4519-815B-A48DBACEED23-en-US-9/index.html

PDF Version: https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/DataSheets/AVR64EA-28-32-48-DataSheet-DS40002443.pdf

Entering the manual, we have 565 pages of documentation. This is pretty small for modern chips, and this is due to the relative simplicity of 8-bit chips. (Many 32-bit chips are closer to 2000+ pages long). There’s no need to read every single page of the manual, but instead immediately bring your focus to the following pages.

The first pages are a 5ish page summary of all features. I’m not going through the entire list, but I want to draw attention to:

12-Bit ADCs are available on a lot of chips these days. But Differential and PGA are eyebrow raising. These are relatively rare features that are incredibly useful in the application of current-sensing. This suggests to me that the AVR EA is for reading current and reacting to current-changes (such as the 4-20 mA current loop protocol). This is absolutely the “killer feature” of the chip, and is the reason to pick AVR EA if you have any current-sensing use in your application.

Most chips have a “killer feature” like this somewhere. It could be very high memory (264kB on the RP2040), it could be incredibly accurate ADCs (RX23E-A), or whatever. Knowing and remembering that this AVR EA chip is extremely useful for this niche is something you’ll have to keep in mind for all future projects, thinking of what the best chip for your project could be.

Next, you’ll want to look at the port multiplexing.

Only some features are available on some pins. AVR chips are more flexible than most thanks to the Event-system (some outputs can go onto the event system and be routed arbitrarily), but outputs are often tied to just a limited number of pins. If you’re making a PCB layout, you’ll have to keep these pin-multiplex issues in mind.

From there, skip all the features and just read the Electrical Characteristics. Keep in mind your voltage-levels, the capabilities of pins, and any features of the hardware you’re interested in.

Don’t forget Application Notes

Going back to the AVR EA landing webpage leads to the documents section. Check it out.

If you’re not experienced enough to see the “killer feature” of a particular chip, look at the App Notes. They likely suggest situations that the chip is good at. They’re trying to sell you this chip after all, but these App Notes (despite being marketing / sales purposes) are still good technical information that will teach beginners how to think about projects.

In particular, https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ApplicationNotes/ApplicationNotes/AN4811-CurrMeasurem-BattMon-DS00004811.pdf

AN4811 is an AppNote covering how a 12-bit Differential ADC with 16x PGA (on the older ATtiny1627 chip, but still applicable to today’s AVR EA) can be used as a battery monitoring / Coulomb counting application.

Honestly, I’d say that these Application Notes are the #1 source of information for beginners and intermediate engineers who need some hand-holding to learn how to use these chips (or chip features).

Thats it, I guess?

Well, I don’t want to hold up everyone with an even longer article. But I think I’ve covered the crux of how to read a real world Microcontroller datasheet. There’s hundreds of other pages in the datasheet and not enough time to cover it all, but I think I was able to at least cover the basics.

Would anyone be interested if I gave a rundown of my AVR EA Battery Tester project some time later?

  • minnix@lemux.minnix.devM
    link
    fedilink
    English
    arrow-up
    1
    ·
    11 months ago

    This is great. Thanks so much for putting in the time to write this up. I for sure would like to see the info about your battery tester project.