[AVR] the new 8 bit micro to rule them all - Page 1
Forum section: electronics / general

author: Simon
author_rank: Unknown
timestamp: July 08, 2018, 07:38:08 pm
content: Microchip have come out with a new µC. Looks like they are attempting an ARM style series and on paper these look great:https://www.microchip.com/wwwproducts/en/ATMEGA4809

author: westfw
author_rank: Super Contributor
timestamp: July 08, 2018, 10:15:46 pm
content: Meh. Adding an extra 16k of flash and 4k of RAM is not enough, especially since the new "single address space" scheme appears to make that an architectural limit rather than just a chip limit. No speed bump. No high-speed crystal oscillator. Wastes most of the 32 bytes of IN/OUT accessible IO registers.Also suffering from the usual Atmel: "oh, we shipped out the first set of chips. More will be available ... in october"Still, I bought one of the associated Xplained boards. This chip is supposed to be used on the next "Arduino Uno Wifi v2" board.What was wrong with the XMega chips?

author: D-Jack
author_rank: Contributor
timestamp: July 08, 2018, 11:54:32 pm
content: Same old dying architecture. They were great before ARM took over and they didn't keep up. ARM processors have surpassed them in virtually every aspect, even cost!Today I sincerely can't think of a situation where it would be better to use an ATMega instead of a low cost ARM cortex-M0

author: Dubbie
author_rank: Unknown
timestamp: July 08, 2018, 11:59:07 pm
content: About 1/2 the price of a STM32f0But less than 1/2 the performance as well....

author: ataradov
author_rank: Super Contributor
timestamp: July 09, 2018, 12:03:27 am
content: Quote from: Dubbie on July 08, 2018, 11:59:07 pmWhat specific devices you are comparing here? As far as I can see it is more expensive than comparable (memory + pins) STM32F0 and even SAM D21 devices in 1K quantity on DigiKey.5V operation is nice in some applications, I guess.I like the data section as well. It would be better if any code could just write any flash. This was one of the most annoying things about classical AVRs.But otherwise, I personally don't see myself going back to AVRs.I'm not sure if it has been this case for other devices, but this datasheet describes UPDI in great detail. This is a nice touch.

author: westfw
author_rank: Super Contributor
timestamp: July 09, 2018, 12:58:29 am
content: Between architectural limitations, and questionable compiler optimizations, I've been pretty unimpressed with the CM0 recently. Some of the code gets really ugly, doesn't actually seem faster or more compact than an 8bit cpu EXCEPT for 32bit math, and you pay for that 32bit address space by needing to store a bunch of 32bit constants. ("lds r1,globalvariable" on AVR: 2 cycles, 3 bytes. equivalent on M0:8 bytes, somewhat indeterminate cycles. Which would probably be fine if it was one of those 72MHz chips with 128k of flash, but vendors are selling 25MHz chips with 16k of flash...))(Though I guess the 16k/20MHz chips are supposed to replace the 4k/10MHz 8bit chips, and might, price-wise. But you need to be careful.)Fortunately, vendors seem to be jumping on CM4, and it's nicer...And yeah, these aren't good excuses for limiting yourself to 48kb, architecturally...(Hmm. Does the 4809 match the pinout of the smaller Xmega chips? (Nope, not even close - 48 vs 44 pins.) How about the smaller SAM chips? (Nope again.). Sigh.

author: ataradov
author_rank: Super Contributor
timestamp: July 09, 2018, 01:05:29 am
content: Quote from: westfw on July 09, 2018, 12:58:29 amWell, with CM0+ you get 48 MHz for free (or at least 32 MHz). And the core performance is not all that important if you can offload a lot of work to more advanced peripherals, which 8-bitters don't seem to get even with this new device.Wait for the wave of Cortex-M23 / Cortex-M33 devices (SAM L10/L11 were just announced, I'm sure other vendors will follow soon). Not a bad followup to M0+.

author: coppice
author_rank: Super Contributor
timestamp: July 09, 2018, 01:30:06 am
content: Quote from: westfw on July 09, 2018, 12:58:29 amThe vast majority of those 25MHz chips are only running at a few MHz, because that's all most applications need. If you've ever had involvement with MCU applications support, and seen a large number of real world applications, you'll know that processor speed is really important to a certain group of users, but totally uninteresting to most.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: July 09, 2018, 01:33:11 am
content: Quote from: Dubbie on July 08, 2018, 11:59:07 pmI see figures of >1.7 DMIPS/MHz for most ARMs, maybe call it 1-1.5 for the simplest M0s? I see figures more like 0.3 for AVR, so that'd be more like 1/4th the performance. Which makes sense given the wider bus and richer instruction set. And then add on proportionally higher clock rates, and the bus width advantage for higher bandwidth applications...Tim

