Skip to content

How the data buffer is sent with EPDiy

Martin edited this page Aug 15, 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.

I2S1 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.

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)

Further research links

ESP-IDF peripherals on Espressif web: I2S on ESP32

ESP32 Technical reference: I2S section 6.6, page 120 Also important to read section 12 I2S Controller, page 306.

I2S on the S2

I2S LCD Transmission mode: PDF tech specs

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

LCD with I2S 8 bit parallel very interesting project to research. Pioneers to do this!