I2S-parallel example: Drive a 64x32 display

ESP_Sprite
Posts: 1835
Joined: Thu Nov 26, 2015 4:08 am

I2S-parallel example: Drive a 64x32 display

Postby ESP_Sprite » Sat Sep 30, 2017 10:10 am

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 5235 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 5235 times


Sources: led_panel_example_prelim.tgz Be aware that this is preliminary work and it comes with no guarantees or support from Espressif.

wobblyboots
Posts: 18
Joined: Mon Sep 18, 2017 4:48 pm

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

Postby wobblyboots » Tue Oct 03, 2017 2:31 am

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.

ESP_Sprite
Posts: 1835
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Tue Oct 03, 2017 9:27 am

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? :)

BuddyCasino
Posts: 255
Joined: Sun Jun 19, 2016 12:00 am

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

Postby BuddyCasino » Wed Oct 04, 2017 6:42 am

I didn't get what hardware you were using. I suppose those aren't ws2812b LEDs because the display is "dumb"?

ESP_Sprite
Posts: 1835
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Wed Oct 04, 2017 10:33 am

It's a standard display similar to this one. (But waaaay less expensive if you get them directly from/in China.)

BuddyCasino
Posts: 255
Joined: Sun Jun 19, 2016 12:00 am

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

Postby BuddyCasino » Wed Oct 04, 2017 11:05 am

Thanks! What would you say is the max. pixel clock? Not that it isn't impressive already, mind you.

User avatar
loboris
Posts: 423
Joined: Wed Dec 21, 2016 7:40 pm

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

Postby loboris » Wed Oct 04, 2017 11:50 am

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!
Last edited by loboris on Wed Oct 04, 2017 12:03 pm, edited 1 time in total.

BuddyCasino
Posts: 255
Joined: Sun Jun 19, 2016 12:00 am

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

Postby BuddyCasino » Wed Oct 04, 2017 11:55 am

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?

ESP_Sprite
Posts: 1835
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Thu Oct 05, 2017 6:50 am

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.

BuddyCasino
Posts: 255
Joined: Sun Jun 19, 2016 12:00 am

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

Postby BuddyCasino » Thu Oct 05, 2017 9:47 am

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?

Who is online

Users browsing this forum: No registered users and 2 guests