author: Dubbie
author_rank: Unknown
timestamp: July 09, 2018, 01:44:06 am
content: Quote from: ataradov on July 09, 2018, 12:03:27 amYou're right, I messed up the part number. A low end comparable pins/memory f0, is about $1 same for the AVR.So same price for 1/4 the performance...Not really a great value proposition.

author: NorthGuy
author_rank: Super Contributor
timestamp: July 09, 2018, 03:10:44 am
content: Quote from: T3sl4co1l on July 09, 2018, 01:33:11 amDhrystone operates on "int", which will be 32-bit on ARM and 16-bit on AVR. So, the direct DMIPS comparison is not possible.Also, the composition of the Dhrystone test is completely different from what you would typically do on 8-bit MCUs.IMHO, the real-world performance of 8-bit MCUs depends mostly on the periphery selection and organization. Typically, CPU is used mostly for control, not for number crunching. You wouldn't use 8-bit MCU if you wanted number crunching, would you?

author: Dubbie
author_rank: Unknown
timestamp: July 09, 2018, 03:13:48 am
content: No but for low power, sometimes it's better to wake up, do your business as fast as possible then go back to sleep.Having a slower less power hungry clock doesn't always make up for the longer time you spend awake.

author: Simon
author_rank: Unknown
timestamp: July 09, 2018, 06:51:19 am
content: The documentation has gone ARM style with things like DAC listed an unavailable. I'd not be surprised if they put an ARM core in this or develop the architecture further to an ATmega-1 and then put an ARM in that.

author: ataradov
author_rank: Super Contributor
timestamp: July 09, 2018, 06:54:31 am
content: Quote from: Simon on July 09, 2018, 06:51:19 amWhat would be the point of that and how it will actually be different from existing ARM chips that already have better versions of the peripherals present in this device?The style of documentation has changed because of transition to a common document preparation flow, it has no alternative or hidden meaning.

author: Simon
author_rank: Unknown
timestamp: July 09, 2018, 06:56:41 am
content: commonality of architecture and an easier transition.

author: Kleinstein
author_rank: Super Contributor
timestamp: July 09, 2018, 09:25:28 am
content: That new chip is just another 8 bit AVR. Nothing really new. The AVRs are can not really compete with the ARMs when it comes to CPU performance in most cases. Most of them will not run at a high speed - more like 1 MHz from the internal RC clock is usually enough for the typical applications for a 8 bit µC. The limited memory is not a big deal in small application - if the need some 1-4 K maybe 6 K it is sufficient to know there are upgrades to 16 K / 32 K / 48 K too. The large memory µCs are not that attractive for price reasons anyway - here the smaller feature size in the ARM based µCs can make them even cheaper. The 8 Bit µCs are more for those 80-90% of the chips where 8 K and 4 MIPS are sufficient.The predictable run time is a plus in some applications - race conditions with the cache sometimes kicking are difficult to find errors. Another point is that the AVRs are rather easy for the beginners - it starts with the length of the erratas.With the actual availability of the chips, the Xmega series was under different condition: here Atmel was still separate and AFAIK had trouble with external FABs.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: July 09, 2018, 09:53:25 am
content: Quote from: Simon on July 08, 2018, 07:38:08 pmTBH I am getting very bored with the choice of uCs nowadays... so many and so little to differentiate. I like PIC24 and PIC32MZ because at least they have interesting DMA features but otherwise it is a bit of a yawn.IMHO Microchip are missing a trick... they have CLC (Configurable Logic Cell) which looks really fun but in reality it is only very small scale/ just a few gates. If they were to have CLC on steroids in a PIC24 or above then at least it would be interesting.Yesterday I was sorting the collection of dev boards I have but have never got around to trying e.g. TI launchpad Value Sensing line and.... meh.STM is on my list to explore deeper and I have a few PIC projects already on the drawing board but having configurable logic (and either soft-core or SoC) i.e. FPGA is far more interesting.

author: tggzzz
author_rank: Super Contributor
timestamp: July 09, 2018, 10:08:14 am
content: Quote from: NivagSwerdna on July 09, 2018, 09:53:25 amVery true.Now have a look at the XMOS xCORE processors and xC.They are halfway to giving FPGA performance and predictability.

author: firewalker
author_rank: Super Contributor
timestamp: July 09, 2018, 10:18:59 am
content: One aspect AVR are better than ARM is the ease of use. The hardware setup of an AVR is more straight foeward quick and easier to debug. Of course this is a consequence of the limited hardware in comparison with an ARM.Alexander.

author: tggzzz
author_rank: Super Contributor
timestamp: July 09, 2018, 10:41:09 am
content: Quote from: firewalker on July 09, 2018, 10:18:59 amThe hardware setup of the xCORE intercore comms, i/o ports and timers is trivial. This is because the hardware and software was designed by people with a clue and without being unnecessarily constrained by past bandaids stuck on castles built of sand.

