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.

Avoid disconnecting while processing loop cc2541

Other Parts Discussed in Thread: CC2541

Hi everyone,

I need to record voice for around 30sec in my application and for this i have used "for" loop. I want to maintain connection while recording so that device doesn't get disconnected and my peripheral will be able to communicate with the central device during this process.

For this, i have planned that i will be sending some data in between of my recording process(i know its going to affect the voice quality badly but i have no other option) so that my peripheral doesn't loose connection. For implementing this, i am writing to characteristic while recording but then also my device is disconnecting.

Can anyone please suggest me what should i do to retain the connection while recording? I have not disabled interrupt. My min and max time are set as 1sec

  • You can't block BLE stack that long. I would suggest you to use a periodic event to do your voice recording.
  • Hi Yikai,
    Thanks a lot for your suggestion.
    I would like to share my bad and good experience which may help others in this forum. I apologize as its going to be long post.

    As my application is related with voice transfer so i was worried if i do some other process while recording then its going to affect the voice quality and this was the reason i was using long for loop and didn't want to disturb my recording process in between by some external event. As CC2541 implements single thread mechanism, so it was adding my worries how to retain connection.

    Now I have found solution to my disconnection problem similar to what you have suggested. For every 8-10 page of writing to flash, i have stopped my recording process and giving 25ms gap for the next flash page writing where it had stopped last. So during this 25ms gap, other osal events for GAP process are processed so that peripheral doesn't loose connection at all and connection with central is maintained.
    Although i didn't check the voice quality yet but i have checked connection, my peripheral is not disconnecting while recording. I don't think this 25ms gap should diminish the voice quality badly because for every sec of voice recording data recorded is 8Kbytes but only concern would be i will be loosing 25ms of voice for each 8-10 page writing.

    TI,
    Although i know its not good to mention these but as a developer i have some feeling which i would like to share.
    I appreciate everyone on e2e forum for their help to others. I thank everyone for their support. I know TI community is so large and it receives huge bundle of questions from all over the world and its not possible to answer each post in time. I also agree that similar questions have already been answered in the forum and we should search for it before posting but then also i think TI should enhance their mechanism to answer to the doubts community members have because in comparison TI products are also used world wide on huge basis. If one's project is successful then in turn TI is going to be benefited. So many times some posts are either not answered or we have to wait for 2-3 days or even more for a single doubt. I don't think its good for a developer or hobbyist to wait this much time. This reduces our enthusiasm to proceed further. I would like request TI to enhance their documentation as well as search mechanism for the similar answered post as its somewhat difficult to find it.
    Sorry for mentioning but its just my thought as a developer.