Hi,
I need to read a 4-bit parallel port device. The external device provides also the clock to the ESP32.
The bit rate is 1 Mbit/s and each data burst is made of 8192 bits
In idle, the clock signal is low. When transmitting, the clock signal goes high and low at 1 Mbit/s.
Is there any reliable I2S + DMA driver for reading a parallel port?
The interrupt must arrive only at the end of the burst and not every bit.
Thanks,
Enrico Migliore
ESP32 - 8-bit parallel port capture using I2S + DMA
Re: ESP32 - 8-bit parallel port capture using I2S + DMA
Enrico,
Fantastic ... this is an area that I just started working on last week to try and understand and write up in detail in my book of notes. I have just about got it working. What I did was take TWO ESP32s. One ESP32 clocks slows (1Hz) and increments an output 8 bit value on 8 GPIO pins plus the clock (PCLK). I then connected that to a second ESP32 as the DMA parallel receiver to act as a test harness.
I then used @igrr's esp32-cam-demo (see https://github.com/igrr/esp32-cam-demo) as a basis of what needs switched on and off. I must have spent about 20+ hours on it but just before bed last night I got a permutation where data was apparently retrieved. I am now going over all the settings one by one to understand how they work and what they mean. I'll be delighted to share anything and everything ... this is super complex stuff (opinion / subjective) and there are a world of permutations (I2S modes, LCD, Camera, FIFO, DMA, linked list descriptors, timers and flags everywhere).
Lets see if we can't use this thread to discuss our findings with each other and maybe see if others would also like to join to discuss.
I can be reached live on ESP32 channel on IRC as user "kolban".
Fantastic ... this is an area that I just started working on last week to try and understand and write up in detail in my book of notes. I have just about got it working. What I did was take TWO ESP32s. One ESP32 clocks slows (1Hz) and increments an output 8 bit value on 8 GPIO pins plus the clock (PCLK). I then connected that to a second ESP32 as the DMA parallel receiver to act as a test harness.
I then used @igrr's esp32-cam-demo (see https://github.com/igrr/esp32-cam-demo) as a basis of what needs switched on and off. I must have spent about 20+ hours on it but just before bed last night I got a permutation where data was apparently retrieved. I am now going over all the settings one by one to understand how they work and what they mean. I'll be delighted to share anything and everything ... this is super complex stuff (opinion / subjective) and there are a world of permutations (I2S modes, LCD, Camera, FIFO, DMA, linked list descriptors, timers and flags everywhere).
Lets see if we can't use this thread to discuss our findings with each other and maybe see if others would also like to join to discuss.
I can be reached live on ESP32 channel on IRC as user "kolban".
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: ESP32 - 8-bit parallel port capture using I2S + DMA
See also related threads:
https://esp32.com/viewtopic.php?f=13&t=5876 - Understanding the I2S_RX_TAKE_DATA_INT_RAW interrupt/flag/bit.
https://esp32.com/viewtopic.php?f=13&t=5877 - Restarting/resetting reading through DMA.
https://esp32.com/viewtopic.php?f=13&t=5876 - Understanding the I2S_RX_TAKE_DATA_INT_RAW interrupt/flag/bit.
https://esp32.com/viewtopic.php?f=13&t=5877 - Restarting/resetting reading through DMA.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: ESP32 - 8-bit parallel port capture using I2S + DMA
Dear Kolban,
we too started out from:
1. The CAM-DEMO examples
2. The source file i2s_stream.c which is gittable at https://gist.github.com/cnlohr/2b9f8a26 ... 4cff9d04fe
We've got something working right now.
We are not ready yet for sharing the code though because the code is still dirty.
It seems to us that the only way to read parallel data on an input port of the ESP32 is by programming the I2S as if an image was arriving from the external device.
At the moment, we successfully programmed the I2S to read a gray scale image of 64 pixels organized as: 1 row and 64 columns.
That 64-pixel image is our parallel data.
HARDWARE REQUIREMENTS FOR READING PARALLEL DATA
--------------------------------------------------------------------------
In order to have the I2S sampling parallel data I understood that:
1. The I2S needs a fixed high level value on the HREF pin
2. The I2S starts sampling on the rising or falling edge of the VSYNCH pin.
3. The I2S needs an external clock on the PCLK pin.
I don't know yet if the sampling is done on the rising or the falling edge of the clock. I'll figure it out.
All this means that the external transmitting device or some on-board glue logic will have to generate the VSYNCH and the PCLK.
Note that the parallel data can have a minimum of 1 bit and a maximum of 16 bits because the I2S is flexible.
SOFTWARE EXAMPLES
----------------------------
Example:
To read 128 bytes from an external parallel device, I might program the I2S as if an image of 128 x 1 pixels is entering the parallel port.
Example:
If I want to oversample 128 bytes by a factor of 8. That means that each data bit is sampled 8 times, I might program the I2S as if an image of 128 x 8 pixels is entering the parallel port.
Oversampling is needed for example if the data is Manchester encoded and I want to reconstruct the message after sampling the waveform.
Ciao,
Enrico Migliore
we too started out from:
1. The CAM-DEMO examples
2. The source file i2s_stream.c which is gittable at https://gist.github.com/cnlohr/2b9f8a26 ... 4cff9d04fe
We've got something working right now.
We are not ready yet for sharing the code though because the code is still dirty.
It seems to us that the only way to read parallel data on an input port of the ESP32 is by programming the I2S as if an image was arriving from the external device.
At the moment, we successfully programmed the I2S to read a gray scale image of 64 pixels organized as: 1 row and 64 columns.
That 64-pixel image is our parallel data.
HARDWARE REQUIREMENTS FOR READING PARALLEL DATA
--------------------------------------------------------------------------
In order to have the I2S sampling parallel data I understood that:
1. The I2S needs a fixed high level value on the HREF pin
2. The I2S starts sampling on the rising or falling edge of the VSYNCH pin.
3. The I2S needs an external clock on the PCLK pin.
I don't know yet if the sampling is done on the rising or the falling edge of the clock. I'll figure it out.
All this means that the external transmitting device or some on-board glue logic will have to generate the VSYNCH and the PCLK.
Note that the parallel data can have a minimum of 1 bit and a maximum of 16 bits because the I2S is flexible.
SOFTWARE EXAMPLES
----------------------------
Example:
To read 128 bytes from an external parallel device, I might program the I2S as if an image of 128 x 1 pixels is entering the parallel port.
Example:
If I want to oversample 128 bytes by a factor of 8. That means that each data bit is sampled 8 times, I might program the I2S as if an image of 128 x 8 pixels is entering the parallel port.
Oversampling is needed for example if the data is Manchester encoded and I want to reconstruct the message after sampling the waveform.
Ciao,
Enrico Migliore
Re: ESP32 - 8-bit parallel port capture using I2S + DMA
Hi,
I forgot to say in my very previous post that:
1. The I2S is assisted by the DMA. That means that there's no CPU intervention.
2. The I2S will generate a CPU interrupt only at the end of the data burst capture
Ciao,
Enrico Migliore
I forgot to say in my very previous post that:
1. The I2S is assisted by the DMA. That means that there's no CPU intervention.
2. The I2S will generate a CPU interrupt only at the end of the data burst capture
Ciao,
Enrico Migliore
Re: ESP32 - 8-bit parallel port capture using I2S + DMA
I know, I know,
ancient dead
5yo thread
But someone said
What's in my head
ESP32 parallel DMA
I need to find a better way
to import 4 bits at a time
or maybe find a better rhyme
I haz 6 i2s MICs
and don't wanna bitbang 'em; yikes!
ancient dead
5yo thread
But someone said
What's in my head
ESP32 parallel DMA
I need to find a better way
to import 4 bits at a time
or maybe find a better rhyme
I haz 6 i2s MICs
and don't wanna bitbang 'em; yikes!
Who is online
Users browsing this forum: No registered users and 69 guests