LCD SPI & I2S - Serial & Parallel - Speed vs Ressources

neodata
Posts: 4
Joined: Tue Apr 25, 2017 5:48 pm

LCD SPI & I2S - Serial & Parallel - Speed vs Ressources

Postby neodata » Tue Apr 25, 2017 6:15 pm

Hi Everyone,

I'm looking for the most efficient solution to interface an TFT screen to the ESP32.

SPI Pro > Working fine @ 80MHz > Full screen update 320 x 240 ( 153600 Bytes ) in 16.80ms and only a few GPIO Used
SPI Cons > DMA transfert limited to ~ 4Kb ... CPU busy to transfert block by block in a loop ... defit the purpose of DMA

What about I2S 8 bit parallel output with DMA ? 8 bit x 80 Mhz with DMA allowing a full frame transfert at once should provide some nice improvement. Unfortunatly I do not find enough documentation on this setup ... is this possible ?

I saw an example using a camera with I2S 8 bit parallel input + DMA and there is an I2S "lcd mode" bit to play with ... can I work from this example reverting input / ouput ?

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

Re: LCD SPI & I2S - Serial & Parallel - Speed vs Ressources

Postby ESP_Sprite » Wed Apr 26, 2017 1:51 am

FYI, if you use the esp-idf SPI driver, the transfer should be done entirely in DMA, freeing up the CPU to do other tasks. We're aware of the 4K limitation in that driver, and I expect a MR that amongst others fixes this limitation to come through within a few days.

Wrt 8-bit LCD mode: there used to be a test case for this included in esp-idf, but because it was unmaintained and may be broken, it was thrown out. I've attached it to this post, maybe it helps you or someone else.
Attachments
test_lcd.tgz
(4.44 KiB) Downloaded 1316 times

neodata
Posts: 4
Joined: Tue Apr 25, 2017 5:48 pm

Re: LCD SPI & I2S - Serial & Parallel - Speed vs Ressources

Postby neodata » Wed Apr 26, 2017 3:40 am

Hi Sprite,

Thx for your feedback, yes I'm using esp-idf driver.

Looking forward for your update on the spi driver without this 4K limitation and indeed transfert entirely in DMA is the way to go.

Regarding I2S, thank you for the code ... good starting point :-) ... will update this post on both solutions vs my result

Aromo1
Posts: 1
Joined: Sun Apr 30, 2017 7:10 am

Re: LCD SPI & I2S - Serial & Parallel - Speed vs Ressources

Postby Aromo1 » Sun Apr 30, 2017 7:15 am

Hi neodata,

You wrote you had seen an example using a camera with I2S 8 bit parallel input + DMA. That's exactly what I'm looking for.
Could you give me the source location link, please?

With best regards,
Aromo1

neodata
Posts: 4
Joined: Tue Apr 25, 2017 5:48 pm

Re: LCD SPI & I2S - Serial & Parallel - Speed vs Ressources

Postby neodata » Fri May 05, 2017 11:58 pm

Hi Aromo1,

Sure, here is the link : https://github.com/igrr/esp32-cam-demo

I take the opportunity to add an update on SPI vs DMA vs 4Kb limit. This is solved in esp-idf latest release
( spi_bus_config_t > max_transfer_sz ). Everything works fine now, one call for a full frame transfert using
DMA @ 78Mbit/s ! :-)

BR

mikemoy
Posts: 627
Joined: Fri Jan 12, 2018 9:10 pm

Re: LCD SPI & I2S - Serial & Parallel - Speed vs Ressources

Postby mikemoy » Fri Jan 12, 2018 9:16 pm

@Aromo1,

Kinda embarrassed to ask this, but being new to ESP32, I am looking to do this as well. I am impressed with the speeds you achieved.
"full frame transfer using DMA @ 78Mbit/s ! "

Might you be willing to show you code, or at least the hart of that code so that I can see how the DMA is dumping a full frame.
I am not asking because I am lazy, just need a leg up on setting up the SPI DMA properly for this kind of speed.

If not, I understand.

RetroZvoc
Posts: 9
Joined: Tue Nov 27, 2018 1:21 am

Re: LCD SPI & I2S - Serial & Parallel - Speed vs Ressources

Postby RetroZvoc » Wed Jan 16, 2019 1:37 am

ESP_Sprite wrote:
Wed Apr 26, 2017 1:51 am
FYI, if you use the esp-idf SPI driver, the transfer should be done entirely in DMA, freeing up the CPU to do other tasks. We're aware of the 4K limitation in that driver, and I expect a MR that amongst others fixes this limitation to come through within a few days.

Wrt 8-bit LCD mode: there used to be a test case for this included in esp-idf, but because it was unmaintained and may be broken, it was thrown out. I've attached it to this post, maybe it helps you or someone else.
I'm so sorry for the bump, but I need to know more about this. I'd love to use my Velleman LCD with this, but I'm not sure if this code works with it. The screen driver is probably ILI9341, but I don't know https://www.velleman.eu/products/view/? ... &id=435582 this is the one I have bought, but only locally in my local shop and it didn't say it was ILI9341. I hope it is, but I'm not sure.

Could I fill a "scanline buffer" with pixels in the way how the NES/SNES consoles would fill their DAC with pixel data? How would I make sure that I don't overflow a DMA buffer in case it (the DMA buffer) ends before the scanline buffer? Does ESP32's CPU contain a CPU instruction code for indirect post-incremented write kinda like AVR (Arduino UNO) has LD X+, R16?

What functions in this code are for:
1. Executing every frame kinda like the NMI interrupt on the NES console which happens on VBlank
2. Executing every time a buffer needs a little refill
?

Who is online

Users browsing this forum: Bing [Bot] and 73 guests