Skip to content

How the data buffer is sent with EPDiy

Martin edited this page Aug 11, 2021 · 33 revisions

It is sent line-by-line from two DMA buffers, where one is filled again while the other is sent. The I2S peripheral operates in LCD mode that allows this parallel sending.

The I2S 'LCD Mode' basically means that pixel data can be sent straight from memory using the DMA controller. There is no real full documentation that explains step by step how to do this, but there is some example Firmware. The DMA controller allows for streaming sample data without requiring the CPU to copy each data sample.

In the current version is sent over a 8 data-lines bus, like we can see in i2s_data_bus.c

void i2s_bus_init(i2s_bus_config *cfg) {
  gpio_num_t I2S_GPIO_BUS[] = {cfg->data_6, cfg->data_7, cfg->data_4,
                               cfg->data_5, cfg->data_2, cfg->data_3,
                               cfg->data_0, cfg->data_1};
  // ... rest of initialization
}

This page will be dedicated to analyze if it's possible to initialize there a bus with 16 GPIOS and most important in what order that should be. Notice that the order in the I2S_GPIO_BUS array is not linear.

Key differences between I2S0 and I2S1 in ESP32

As we discovered in our first tests updating the I2S1 to I2S0 in all references on i2s_data_bus.c it does not work.

I2S0 does not have a true 8 bit mode. Even if you do only need 8 bits of bus-width the data samples provided in memory must still have a width of 16 bit. The upper 8 bits are simply ignored.

ISS1 on the other hand has a true 8 bit mode. Samples must not be extended to 16 bit.

Source TobleMiner/esp_i2s_parallel. That means that if we use the I2S0 on the ESP32 then we have to do the data sampling always in 16-bit in memory and the upper 8 bits part will be ignored. That will work if we would like to use I2S0 on ESP32-S2 but to try with existing EPDiy then it will take double space in the PSRAM.

To be continued...

Research questions

Q: Possible to use I2S to have a 16 bit data bus - Question in esp32 Forum

Answer: Yes is possible. But no hints about the ordering logic of the BUS Array.

Q: Would it be possible to make it with the existing EPDiy board ESP32 GPIOs or I should try to make an alternative version with ESP32-S2? With my null knowledge of KiCad that will be a one year enterprise but I would love to try it even if I know it will take many iterations to get it working. Or it will be better to stick with good old ESP32 and just find a way to drive this new breed of 16 data bus epapers?

Answer from vroland: You can have a look at the schematic, to see if you get 8 more output-capable pins freed up. If so, I'd stick with the ESP32 if you want the easier route. But getting more free pins may not be possible without significant compromise to performance. Further research: I don't find more than 2 output capable GPIOs free at the moment to allocate a bus that is 8 bits bigger. Unless I'm missing something, this won't be possible to do with existing EPDiy board, unless there is a way to use a shift register but that slow things down. Precisely when this eink displays have a 16 bits buffer since the amount of data to be sent is considerably bigger than on older epapers (Specially color Einks, that have 16x16x16 RGB possibilities per pixel - 4096 colors)

DES epaper technology

Q: About this new Goodisplay DES Technology, how do they can achieve 4096 color combination?

DES color eink Good display

Similar concept from eink.com that is called Kaleido (Ex. Hisense A5 mobile phone):

Eink Kaleido

Every pixel consist of a Red, Green and Blue color filter on the top of 3 eink cells per pixel, that have 16 levels of Gray: 4 bits per color. 16 bits per pixel. This eink cells are between the Color filter and the white background, so you can reduce what amount of light reflects on each color.

As an example, being 0 transparent and 16 full black (Also opaque to light)

Full white: R: 0 G: 0 B: 0 All epaper cells stay unactive, they let full light pass and reflect on the background.

Red  Green Blue
0000 0000  0000

All red : R: 0 G: 16 B: 16 Only Red light reflects, others are opaque, and do not reflect green/blue.

Red  Green Blue
0000 1111  1111

Black : R: 16 G: 16 B: 16 All 3 colors are turned off since the epaper in between turns black. You don't see full black as with the 2 color epaper, is kind of a very dark gray if you look with the microscope. But zooming out is black to the eye as I can see on my Hisense color epaper phone.

Yellow : R: 0 G: 0 B: 16 Only blue is suppressed, so we see only a strong mix of Red/Green.

All this is my theory after inspecting this with a microscope. Is still not completely clear how it's done since obviously if to make Red, you need to add two black cells to GB, then you will have kind of dark red. But it's not really like this, since the background is white, and you still will see red zooming out on the macro view.

Further research links

ESP-IDF peripherals: I2S on ESP32

I2S on the S2

I2S LCD Transmission mode: PDF tech specs

C Firmware example in RGB64x32MatrixPanel-I2S-DMA: Same principle as EPDiy

Clone this wiki locally