Hi Ytai,
OK - I got this to work (read back the correct data anyway - it was a clock polarity, and data alignment issue), but I have a bit of a unique situation I was hoping you may be able to help with. What I am trying to do is get audio data out of a microcontroller connected to the IOIO (16-bit, 8KHz). I only have the following interfaces on my micro:
SPI (master mode only)
PCM/I2S (stereo audio channel)
UART (kind of inconvenient for me as it isn't wired on the PCB)
I would love to use SPI, but I can't because my device is master mode only, and the IOIO is master mode only. PCM is almost the same as SPI, except it is a stereo channel, and I already have code that works for my device. If you connect it to an SPI port on the IOIO, and use the chip select (SS) as the frame/channel signal, it actually works. And this is what I am doing. However, the problem is I need to read 2 bytes (a 16-bit audio sample) while the chip select is low, then read 2 bytes from another "dummy" slave so my chip select (acting as the frame signal) goes high for the other audio channel. This allows me to talk to my micro and I actually get the right data, but it is far too slow. The overhead to switch slaves is about 0.8 to 1 ms. Since I need to read out two audio samples essentially every 0.125 ms, I'm about 16x too slow. Cranking the SPI clock does not help because the overhead between SPI reads is constant.
Now, I can put my device in PCM master mode where it accepts the clock from the IOIO but it drives the frame signal (which the IOIO can conveniently ignore if I don't MUX it to anything), and then I can increase the bandwidth by a quite a bit, but I still get significant dropouts in between the 64 byte SPI transactions, and the PCM interface being synchronous, well it is just not going to work.
I may be able to sort out some sort of bursted PCM transfer, but I am wondering:
- Is there any plan to support SPI slave mode on the IOIO?
- If not, can the UART go faster than 115200? That bitrate is still less than I would need to stream the audio data.
Any other clever ideas would be appreciated.
Thanks in advance,
Mark.