Thanks for the info on I2S on bela, @giuliomoro and @minovski !
I would like to connect a bluetooth module to a bela mini to stream 2 channel audio (or, perhaps, also stream a microphone signal back in a headset mode while receiving a monaural audio stream). The I2S protocol appears to be best-suited for that. But getting this to work looks a little complicated to me.
If I understand correctly, the MPU's McASP units can be configured to the I2S protocol, but the available pins on the pocketbeagle only allow for use of McASP0 (and a few McASP1 pins). Now some of these pins are already required for the bela cape.
Hence, receiving an I2S signal could still be possible via these pins:
- P2.04 (mode 6, McASP_AXR)
- P2.08 (mode 6, McASP_ACLKR)
- P2.06 (McASP_FSX)
However, transmitting a signal back is not possible, since pin P1.36 (McASP_ACLKX) is already occupied by the bela cape (although pins P2.06 (McASP_FSX) and P2.02 (McASP_AXR) are available).
So this is where minovski 's solution could come in, implementing the I2S protocol via the bela mini's second PRU. However, the code references several hex addresses for pins, which are a bit hard to decipher. That makes adapting this from the bela to the bela mini a bit difficult for me. Could I just enter the addresses for any pin connected to PRU1 there in pru_gpio.p (i.e., P1.02, P1.04, P1.30, P1.32, P1.35 and P2.11, P2.31, P2.35)?
Many of these pins are used for digital IO on the bela mini, but can be reconfigured via the pinmux, I read.
Is all this correct? Is there a better way to integrate a bluetooth connection?
Would it then be possible to read the I2S input via the audioIn function or would I have to implement another function for this purpose?