Page 1 of 7

I2S-parallel example: Drive a 64x32 display

Posted: Sat Sep 30, 2017 10:10 am
by ESP_Sprite
So while we're still working on some kind of official driver for the parallel mode of the I2S peripheral, we do already have some logic for it working. Essentially, we can use DMA to set up a round-robin buffer to output a selected set of buffers over and over again. THis is ideal for generating a fixed signal of some sorts, and can be used to control a 'dumb' LED-display. This is what we did:
output.gif
output.gif (1.72 MiB) Viewed 75254 times
The logic involved actually is somewhat more involved than it may look: because the LEDs on the screen can only lit on 2 out of the 16 rows at the time, the display needs to be continuously supplied with data. To complicate things even more, each subpixel can only be turned off or on, so there's no chance of doing grayscale... unless you send a bazillion subframes to get something like PWM working. The end result is that the DMA engine in the ESP32 is put to good use here, continuously pumping about 100MBit of data into the LED-display without using up a single percent of CPU power. The result is pretty good:
20170930_114830.jpg
20170930_114830.jpg (845.94 KiB) Viewed 75254 times
Sources: led_panel_example_prelim.tgz Be aware that this is preliminary work and it comes with no guarantees or support from Espressif.

Re: I2S-parallel example: Drive a 64x32 display

Posted: Tue Oct 03, 2017 2:31 am
by wobblyboots
Spectacular Sprite_tm!

BTW

Code: Select all

#include "driver/gpio.h"
required in app_main.c and i2s_parallel.c to compile.


Image

On my display, despite leaving

Code: Select all

#define DISPLAY_ROWS_SWAPPED 1
the display is fine... and looking at the above output, the ABCD lines are in fact being clocked correctly (abcd=0 at the start and by the end of the cycle, abcd=1).

My Lena is more washed out than your picture, but the cat thing looks just fine.

Image

And by the look of it clocking at 4MHz.

My output enable and latch signals appear to be unreliable into by salae logic - probably going to fast for it's 24Mhz capture rate.

However, looking at the ABCD lines it appears each entire frame (64 pixels by 16 (x2) rows) is done in 0.25 ms. Amazing result for zero CPU.

kind regards
Ian.

Re: I2S-parallel example: Drive a 64x32 display

Posted: Tue Oct 03, 2017 9:27 am
by ESP_Sprite
Hehe - Lena is weird on LED-screens. Try taking a picture of it or looking at it through your eyelashes - color resolution immediately improves. My guess is that the colors are so similar that the brain focuses on the individual LEDs more than the image.

ABCD control the lines, not the rows :) Not sure why your display displays the same.... *cue lightbulb turning on* Aaaaaah wait, I remember that that actually may have been a peculiarity of the I2S hardware: I seem to recall something about it reading 32-bit words and sending the bottom 16-bits first, then the top 16-bits. Gotta look that up next week, but if that's the case, take the comments about the inverted lines with a grain of salt... Ah well, I said it was preliminary, right? :)

Re: I2S-parallel example: Drive a 64x32 display

Posted: Wed Oct 04, 2017 6:42 am
by BuddyCasino
I didn't get what hardware you were using. I suppose those aren't ws2812b LEDs because the display is "dumb"?

Re: I2S-parallel example: Drive a 64x32 display

Posted: Wed Oct 04, 2017 10:33 am
by ESP_Sprite
It's a standard display similar to this one. (But waaaay less expensive if you get them directly from/in China.)

Re: I2S-parallel example: Drive a 64x32 display

Posted: Wed Oct 04, 2017 11:05 am
by BuddyCasino
Thanks! What would you say is the max. pixel clock? Not that it isn't impressive already, mind you.

Re: I2S-parallel example: Drive a 64x32 display

Posted: Wed Oct 04, 2017 11:50 am
by loboris
ESP_Sprite wrote:It's a standard display similar to this one. (But waaaay less expensive if you get them directly from/in China.)
Less than 30 US$ with shipping from AliExpress (4mm pixel pitch) or ebay (2.5mm pixel pitch).
And Adafruit is probably buying the display they sell from China!

Re: I2S-parallel example: Drive a 64x32 display

Posted: Wed Oct 04, 2017 11:55 am
by BuddyCasino
Yeah ordering that from Adafruit would be insane. However I like fine-pitched displays, but I only found this one which is too large and expensive:
https://www.aliexpress.com/item/New-pro ... 0.0.rKRVoy

Anyone knows of something cheaper, yet still fine-pitched?

Re: I2S-parallel example: Drive a 64x32 display

Posted: Thu Oct 05, 2017 6:50 am
by ESP_Sprite
FWIW, P2 was the smallest pitch I could find that was still available for a reasonable price (RMB176 for a 64x64 display, should be incoming next week). Also, it seems most displays have a max pixel clock of 25'ish MHz because of the internal structure.

Re: I2S-parallel example: Drive a 64x32 display

Posted: Thu Oct 05, 2017 9:47 am
by BuddyCasino
Good to know, thanks. Do you know if there is a way to daisy-chain 2 panels, so the aspect ratio is closer to widescreen?