CYBLE-416045-02 BLE FreeRTOS

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Max
Level 2
Level 2
5 questions asked 10 sign-ins 5 replies posted

Hello everyone,

I work on a project on CYBLE-416045-02 module. I have start with demo project to use BLE. For this moment all woked great. 

i have create a new task which print a message every 10 secondes.

I program my module all work great, all task initialized, Ble advertisement OK and my new task work great with a message every 10s.

At this moment, activate advertisement and i connect my module and my smartphone application.

After connexion succesfull, all continue to work great.

After this test, i quit my smartphone application and at this moment my new task print none message and i don't see any disconnect message on my console.

Max_0-1645202138946.png

Do you have any advice or idea about this problem ?

Thanks,

Best regards,

Max

0 Likes
1 Solution
Max
Level 2
Level 2
5 questions asked 10 sign-ins 5 replies posted

Hello everyone, 

I have found the problem,

void static DisconnectEventHandler(void)
{
    /* Variable used to store the return values of RTOS APIs */
    BaseType_t rtosApiResult;
    
    requestHtsIndication = false;
  
    /* Turn off the Orange LED and blink the Red LED once to 
       indicate disconnection*/
    status_led_data_t statusLedData = 
    {
       .orangeLed = LED_TURN_OFF,
       .redLed    = LED_BLINK_ONCE
    };
    
    /* Turn off the Orange LED and blink the Red LED once to 
       indicate disconnection*/
    rtosApiResult = xQueueSend(statusLedDataQ, &statusLedData,0u);
    if(rtosApiResult != pdTRUE)
    {
        Task_DebugPrintf("Failure! : BLE - Sending data to Status LED queue",
                          0u);   
    }

    /* Request Temperature Task not to send any data */
   // notification_command_t notificationCommand = RESET;
    //xQueueOverwrite(notificationMessageQ, &notificationCommand);
    notification_message_t notificationMessage;
    notificationMessage.command = RESET;
    xQueueReset(notificationMessageQ);                              //reset queue to initial state empty
    xQueueSend(notificationMessageQ, &notificationMessage,0u);      //sendMessage
    
}

You can see in comment the 2 precedentes lines and below the 4 new lines.

The main problem come from xQueueOverwrite which work with only a 1 length queue. After different tests, i saw when i set my queue for notificationMessageQ to 1 my disconnexion worked. So i change my xQueueOverwrite to XQueueSend and i added a xQueueReset to be sure that the only element on my queue was Reset.

View solution in original post

0 Likes
3 Replies
Max
Level 2
Level 2
5 questions asked 10 sign-ins 5 replies posted

Hi,

To complete my informations, i have used CySmart to test disconnect. And i have the same problem. After a click on Disconnect, my module freeze, no message print and no new advertisment available.

Max

0 Likes
PratikshaV
Moderator
Moderator
Moderator
100 solutions authored 5 likes given 250 sign-ins

Hi @Max 

Please can you share the Air logs and your project so that  we can understand the issue better.

If using Modustoolbox you can refer below code example :

https://github.com/Infineon/mtb-example-psoc6-ble-battery-level-freertos

 

Thanks & Regards

Pratiksha V

0 Likes
Max
Level 2
Level 2
5 questions asked 10 sign-ins 5 replies posted

Hello everyone, 

I have found the problem,

void static DisconnectEventHandler(void)
{
    /* Variable used to store the return values of RTOS APIs */
    BaseType_t rtosApiResult;
    
    requestHtsIndication = false;
  
    /* Turn off the Orange LED and blink the Red LED once to 
       indicate disconnection*/
    status_led_data_t statusLedData = 
    {
       .orangeLed = LED_TURN_OFF,
       .redLed    = LED_BLINK_ONCE
    };
    
    /* Turn off the Orange LED and blink the Red LED once to 
       indicate disconnection*/
    rtosApiResult = xQueueSend(statusLedDataQ, &statusLedData,0u);
    if(rtosApiResult != pdTRUE)
    {
        Task_DebugPrintf("Failure! : BLE - Sending data to Status LED queue",
                          0u);   
    }

    /* Request Temperature Task not to send any data */
   // notification_command_t notificationCommand = RESET;
    //xQueueOverwrite(notificationMessageQ, &notificationCommand);
    notification_message_t notificationMessage;
    notificationMessage.command = RESET;
    xQueueReset(notificationMessageQ);                              //reset queue to initial state empty
    xQueueSend(notificationMessageQ, &notificationMessage,0u);      //sendMessage
    
}

You can see in comment the 2 precedentes lines and below the 4 new lines.

The main problem come from xQueueOverwrite which work with only a 1 length queue. After different tests, i saw when i set my queue for notificationMessageQ to 1 my disconnexion worked. So i change my xQueueOverwrite to XQueueSend and i added a xQueueReset to be sure that the only element on my queue was Reset.

0 Likes