Can I2S be used so the RP2040 is slave? #1897
-
With the present I2S implementation, I get a sample rate of 48.047 kHz when I want 48 kHz. I have a clock that is accurate to within 10ppm at 12.288 MHz (100x more accurate and 256 times 48 kHz) easily available and I am planning to send this I2S data to another computer where it will be processed and output with a 48 kHz sample rate in real-time on the second computer's sound card. I am worried that the mismatch in sample rates will mess up my DSP. I know I can discard samples or some other fancier ways of trying to match sample rates, but it would be much better if I didn't have to as often. If it was possible to use my accurate clock and let the Pico be in I2S slave mode as opposed to master, I think this would be better for my application. The ADC I'm using is the PCM1808. Can we use the Pico in slave mode with I2S? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Nope, no slave support. There is, sadly, no HW support for clocking the PIOs directly from external pins. You could theoretically rewrite the I2S.pio code to do so by polling and looping on the clock pin for every bit in or out, but you would need to be very careful about setup and hold timing (and making sure it still fits in the PIO memory, of course!) vs. the internal PIO clock frequency. You might be able to clock the whole Pico off of your 12.88MHz source, though, (through its pll), and making sure you have integer dividers to keep things nice and neat. That's a HW mod and not something I could really be of much help with. |
Beta Was this translation helpful? Give feedback.
Nope, no slave support. There is, sadly, no HW support for clocking the PIOs directly from external pins. You could theoretically rewrite the I2S.pio code to do so by polling and looping on the clock pin for every bit in or out, but you would need to be very careful about setup and hold timing (and making sure it still fits in the PIO memory, of course!) vs. the internal PIO clock frequency.
You might be able to clock the whole Pico off of your 12.88MHz source, though, (through its pll), and making sure you have integer dividers to keep things nice and neat. That's a HW mod and not something I could really be of much help with.