I2S confusion support for controller and/or peripheral operation #11675
-
Hi, I'm trying to get audio in on an ESP32S3 (ESP-IDF v4.4) through a PCM1808 ADC:
Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 18 replies
-
I took a quick look at the datasheet and it seems like this device should work with the machine.I2S class.
To extract 32-bit samples for L/R you'll need to iterate over the data that is read into the bytearray. Here is some untested code that might help. You'll need to add some additional code to test a condition to exit the while loop. The real micropython experts will likely have a better way to do this, but this is a start.
Does this help? |
Beta Was this translation helpful? Give feedback.
-
Sorry, not having used this device I'm struggling to offer other insights. Do you have access to an oscilloscope to verify the various inputs, like master clock, sck, and ws? I often consult the schematic of the evaluation board for ideas. Or, potentially purchase the evaluation board? |
Beta Was this translation helpful? Give feedback.
-
That may be possible. I like the idea that it does not require messing with the source code. I haven't done enough with PIO to know what problems may occur, in the integration. I am a total newby to PIO, but as I understand it, the IO pins are picked and the clock set at the same time the PIO is created. Can you provide any direction on how to make a separate PIO program run on a contiguous pin and in synchronism with the one created by the I2S micropython instance? Can you modify a PIO with a separate program in a way to create a new synchronous clock? If so, how? Thanks for the idea? |
Beta Was this translation helpful? Give feedback.
-
There is a blink example that would be a good starting point. |
Beta Was this translation helpful? Give feedback.
-
Sorry, I don't have an estimate. It's not trivial for sure. Is there a reason you need to use this particular ADC (or any ADC with a master clock)? If you switched to a INMP441 device you won't have these issues as it doesn't need a master clock. |
Beta Was this translation helpful? Give feedback.
-
Thanks @miketeachman. That is helpful. I need a good audio ADC as I am building an SDR receiver. In the past, I used a USB audio card connected to the host computer. With the ADC on the SDR board, it could be placed near the antenna, and the host could be anywhere connected via WIFI. These days, computers don't come with stereo audio inputs. Having the ADC on the SDR board is cheaper, and eliminates things that have to hang off the host computer, like the sound card. |
Beta Was this translation helpful? Give feedback.
I took a quick look at the datasheet and it seems like this device should work with the machine.I2S class.
To extract 32-bit samples for L/R you'll need to iterate over the data that is read into the bytearray. Here is some untested code that might help. You'll need to add some additional code to test a condition to exit the while loop. The real micropython experts will likely have a better way to do this, but this is a start.