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.

CC2745R10-Q1: Displaying RSSI within the connection event callback function

Part Number: CC2745R10-Q1

Based on the sample software "basic_ble" from the CC2745 SDK (ver.9.12), I am displaying the RSSI within the connection event callback function, but at some point, the display update stops. The time is about 96 seconds.

 

What countermeasures can be considered for this phenomenon?
The implementation is as follows. I apologize for not being able to post the main code.

  • In the function "Connection_ConnEventHandler" in app_connection.c, within the case statement BLEAPPUTIL_LINK_ESTABLISHED_EVENT, the callback registration function "Gap_RegisterConnEvtCb" is used to register the callback function.
  • After that, the registered callback function uses the argument Gap_ConnEventRpt_t *pReport to display the RSSI with the MenuModule_printf function.

 

Thank you in advance.

 

  • Hello Yamanaka-san, 

    Are you doing the RSSI processing and/or displaying the RSSI data from the callback function? As mentioned in the previous thread, you should use BLEAppUtil_InvokeFunction() to add a function to the queue. 

    You can create a function which uses the pReport as an input. Then you will process the RSSI data and display the data from this function. Processing and displaying from the callback will block other processes from completing, and within the BLE context, this can lead to the connection failing. BLEAppUtil_invokeFunction allows for you to queue the function so the code is not blocking other important BLE functionalities from occurring on time. 

    Let me know if this helps. 

    Thanks,

    Isaac

  • Hello, 

    Thank you for your reply.


    The processing in the question is done within a callback function, and we have not used the "BLEAppUtil_InvokeFunction" you mentioned.

    We would like to try implementing it using "BLEAppUtil_InvokeFunction," but which function is used to dequeue the items stored in the queue by this function?

    We apologize for the repeated questions and appreciate your assistance.

  • Hello Yamanaka-san, 

    Can you explain why you would like to dequeue from the queue? 

    I will look into dequeuing from the queue. 

    Thanks,

    Isaac

  • Hello,

    I apologize for my lack of understanding, but this is how I think about it. Please point out if I am wrong.

    (1) Register the connection event callback with "BLEAppUtil_InvokeFunction"

    (2) When the connection event occurs, the registered callback function is called

    (3) In the callback function, queue a message that includes information such as the RSSI obtained from the connection event

    (4) In the task processing, check if there are messages in the queue, and if so, execute the processing

    I thought that dequeuing would be necessary in step (4) above, which is why I asked about the method of dequeuing.

    Best regards.

  • Hello Yamanaka-san, 

    BLEAppUtil_invokeFunction will add the function to the queue. This is beneficial, as the processing for the function will be completed when there is time to do so. If you complete your processing within the callback context, the software is stuck in the callback until the processing is completed. Thus, you may run into problems with the BLE connection failing, or other tasks in the software being starved as the you are stuck processing in the callback. 

    Using BLEAppUtil_InvokeFunction will add the function to the queue, and there will be no need to dequeue. After the function has executed, the function will not be queued again unless you/the software queues the function again with BLEAppUtil_invokeFunction. 

    Let me know if this helps. 

    Thanks,

    Isaac

  • Hi,

    I see, understood. That was very helpful.

    Best regards.