BLE store bonding data problem

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi there!

I'm using a CYBLE-222005-00 module, with security configuration for bonding with JustWorks since my device has NoInput/NoOuput (see attachement). However, the saving of the bonding data does not seem to work. After a wake-up from hibernate, I cannot re-connect with the previously bonded Smartphone getting a CYBLE_EVT_GAP_AUTH_FAILED event from the BLE stack.

Here is what I do in he code:

On the callback event CYBLE_EVT_GAP_AUTH_COMPLETE I call

while(CYBLE_ERROR_OK != CyBle_StoreBondingData(0));

and later I get the event CYBLE_EVT_PENDING_FLASH_WRITE where I do nothing in the code. This event seems to be triggered even when I don't call the CyBle_StoreBondingData() method before...

Is there a way to check, if the bonding data is stored correctly in the flash or am I missing some other things?

Thanks for your help!

0 Likes
1 Solution
Anonymous
Not applicable

Problem was, that I was calling the CyBle_StoreBondingData at the wrong place in the code (in the callback handler of the BLE stack). Now I added the following lines to my main routine and it works! 🙂

if((cyBle_pendingFlashWrite != 0u) && (CyBle_GetState() == CYBLE_STATE_CONNECTED))

    {

        CYBLE_API_RESULT_T apiResult;

    

        apiResult = CyBle_StoreBondingData(0u);

        (void)apiResult;

        printf("Store bonding data, status: %x \r\n", apiResult);

    }

View solution in original post

0 Likes
2 Replies
Anonymous
Not applicable

Problem was, that I was calling the CyBle_StoreBondingData at the wrong place in the code (in the callback handler of the BLE stack). Now I added the following lines to my main routine and it works! 🙂

if((cyBle_pendingFlashWrite != 0u) && (CyBle_GetState() == CYBLE_STATE_CONNECTED))

    {

        CYBLE_API_RESULT_T apiResult;

    

        apiResult = CyBle_StoreBondingData(0u);

        (void)apiResult;

        printf("Store bonding data, status: %x \r\n", apiResult);

    }

0 Likes
Anonymous
Not applicable

Yeah; Calling flash write routines during an interrupt handler is probably not the best idea

Possibly it could be caused by not calling the CyBle_ProcessEvents() between calls to the CyBle_StoreBondingData(0u) function, but idk for sure.

0 Likes