Can't read I2S data from Cell Module to ESP32 in PCM slave mode

akmorrison
Posts: 1
Joined: Mon Mar 01, 2021 11:51 pm

Can't read I2S data from Cell Module to ESP32 in PCM slave mode

Postby akmorrison » Tue Mar 02, 2021 12:05 am

I'm trying to read PCM data from a SIMCOM SIM7500A cell module using an ESP32's i2s peripheral. Unfortunately, it seems like the i2s interrupt is never firing, and the call to `i2s_read` never terminates. The cell module datasheet says that the PCM interface "can be used in short sync master mode only, and only supports 16 bits linear format".

I'm using the following code to initialize and read from the i2s interface:
  1.     i2s_config_t cfg = {
  2.         .mode = I2S_MODE_SLAVE | I2S_MODE_RX,
  3.         .sample_rate = 2048*1000 / 16, // BCK is 2048kHz, 16 bits per sample
  4.         .bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT,
  5.         .channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
  6.         .communication_format = I2S_COMM_FORMAT_STAND_PCM_SHORT,
  7.         .intr_alloc_flags = 0,
  8.         .dma_buf_count = 8,
  9.         .dma_buf_len = 512,
  10.         .use_apll = false,
  11.         .tx_desc_auto_clear = false,
  12.     };
  13.     i2s_pin_config_t pin_cfg = {
  14.         .bck_io_num   = I2S_BICK_IO_CELL,
  15.         .ws_io_num    = I2S_LRCK_IO_CELL,
  16.         .data_out_num = -1,
  17.         .data_in_num  = I2S_STDI_IO_CELL,
  18.     };
  19.     esp_err_t err = i2s_driver_install(1, &cfg, 0, NULL);
  20.     if (err != ESP_OK) {
  21.         DEBUG_PRINTF("Failure to install i2s driver for cell modem, %s\n",
  22.                      esp_err_to_name(err));
  23.     }
  24.     err = i2s_set_pin(1, &pin_cfg);
  25.     if (err != ESP_OK) {
  26.         DEBUG_PRINTF("Failure to configure i2s GPIO for cell modem, %s\n",
  27.                      esp_err_to_name(err));
  28.     }
  29.     while(1) {
  30.         size_t bytes_read;
  31.         err = i2s_read(I2S_NUM_CELL, data, sizeof(data), &bytes_read, 100 / portTICK_PERIOD_MS);
  32.         if (err != ESP_OK) {
  33.             DEBUG_PRINTF("Failure to read i2s data, %s\n", esp_err_to_name(err));
  34.         }
  35.         printf("read %d bytes\n", bytes_read);
  36.     }
  37.  
This prints out the string "read 0 bytes" repeatedly.

I've attached a logic analyzer to the I2S pins and captured the i2s data (screenshots attached), it seems like the data is all correct, except that the data frames come pretty far apart (there are about 200 sample periods between each frame signal). This seems like valid PCM, but I'm not sure if it could be introducing any problems.

If anyone can see something I'm doing wrong, or has any ideas of what to try, please let me know. Thank you!
Attachments
i2s_single_sample.png
i2s_single_sample.png (50.62 KiB) Viewed 2772 times
i2s_intersamplepng.png
i2s_intersamplepng.png (53.96 KiB) Viewed 2772 times

uoosef
Posts: 3
Joined: Thu Nov 30, 2023 6:45 pm

Re: Can't read I2S data from Cell Module to ESP32 in PCM slave mode

Postby uoosef » Thu Nov 30, 2023 6:54 pm

hey man, i have the same exact problem with quectel m66 pcm audio connecting it to esp32 i2s pripheral, had you any luck with this?

im planning to use TI lm49370 pcm- i2s bridge, but i rather not! because it doesn't come by easily where i live and it adds to product's price.
if you can help please let me know.

Who is online

Users browsing this forum: Google [Bot] and 111 guests