author: Simon
author_rank: Unknown
timestamp: July 09, 2018, 11:42:32 am
content: Quote from: firewalker on July 09, 2018, 10:18:59 amAnd the way they have designed this one looks a bit like the ARM style. The ADC feels like it was pinched from a SAM device, it runs 10x faster and has some autonomy. I'm sure there is a market for a device with ARM performance and AVR simplicity.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: July 09, 2018, 04:26:43 pm
content: I see this device does have "CCL – Configurable Custom Logic"... i'm sure that used to be called CLC. Anyway... it's a good start... but it's too small... Go LARGE Microchip!

author: nctnico
author_rank: Super Contributor
timestamp: July 09, 2018, 04:54:11 pm
content: Quote from: firewalker on July 09, 2018, 10:18:59 amThat depends entirely on what ARM MCU you are looking at. NXP's documentation for their LPC ARM series is exellent and their peripherals are easy to use.

author: ataradov
author_rank: Super Contributor
timestamp: July 09, 2018, 04:58:11 pm
content: Quote from: nctnico on July 09, 2018, 04:54:11 pmI have not seen a Cortex-M0+ MCU that was particularly hard to use. They all are about the same.The common pattern I see is people assume that they are hard because of something they read on the internet and resort to manufacturers libraries, which are bad in all cases. And this further reassures that Cortex-M0+ MCUs are hard.

