Some doubts about the use of dma in esp32-web-camera

wulin76
Posts: 7
Joined: Mon Jan 23, 2023 7:39 am

Some doubts about the use of dma in esp32-web-camera

Postby wulin76 » Wed Jan 25, 2023 1:53 pm

Reading the code in the dma section of the esp32-web-camera project (ll_cam.c), I found that esp32, esp32s2, esp32s3 have major differences in dma, I don't understand what are the reasons for these differences?

1. esp32 defines multiple sampling modes, i2s_sampling_mode_t, what do these modes mean? Why do they not appear in esp32s2 and esp32s3?

2. xclk_freq_hz, for esp32, is handled differently depending on whether it is greater than 10000000, while esp32s2, esp32s3 is not?

3.I2S0 How is this global variable set to implement the dma function? What is the purpose of setting the parameter to 1 and then immediately setting it to 0?

Just entered the esp32 field, for some concepts may not be familiar, so may be a lot of questions, rather superficial, please forgive me.


Translated with www.DeepL.com/Translator (free version)

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

Re: Some doubts about the use of dma in esp32-web-camera

Postby ESP_Sprite » Wed Jan 25, 2023 2:09 pm

If anything, one difference is that the ESP32 and ESP32S2 have camera functionality in the I2S module, while the ESP32S3 has a standalone LCD/camera interface for this. Also note that I2S0 isn't a conventional variable as it doesn't reside in RAM; instead it points directly at the I2S register space. In other words: changing a member of I2S0 directly writes to a register in the I2S peripheral.

wulin76
Posts: 7
Joined: Mon Jan 23, 2023 7:39 am

Re: Some doubts about the use of dma in esp32-web-camera

Postby wulin76 » Fri Jan 27, 2023 6:44 am

Thank you very much, I have checked the technical reference manual and the sample code to understand the usage of I2S in the sample.

1. I2S0 in the example is working in camera slave receiver mode.
2. If I2S wants to reset the module, you need to set the corresponding pin to 1 and then to 0.
3. For ESP32S2 and ESP32S3 in camera receive mode, support for 8 to 16 bit parallel input mode, ESP32 should only support 16 bit parallel input, resulting in ll_cam_memcpy function in different chips in the processing differences.


I am still confused about the enumeration type i2s_sampling_mode_t in the sample code, I don't quite understand the meaning of this enumeration value.
  1. typedef enum {
  2.     /* camera sends byte sequence: s1, s2, s3, s4, ...
  3.      * fifo receives: 00 s1 00 s2, 00 s2 00 s3, 00 s3 00 s4, ...
  4.      */
  5.     SM_0A0B_0B0C = 0,
  6.     /* camera sends byte sequence: s1, s2, s3, s4, ...
  7.      * fifo receives: 00 s1 00 s2, 00 s3 00 s4, ...
  8.      */
  9.     SM_0A0B_0C0D = 1,
  10.     /* camera sends byte sequence: s1, s2, s3, s4, ...
  11.      * fifo receives: 00 s1 00 00, 00 s2 00 00, 00 s3 00 00, ...
  12.      */
  13.     SM_0A00_0B00 = 3,
  14. } i2s_sampling_mode_t;
It seems that the above sampling mode is only defined for ESP32, but not for ESP32S2,ESP32S3, and that the sampling mode and the camera's XCLK should be related.

Who is online

Users browsing this forum: No registered users and 114 guests