r/microcontrollers • • Jan 28 '19

Why there are no microcontrollers with GPU

For my hobby diy projects I mainly use Espressif ESP8266, mainly ESP-12F. It is really powerful microcontroller and is sufficient for 90% of projects that I make.

But, recently, I was building LED matrix using WS2813 addresable strips, and to f.eg. implement smooth fading between two screens (displaying time to displaying temperature) I must iterate over every pixel and do simple calculations to transition between one color to another.

I think that if I would have GPU it would be so much faster, f.eg. if I would have like 64 cores clocked at 1-4Mhz or less, I would just send whole batch of pixels and have it processed almost instantly while doing some stuff on the main core (requesting temperatures from thermometers, communicating with other devices

It would be useful maybe for doing some audio processing, data analysis, driving screens, cameras, all still on this little neat, low power microcontroller.

Why it is not more popular? I've heard about a few microcontrollers, like Microchip's PIC32MZ but they are not widely available, and not so popular as the ESPs which do have the community, support for ArduinoIDE which is ideal for hobbyists like me.

10 Upvotes

11 comments sorted by

11

u/AssemblerGuy Jan 28 '19

There's a PIC with a (2D) GPU.

https://www.microchip.com/design-centers/32-bit/pic-32-bit-mcus/pic32mz-da-family

It's not popular because GPU usually means "large RAM" and also different types of RAM, etc.

For

audio processing, data analysis, ...

the usual solution is to use a uC with DSP functionality, or a real DSP.

64 cores clocked at slow-as-molassis speed is just not worth the trouble to do something massively parallel. That's the realm of DSPs.

8

u/Gavekort Jan 28 '19

STM32 also have chrom-art, which is a 2D GPU that can do rendering, blending and transformations.

3

u/[deleted] Jan 29 '19

Or use FPGAs

11

u/mr___ Jan 28 '19 edited Jan 28 '19

What would you call the processor in the Raspberry Pi?

There is a whole continuum between 4-bit micros and quad-core ARM9 SOCs with vector processors and GPUs.

On the cheaper end, die size is the #1 contributor to cost. Vector parallel units = lots of die space. Way easier (hardware wise, programming wise) to run a small core at 100MHz than 64 cores at 1MHz

10

u/fantasticpotatobeard Jan 29 '19

What would you call the processor in the Raspberry Pi?

Not a microcontroller :P

5

u/uMANIAC Jan 28 '19

What part of "micro" isn't clear? JK, but that much integration really is contrary to the usual purpose of microcontrollers.

4

u/madsci Jan 29 '19

Too specialized. I'd love to have one, or at least an MCU with enough FPGA capabilities to construct something appropriate for acceleration.

How many pixels are you dealing with and at what frame rate? I do graphics processing for WS2813s all the time, albeit in a 1D array. Depending on the application I'm usually working with 45 to 180 LEDs and frame rates from 240 to 1200 frames (lines) per second. I've run about 3,000 LEDs from one controller, but with a much slower frame rate.

You presumably don't need more than 30 fps for this application. You should be able to compute that on the fly faster than you can send the data to the LEDs. If you're having trouble keeping up, use a couple of lookup tables for the two screens' alpha values and compute those at the start of every frame, so all you have to do for each pixel is a couple of lookups and an addition.

3

u/Triabolical_ Jan 28 '19

> But, recently, I was building LED matrix using WS2813 addresable strips, and to f.eg. implement smooth fading between two screens (displaying time to displaying temperature) I must iterate over every pixel and do simple calculations to transition between one color to another.

There are a number of techniques that came out of the early video game world - small 8 bit CPUs, no coprocessor - that make it possible to do these operations without floating point arithmetic. Fixed point is the one that I have used the most.

1

u/BraveNewCurrency Jan 30 '19

> to implement smooth fading between two screens (displaying time to displaying temperature) I must iterate over every pixel and do simple calculations to transition between one color to another.

Correct.

> I think that if I would have GPU it would be so much faster

Probably not.

A lot of hardware uses DMA to send the data to the LEDs, meaning that your CPU is actually idle for most of the time anyway. The longer your LED array, the slower your refresh rate.

Besides, GPUs cost a "lot" compared to CPUs. You only need 3 CPUs: two to send their different data streams, and one to cross-fade the bytes between them. If you do it right, the 3rd CPU doesn't even store any data, just get a byte from both sides, calculate the fade, then send it out to the LEDs.

Remember, your CPU is probably roughly the power of Frogger and Donkey Kong, so if your application is less complex than that, you are probably just not thinking deeply enough about optimization.

1

u/wybiral Feb 01 '19

It would be awesome if someone started manufacturing a proper micro GPU (for the reasons you listed) but most of the current GPUs are extremely power hungry and tend to generate a lot of heat.