Driving an 8-bit parallel 8080 bus using I2S
-
- Posts: 8
- Joined: Wed Nov 07, 2018 3:29 am
Driving an 8-bit parallel 8080 bus using I2S
I'd like to first excuse myself for the undertones of frustration throughout this post, but I ran out of steam.
This is supposed to be a simple question with plenty of references between the "har-in-air" Github repo (based upon @ESP_igrr code I reckon), the "pixelmatix" repo (which shares the same "DNA" I think), the esp-iot-solution LCD examples and the camera samples (also by @ESP_igrr on his repo).
But I can't for the life of me drive an 8-bit 8080 bus peripheral (which happens to be a LCD). I'm using a regular ILI9341 mcufriend-like Arduino-ish shield which works just peachy with TFT_eSPI in parallel mode (which bit-bangs the GPIOs). Every attempt I made of porting it to a esp-iot-solution component using I2S was a wreck. And I suspect it has to do with the code there always expecting 16 bit commands/register selections or equivalently that high data lines D[23:8] are not-cares for command parameters (see ILI9341 datasheet v1.11, page 110 for an example; also https://github.com/espressif/esp-iot-solution/issues/19).
After messing with the i2s_lcd_com code and attempting to send only 8 bits instead of what is clearly a two step write with byte swapping on iot_i2s_lcd_write_cmd (and rewriting iot_i2s_lcd_write_data to look similar to the cmd version, identical to the 16 bit version as a matter of fact except for masking data with & 0xFF; I wonder if this could work like the SPI master driver where you define a length in bits and use a byte swapping macro?). I currently have the LCD showing a very corrupt image with severe "banding" and every hint of garbage-in-garbage-out, not to mention colour inversion; but I can recognise some thin strips of the original image (which is just the demo from esp-iot-solution).
I read the TRM. I read all the above code. I'm getting pretty much nowhere in my attempts to grafting working parts together. And the fact that I have no logic analyser is making my working hours something less of a pleasure as I find myself stuck in a loop of trials and errors. My reading of the TRM v3.9, pages 306 to 312, lead me to believe the I2S peripheral just can't cope with the fact that some data simply can't be organised as 16 bit packets. In addition, for the data that can be thusly organised, the Data Frames Form 1 and 2 happen to be so esoteric that most gains from DMA are lost in attempts to re-layout memory, and that should have been instead a straightforward bitblt operation.
So allow me to frame my request in very straightforward terms.
If there is a solution to the 8-bit parallel 8080 bus problem, what exactly has to be done to configure the I2S peripheral in order for it to output a stream of 8-bit packets of data, some of which can't be packed in pairs to form 16 bit words, with the eventual need to flip a GPIO that represents the Command/Data (RS) signal, with the bus sampled by strobing the WR (WS) signal, with a maximum clock defined as an integer divisor of the APB clock, with DMA enabled to offload the CPU during larger transfers (and let's ignore reading the bus just for the sake of making things easier), and possibly not necessitating a wasteful memory relayout procedure for large transfers?
A working port of ILI9341 connected via 8 bit parallel would be the perfect demonstration, since it's such a common shield, but I'm happily settling for a clear, focused and authoritative explanation of that needs to be done to make the I2S LCD mode work for any bus width.
Thanks in advance for any help!
Regards,
CG
This is supposed to be a simple question with plenty of references between the "har-in-air" Github repo (based upon @ESP_igrr code I reckon), the "pixelmatix" repo (which shares the same "DNA" I think), the esp-iot-solution LCD examples and the camera samples (also by @ESP_igrr on his repo).
But I can't for the life of me drive an 8-bit 8080 bus peripheral (which happens to be a LCD). I'm using a regular ILI9341 mcufriend-like Arduino-ish shield which works just peachy with TFT_eSPI in parallel mode (which bit-bangs the GPIOs). Every attempt I made of porting it to a esp-iot-solution component using I2S was a wreck. And I suspect it has to do with the code there always expecting 16 bit commands/register selections or equivalently that high data lines D[23:8] are not-cares for command parameters (see ILI9341 datasheet v1.11, page 110 for an example; also https://github.com/espressif/esp-iot-solution/issues/19).
After messing with the i2s_lcd_com code and attempting to send only 8 bits instead of what is clearly a two step write with byte swapping on iot_i2s_lcd_write_cmd (and rewriting iot_i2s_lcd_write_data to look similar to the cmd version, identical to the 16 bit version as a matter of fact except for masking data with & 0xFF; I wonder if this could work like the SPI master driver where you define a length in bits and use a byte swapping macro?). I currently have the LCD showing a very corrupt image with severe "banding" and every hint of garbage-in-garbage-out, not to mention colour inversion; but I can recognise some thin strips of the original image (which is just the demo from esp-iot-solution).
I read the TRM. I read all the above code. I'm getting pretty much nowhere in my attempts to grafting working parts together. And the fact that I have no logic analyser is making my working hours something less of a pleasure as I find myself stuck in a loop of trials and errors. My reading of the TRM v3.9, pages 306 to 312, lead me to believe the I2S peripheral just can't cope with the fact that some data simply can't be organised as 16 bit packets. In addition, for the data that can be thusly organised, the Data Frames Form 1 and 2 happen to be so esoteric that most gains from DMA are lost in attempts to re-layout memory, and that should have been instead a straightforward bitblt operation.
So allow me to frame my request in very straightforward terms.
If there is a solution to the 8-bit parallel 8080 bus problem, what exactly has to be done to configure the I2S peripheral in order for it to output a stream of 8-bit packets of data, some of which can't be packed in pairs to form 16 bit words, with the eventual need to flip a GPIO that represents the Command/Data (RS) signal, with the bus sampled by strobing the WR (WS) signal, with a maximum clock defined as an integer divisor of the APB clock, with DMA enabled to offload the CPU during larger transfers (and let's ignore reading the bus just for the sake of making things easier), and possibly not necessitating a wasteful memory relayout procedure for large transfers?
A working port of ILI9341 connected via 8 bit parallel would be the perfect demonstration, since it's such a common shield, but I'm happily settling for a clear, focused and authoritative explanation of that needs to be done to make the I2S LCD mode work for any bus width.
Thanks in advance for any help!
Regards,
CG
Re: Driving an 8-bit parallel 8080 bus using I2S
Hi classicgentleman,
I understand your frustration. I have an ESP32 connected to an S6D1211 based LCD. I too have referred the links that you mention.
And, I am pretty much in the same situation.
I did connect my cheap but so far reliable logic analyser to my setup. And, this is my observation:
If the bytes being intended for the LCD are
A1 A2 B1 B2 C1 C2 D1 D2 ... (in internal memory when read with byte wise access)
the LCD receives it as A2 B1 C2 D1 .
This is what causes the banding and bars effect.
The lack of an official I2S 8bit DMA example is indeed frustrating when you want to talk to that type of peripheral especially with an 8080 type interface.
If there is any Espressif employee looking at this, I urge you to publish a concise example or atleast explain the exact steps.
This will help a large audience as many components use an 8bit parallel interface and not only LCDs.
Regards,
pixelhaze
I understand your frustration. I have an ESP32 connected to an S6D1211 based LCD. I too have referred the links that you mention.
And, I am pretty much in the same situation.
I did connect my cheap but so far reliable logic analyser to my setup. And, this is my observation:
If the bytes being intended for the LCD are
A1 A2 B1 B2 C1 C2 D1 D2 ... (in internal memory when read with byte wise access)
the LCD receives it as A2 B1 C2 D1 .
This is what causes the banding and bars effect.
The lack of an official I2S 8bit DMA example is indeed frustrating when you want to talk to that type of peripheral especially with an 8080 type interface.
If there is any Espressif employee looking at this, I urge you to publish a concise example or atleast explain the exact steps.
This will help a large audience as many components use an 8bit parallel interface and not only LCDs.
Regards,
pixelhaze
-
- Posts: 8
- Joined: Wed Nov 07, 2018 3:29 am
Re: Driving an 8-bit parallel 8080 bus using I2S
Hi,
You might be able to find working parameters in the Github issue. Or, wait for IDF 4.0 it seems!
You might be able to find working parameters in the Github issue. Or, wait for IDF 4.0 it seems!
-
- Posts: 8
- Joined: Wed Nov 07, 2018 3:29 am
Re: Driving an 8-bit parallel 8080 bus using I2S
Evening,
The remaining elephant in the room is how to drive the bus bidirectionally. Right now we can do either writes or reads; @espressif_staff, is there a way to use the I2S peripheral for the general purpose of a bidirectional parallel bus?
The remaining elephant in the room is how to drive the bus bidirectionally. Right now we can do either writes or reads; @espressif_staff, is there a way to use the I2S peripheral for the general purpose of a bidirectional parallel bus?
-
- Posts: 9772
- Joined: Thu Nov 26, 2015 4:08 am
Re: Driving an 8-bit parallel 8080 bus using I2S
Not directly. You can do it, but it'd mean manually reconfiguring the GPIOs from output to input and back every time you want to do a transaction.
Re: Driving an 8-bit parallel 8080 bus using I2S
Hi,
No espressif response about this question yet ?
I bought a ESP32-WROVER-B board and i want to connect a lcd display with 8 bit bus using dma for speed up.
I need to open a "doubt ticket" to espressif about this question ?
Where to open this "doubt ticket" ?
Thank's.
No espressif response about this question yet ?
I bought a ESP32-WROVER-B board and i want to connect a lcd display with 8 bit bus using dma for speed up.
I need to open a "doubt ticket" to espressif about this question ?
Where to open this "doubt ticket" ?
Thank's.
Re: Driving an 8-bit parallel 8080 bus using I2S
No one ????
-
- Posts: 166
- Joined: Wed Aug 01, 2018 12:06 pm
Re: Driving an 8-bit parallel 8080 bus using I2S
LCD1602 2004 20x4 LCD Display Adapter IIC//TWI/SPI/I2C Serial Interface Module Shield
https://smile.amazon.com/gp/product/B07 ... UTF8&psc=1. You might have to do some of your own code or the library might work. I use them to drive LCD's with a Arduino Due and a STM32 Bluepill.
https://smile.amazon.com/gp/product/B07 ... UTF8&psc=1. You might have to do some of your own code or the library might work. I use them to drive LCD's with a Arduino Due and a STM32 Bluepill.
-
- Posts: 8
- Joined: Wed Nov 07, 2018 3:29 am
Re: Driving an 8-bit parallel 8080 bus using I2S
As mentioned, you may find working parameters for your display here: https://github.com/espressif/esp-iot-solution/issues/19
A logic analyser helps a lot. Good luck!
Re: Driving an 8-bit parallel 8080 bus using I2S
I'm just hooking myself to auto updates to this thread as I have been in the same boat for a long time as well.
Who is online
Users browsing this forum: No registered users and 26 guests