# Processing Power, ATMEGA328

#### King2

Joined Jul 17, 2022
139
I have a stupid question, I just want to understand Why can't ATMEGA328 play audio/video on the Desktop monitor.

When I searched the answer for this question on the internet, I found, ATMEGA328 doesn't have that much processing power.

I don't understand here what does low processing power mean. Can anyone explain Why can't ATMEGA328 play audio/video on the Desktop monitor?

Last edited by a moderator:

#### BobTPH

Joined Jun 5, 2013
7,505
It means it cannot process the data fast enough. Video playback requires that a new image is created something like 60 times per second.

#### Papabravo

Joined Feb 24, 2006
20,369
I have a stupid question, I just want to understand Why can't ATMEGA328 play audio/video on the Desktop monitor.

When I searched the answer for this question on the internet, I found, ATMEGA328 doesn't have that much processing power.

I don't understand here what does low processing power mean. Can anyone explain Why can't ATMEGA328 play audio/video on the Desktop monitor?
It may also be a question of memory. A color monitor with standard HD resolution will have (1920 x 1080) = 2,073,600 pixels. Each pixel is represented by three 8-bit quantities. So:

$$2,073,600 \times 3\;=\;6,220,800 \text{ bytes per frame}$$

AFAIK there is no member of the ATmega family that has that much RAM
It is true that a smaller amount of memory could be used if there was a way to break up or compress an image and uncompress it on the fly.
One second worth of video would require a throughput of

$$6,220,800 \times 60\;=\;37,324,800\text{ bytes/sec}$$

or,

$$\approx\;2.68\times10^{-9} \text{ nanoseconds/byte}$$

There are not many processors that can maintain that level of throughput. It is not a problem for a DMA controller on a display adapter however. So ultimately you could conceivably match an ATmega328 with external memory and a display controller to do what you want to do but the engineering cost would probably be enormous.

Last edited:

#### crutschow

Joined Mar 14, 2008
32,839
what does low processing power mean
It has nothing to do with the electrical power it takes (although faster processing generally takes more power).
It refers to how fast a processor can process the data from input, to the required output.
The ATMEGA328 can't do it fast enough to process the high speed audio/video data.

#### MrChips

Joined Oct 2, 2009
29,184
Video processing can get very complicated. Hence let us look at simple mono audio processing

Audio processing power comes down to one parameter, data rate. This in turn is dependent on two parameters, word size x samples/second.

Let us take a classic 16-bit word x 44.1ksps. This works out to 705.6k bits/second.
Arguably, if you want to sacrifice fidelity, you can reduce both the word size and sampling rate.
8-bit samples at 20ksps can produce very good quality sound. 50μs per data point is very doable for many low range MCU such as Atmel ATmega328. It really depends on how much data processing is required of the software.

When I was an undergrad I wanted to determine the lowest data rate possible in order to generate recognizable voice recordings.
Surprisingly, 4-bit data at 4ksps produced very acceptable results. With logarithmic encoding the results were even better.
In our lab, our students are capable of transmitting music on a laser beam using 1-bit @ 20kbps using delta-modulation using an MSP430 @ 16MHz clock.

In summary, a lot depends on your application and how much degradation in sound quality you are willing to tolerate.
Video and stereo audio is far beyond the capabilities of an Atmel ATmega328. Monophonic audio is within its capabilities if you are willing to compromise on sound quality.

#### MrChips

Joined Oct 2, 2009
29,184
When it comes to video display from an MCU, you need:
1) a fast processor
2) lots of on-board memory
3) graphics software and hardware accelerators
4) efficient hardware interface to the display

all things that ATmega328 does not have.

Google examples of STM32 MCUs for video applications.
Example:

#### bidrohini

Joined Jul 29, 2022
190
In short, ATmega328P does not have enough memory and a processor to play audio/video. You have to choose a Raspberry Pi or something equivalent.

#### vanderghast

Joined Jun 14, 2018
67
In addition to the previous comments which are judicious, I would add that the processing power is not only limited by the memory or by the CPU clock, but also by the architecture and the source and the video device: one bus or two (a data bus and an address bus, or just one bus shared by the two needs), possible Direct Memory Access (DMA), by the speed and width (serial? parallel?) of the I/O, and the format (pixels, vectorial, compressed by some format which is understood by an embedded driver on the "video output device") among things to be considered. As example, if the "processing" is just about to switch between two externally pre-generated compatible serial streams, then the ATmega may be enough, but, as already said in other comments, in general, an ATmega is not an NVidia GPU with its parallel architecture.

#### DickCappels

Joined Aug 21, 2008
10,067
The basic answer to your question is contained in @MrChips in post #6. Those things require specialized hardware. The ATMEGA328 etc. is merely a pretty fast RISC controller. It is not intended to output complex signals beyond some simple waveforms. It can do audio but without special external hardware that would keep the controller pretty busy.