author: SiliconWizard
author_rank: Super Contributor
timestamp: July 09, 2018, 05:01:09 pm
content: I wouldn't touch those unless I absolutely had to deal with AVR legacy stuff, as they don't seem to quite compete with even Microchip's own 8-bitters, at least a good chunk of them. They only guarantee operation at > 10 MHz at 5V and power consumption is ok but not that low either. But hey, they do have a 2-cycle hardware multiplier and a 150ksps ADC. Whoo-hoo! For one minute, I thought they might be very cheap and that would warrant a nice market share, but they are not even that cheap compared to a lot of other 8-bitters.Anyway, just my opinion of course. But I'm pretty sure they mostly target design teams that have a lot of AVR-based designs and knowledge (being playful we could say Atmel's fan base), rather than trying to gain new markets. I'd be interested in hearing opinions that differ though.

author: Simon
author_rank: Unknown
timestamp: July 09, 2018, 05:24:23 pm
content: Quote from: ataradov on July 09, 2018, 04:58:11 pmAs you say you have to write your own libraries, the more registers the more complex it gets. As I set about writing code to enable the ADC on a mega644 to run "in the background" I know it will be all useless on the mega4809

author: ataradov
author_rank: Super Contributor
timestamp: July 09, 2018, 05:34:05 pm
content: Quote from: Simon on July 09, 2018, 05:24:23 pmThis is a false statement. The reason there is more registers on most ARM implementations is more sensible redistribution of bits to logical registers, things are not as cramped and in 8-bitters. This makes life easier. Sure there are a whooping 3 registers to deal with interrupt (enable, disable, flags), but this just makes program easier to read and understand.And also increased number of registers comes from increased capabilities. And even with a library, you still have to configure all those capabilities in the request to the library.I do software support for a living, and in my experience writing direct initialization code for a peripheral on any architecture is shorter than calling a corresponding library. And the portability is also a myth, since features are different between different devices, you will still have to change library-based code if you want to move to a different MCU.

author: nctnico
author_rank: Super Contributor
timestamp: July 09, 2018, 05:41:41 pm
content: Quote from: ataradov on July 09, 2018, 05:34:05 pmAfter working over a decade with NXP's LPC ARM devices I have to say that the latter isn't true for these. I can use 90% of my hardware layer on the entire range from small to large devices and also on ARM7TDMI and ARM Cortex Mx.

author: tggzzz
author_rank: Super Contributor
timestamp: July 09, 2018, 06:08:25 pm
content: Quote from: Simon on July 09, 2018, 05:24:23 pm... or trivial in the XMOS xCORE devices: just dedicate one core to the ADC, and leave other cores to do other processing. That core then waits until an ADC input is available before resuming processing (with a 10ns latency), sending messages to other cores as appropriate.

author: madires
author_rank: Super Contributor
timestamp: July 09, 2018, 06:26:22 pm
content: The 0-series have multiple internal reference voltages which is quite helpful when measuring low voltages using the internal ADC.

author: Simon
author_rank: Unknown
timestamp: July 09, 2018, 06:40:38 pm
content: Assuming they are reliable. the usual 1.1V reference an AVR is +/-0.1V!

author: Kleinstein
author_rank: Super Contributor
timestamp: July 09, 2018, 09:07:44 pm
content: The CPU is still very similar to the old 8 bit AVRs (the mega series had a 2 cycle HW multipier - so nothing new here). The only difference I see is that that is a common memory space so that a single point could point to RAM or Flash. The separate address space was annoying with pointers in C, though it allowed for 128 k Flash and up to some 60 K SRAM (in theory).The periphery looks a little like in the ARM based µCs or the XMega series. It might make it easier to switch between those 0 series AVR and some M0 / M3 based ARM µCs in either direction.Using more registers sometimes helps, e.g. to avoid those read modify write cycles that sometimes cause trouble with interrupts. The downside is that only the lower registers have separate fast access.

author: maginnovision
author_rank: Super Contributor
timestamp: July 09, 2018, 09:19:54 pm
content: Quote from: tggzzz on July 09, 2018, 10:08:14 amYou can time any function to clock cycles if you have enough information. I've been using them for about 4-5 years. Predictability is equal, anything internal you can find you execution time thanks to a lack of cache. The performance is another thing though. Cores are only 400 - 500MHz and you're limited to 100-125MHz per thread depending on specific processor. Very useful for some things useless for others.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: July 10, 2018, 12:08:29 am
content: Quote from: Simon on July 09, 2018, 06:40:38 pmThe ATMEGA series has notoriously bad analog parts. The "10 bit" ADC is barely worth 8 bits, and that's if you believe the datasheet.I've also heard that the POR function fails at slow supply startup (dV/dt). How do you screw that up?The XMEGA series is much improved, having more, and more powerful, peripherals. The ADC is 12 bits, and actually worth most of them. It's 10 times faster. The analog comparator is >100 times faster. There are more references, that are actually fairly stable (though still nowhere near even the humble TL431).Alas, XMEGA is more expensive than ATMEGA, which is overpriced already. If they could cut their production costs they could bring them to compete with PICs. I suppose it will be interesting to see how Microchip decides to play them out, if they'll leave them as they are and "let the market decide", or shift market share to optimize sales figures, or discontinue one or more outright (which is really just saying the same thing).I don't get the feeling that any similar PIC can compete in terms of power and ease of use -- given I'm not deeply familiar with the PIC family. I know they go up in bits, but now you're talking a different segment, and they still suck: few registers, quirky instruction sets, huge errata sheets. And then there's the PIC24 abominations, and then PIC32 which is MIPS and therefore should compete with ARM and such instead (though I don't know if they have any that are nearly as powerful as Cortex >M0s). So, it seems like AVR is a value to them, to fill in that hole between crappy 8-bitters and nice 32-bitters.Tim

author: tggzzz
author_rank: Super Contributor
timestamp: July 10, 2018, 05:46:47 am
content: Quote from: maginnovision on July 09, 2018, 09:19:54 pmYes. Their strong points are the combination ofpredictablehardrealtime performance - unlike other all other processors on the marketaggregate performance via up to 32 independent coresIt is quite possible to have some cores doing USB comms to a PC, others controlling LCD voltages (i.e. without the chip usually required to ensure no DC component), and others processing 100MB/s ethernet.If, OTOH, you require single-thread speed and can tolerate unpredictable large latencies, then the xCORE are not the best devices.Their strong points mean they are significantly different to most of the identikit processors on the market.There's no need to be bored!All you have to do is open your eyes.

author: Simon
author_rank: Unknown
timestamp: July 10, 2018, 06:52:52 am
content: I suspect microchip are going to use the faster AVR CPU and create a new range that will replace both the traditional AVR and the PIC. This is clearly not a one off, it's the start of a new line. Maybe the ADC is better as it has been clearly changed, maybe it was a 12 or 14 bit version from a better device that has been limited ready to be opened up in say the ATmega-1 series.

author: coppice
author_rank: Super Contributor
timestamp: July 10, 2018, 09:59:02 am
content: Quote from: T3sl4co1l on July 10, 2018, 12:08:29 amIf you are persistent with trying many very slow startup patterns you can find a pattern that will cause the POR or brownout circuitry in many MCUs to misbehave. It seems very easy to design a flaky POR, and pretty hard to build a rock solid one.

author: madires
author_rank: Super Contributor
timestamp: July 10, 2018, 10:38:37 am
content: Quote from: Simon on July 09, 2018, 06:40:38 pmThe datasheet for the 3209/4809 states +/-5% for all reference voltages at V_DD 1.8 - 5.5V and t -40 - 125°C. Of course it would be nice if the bandgap reference would be more accurate, but it's possible to reduce the error by an external voltage reference and a little bit of math. I agree with T3sl4co1l that the ADC isn't great. Still, it's usable by averaging multiple conversions. The analog comparator has an offset which can be determined.

author: Simon
author_rank: Unknown
timestamp: July 10, 2018, 11:41:22 am
content: With 10x the ADC speed some averaging can be done and a conversion obtained in the same time as before but better. Take 8 samples add them and shift 3 bits.