I'm using the nrf52832 and I need to stream audio from an SPI connected memory chip, to an I2S connected amplifier. Is there a way I can have the SPI device stream data directly to the I2S device, without having to manually double buffer it?
I'm using the nrf52832 and I need to stream audio from an SPI connected memory chip, to an I2S connected amplifier. Is there a way I can have the SPI device stream data directly to the I2S device, without having to manually double buffer it?
No there isn't - you'll have to DMA it into memory and DMA it out again.
No there isn't - you'll have to DMA it into memory and DMA it out again.
Thank you for the reply. Is it possible to create an event so that when one DMA transfer completes it triggers another? i.e. as soon as the I2S finishes transferring one buffer, it triggers the SPI DMA routine to fill another buffer?
Hi,
I suppose you can use PPI and hook the I2S->EVENTS_TXPTRUPD event to the SPIM->TASKS_START task. For what it is worth you can also do it the other way around; hook the SPIM->EVENTS_ENDRX event to the I2S->TASKS_START task.
It is also possible to read data from SPI and and transmit data on I2S concurrently. Please refer to the EasyDMA documentation.
But no matter how you do it you will have to update the pointers to the RAM buffers using interrupts. I.e. you can't read data from SPI and transmit them to I2S autonomously for all eternity without bothering the CPU every once in a while, but you can substantially offload the CPU with EasyDMA.
Thank you very much for the reply, PPI sounds ideal, I'll dig into that more if double buffering doesn't pan out (I've already got most of a double buffering solution I think). I've got EasyDMA working for SPI to RAM, and RAM to I2S, so now I just need to make that happen concurrently. Also I'm trying to find a work around for the SPIM 256 byte transfer limit, and I think the SPI array list is the solution, I just need to figure out how to make it work. :)
If the 256 limit is critical for you you could have a look at the nRF52840. The 840 has a 16 bit byte counter where the 832 only has 8 bit.
Thank you very much for the info, I will remember that going forward! For this project the hardware is already set unfortunately.