#### BobaMosfet

Joined Jul 1, 2009
2,081
I have a stupid question, I just want to understand Why can't ATMEGA328 play audio/video on the Desktop monitor.

When I searched the answer for this question on the internet, I found, ATMEGA328 doesn't have that much processing power.

I don't understand here what does low processing power mean. Can anyone explain Why can't ATMEGA328 play audio/video on the Desktop monitor?
The ATMEGA328 can only run at 16MHz at its fastest. The question is power/capability, it's speed. Any processor operates according to a heartbeat clock and there have to be enough beats in a short-enough timespan for it to do everything it needs to do. A to D and D to A conversions are _slow_-- and that is the bottleneck.

#### DickCappels

Joined Aug 21, 2008
10,067
Update, in case it is important someday: The ATMEG328P is good for 20 MHz operation with a Vcc of 4.5 to 5.5 volts.

#### BobaMosfet

Joined Jul 1, 2009
2,081
Update, in case it is important someday: The ATMEG328P is good for 20 MHz operation with a Vcc of 4.5 to 5.5 volts.
thanks for that- I accidentally pulled up the datasheet for the ATEMGA32.

#### Ya’akov

Joined Jan 27, 2019
8,145
Interesting to note is that the RPi Pico can produce VGA video using its PIO capability (one of many examples). “Powerful” in this context may be a bit confusing since PIO supports only 9 instructions.

Of course the main CPU’s two cores are involved in shoveling data about but the bit banging which would certainly kill any chance of getting video out it done by the PIO state machines. Effectively anemic FPGAs on the GPIO pins.

#### MrChips

Joined Oct 2, 2009
29,184
A few years back TheRB and I demonstrated that commonly available MCUs can generate VGA graphics on GPIO pins.
He used a Microchip PIC. I used STM32.

The DSO138 digital oscilloscope uses STM32 to drive an LCD module.

#### DickCappels

Joined Aug 21, 2008
10,067
No question, that beats a barefoot ATMEGA328 hands down.

#### RayB

Joined Apr 3, 2011
31
The ATMEGA328 has its domain but horsepower is not one of them.
To be fair to the little 8-bitter, it may be long-in-the-tooth but it changed the world.
32-bit microcontrollers have their place. Your statement about using the correct tool for the job is another way to say "engineer to the need."

Ray

#### nsaspook

Joined Aug 27, 2009
11,738
To be fair to the little 8-bitter, it may be long-in-the-tooth but it changed the world.
32-bit microcontrollers have their place. Your statement about using the correct tool for the job is another way to say "engineer to the need."

Ray
I don't know about the world but that generation (from all manufacturers) of 8-bit controllers changed the way people built digital electronics. The thing about 32-bit controllers is not only their power to run X application faster but the speed of their code space allows for much better source program structure even when using the same HLL like C as the 8-bit version. 8-bit C will always be a bit of a hack because the C abstract machine likes at least a native 16-bit set of registers and operations to have native instruction set integer promotion, atomic multi-byte operations and proper stack that can hold local variables.

#### RayB

Joined Apr 3, 2011
31
8-bit C will always be a bit of a hack because the C abstract machine likes at least a native 16-bit set of registers and operations to have native instruction set integer promotion, atomic multi-byte operations and proper stack that can hold local variables.
Ha, true: but only a problem if dropping to assembler requires a full understanding of the microcontroller reference manual. For the weekend Arduino coders, this is rarely a concern.

8-bitters are still great glue logic for any project that can suffer the limited master clock frequency.

I mostly work with SoC and 32-bit units > 100MHz. These units are still cheap enough to smoke one from time-to-time. Flash and SRAM are generous these days for the cost.

But, the newest, fastest microcontroller will still require a decent programmer to utilize the benefits of all the hardware resources. Shame to see an RP2040 blinking lights.

Before implementing any project on any hardware, one should ask the question, "Is this still the right microcontroller to use if I wanted to mass produce 1K units? 10K units? 100K units? Really, good engineering is something rarely done correctly by software programmers. That is why Fortune 100 companies pay for hardware smart IT System Architects and Enterprise Systems Designers.

#### nsaspook

Joined Aug 27, 2009
11,738
I'm building a pretty simple BMA490L accelerometer 32-bit project on a IoT dev WFI32E01PC board that will run on a much smaller custom PCB with another 32-bit of the same type but different target application.

pic32mk0512mcj048

The basic capture and logging capability could be hosted on a fast 8-bit controller but the 32-bit chips have advanced I/O modules (vectored interrupt, dma, hardware double precision floating point, etc...) that handles that task will little cpu intervention. This means I can do most of the number crunching data processing onboard.

Drop test detection with the DEV board and https://www.mikroe.com/accel-15-click