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.

RTOS/CC1312R: CC13x2 API RF_close() issue

Part Number: CC1312R

Tool/software: TI-RTOS

The original thread https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz/f/156/p/808224/2991155#2991155 is locked, so I create a new one to get more information about the same issue, that is, why function call RF_flushCmd(rfHandle, RF_CMDHANDLE_FLUSH_ALL, 0)  is required before calling function RF_close(rfHandle)? Please give more details about the mechanism that cause unexpected thread hang up inside of RF_close(rfHandle) if RF_flushCmd(rfHandle, RF_CMDHANDLE_FLUSH_ALL, 0) is not invoked before that.

  • Hello,

    You must call RF_flushCmd and ensure all commands have either been executed or cancelled before destroying the client because the rfHandle is shared with the radio core. So if the radio core goes to execute a queued up command but the rfHandle it is using isn't there anymore, you may run into issues with memory corruption.  

    Thanks,

    Alexis

  • Hi Alexis,

    Thanks for your reply.

    Regarding to the statement of "RF_flushCmd() as prerequisite of RF_close()", is it documented in any manual or specification?

    I have also checked the implementation of RF_close(),  it actually calls RF_pendCmd() to ensure pending commands to be properly handled before destroying the RF handle, so my 2nd question is why this mechanism doesn't behave as expected, instead of relying on explicitly flushing all pending commands?

    Regards,

    Dong Bin 

  • Hi Dong,

    I apologize for the delay. I'm currently trying to work with the engineers who wrote the RF driver in order to get a clearer answer for you. I appreciate your patience.

    Thanks,

    Alexis

  • Hi Dong,

    Sorry for the confusion. To be clear,  the only case you would have to call RF_flushCmd() before RF_close() is if there is a continuous RX. 

    As has been pointed out in this issue the RF_close() calls the RF_pendCmd() which will wait for all commands to be finished. In this case however one of the commands is a continuous RX command which will never finish. Due to this continuous-type of command you will have to terminate it before calling RF_close(). The command is terminated by calling RF_flushCmd().

    Hope this clears things up.

    Thanks,

    Alexis