This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Device disconnecting while processing analog

Hi all,

I am working on an application related with voice recording. What problem i am facing is device gets disconnected when i am recording message.If peripheral doesn't send and packet in MAX interval(4sec) then its obvious that its going to disconnect. For recording i am using for loop to store in flash using SPI which will last for 30sec. While recording i am disabling all interrupts so that to not affect the voice quality. After it disconnects from the central device, i am facing problem to reconnect.

What i want is if there is any intermediate way to avoid disconnecting and in stead it should remain in connected state while recording without affecting the voice quality my voice is recorded@8kBytes/sec. Is it possible to send connection data intermediate while recording so that it doesn't loose connection? If so how can i implement it? If not possible i will have to do the same rescanning and reconnecting technique after i have done my analog processing fully

thanks

  • Hi,

    You can't have connection events without interrupts for the RF core + time for the LL task to set up the radio for the next event. This should take ~1ms every connection event.

    This probably shouldn't be a problem, but it's difficult to achieve when you are basing the processing on a loop. You could use DMA for the SPI and do processing in the DMA interrupts, possibly.

    If this is not possible for you, then you will have to let the connection drop and reconnect later.

    Best regards,
    Aslak
  • Hi Aslak,
    Thank for your reply. I am not much aware about DMA. Do you mean to say if i read external flash using DMA for SPI then i will be able to do my recording process and this will not disconnect the central device also? If so then i can try that. Can you please confirm? If not then i don't have choice other than to reconnect after disconnection.
  • Hi,

    Well, I'm not sure what you are doing - I supposed you were using SPI to read audio, but however you do you thing it could be possible to use DMA to copy in the data in a buffer and DMA to write to external flash using SPI. Please see the HAL SPI driver which uses DMA for some pointers on how to set up the DMA. You can also read in the Users Guide in the DMA chapter.

    If you are able to use DMA, then you can let that module read in block by block and do processing at the end of each block. It is more complicated than a loop, however.

    BR,
    Aslak
  • Ya, your assumption was correct. I am reading and writing audio to external flash using SPI. I am running out of time as i need to finish my project within next week. So i can't experiment with new thing now which may be complicated. I will find some way to reconnect with central device after connection is dropped.
    However as per your suggestion i would be implementing DMA for reading and writing flash the next time i have finished my current process.
    Thanks for your suggestion