This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Why there is no call back after calling pstorage_clear?

Hello,

I am testing the sample project under \nrf6310\s310\ble_ant_app_hrm.

I just made one modification to bond_manager_init function in main.c: static void bond_manager_init(void) { uint32_t err_code; ble_bondmngr_init_t bond_init_data; bool bonds_delete;

bonds_delete = true;	//***force to clear any bonding information***

..... }

Then I set 2 breakpoints in ble_bondmngr.c and run the program.

BP1: uint32_t ble_bondmngr_init(ble_bondmngr_init_t * p_init) { ... // Erase all stored centrals if specified. if (m_bondmngr_config.bonds_delete) { err_code = flash_pages_erase(); //BP1 if (err_code != NRF_SUCCESS) { return err_code; } ...

BP2: static void bm_pstorage_cb_handler(pstorage_handle_t * handle, uint8_t op_code, uint32_t result, uint8_t * p_data, uint32_t data_len) { if (result != NRF_SUCCESS) //BP2 { m_bondmngr_config.error_handler(result); } }

I found that the program broke at bp1, but not bp2, is that normal?

I also tried to step through each line in the flash_pages_erase function and did not find any problem. static uint32_t flash_pages_erase(void) { uint32_t err_code;

err_code = pstorage_clear(&mp_flash_bond_info, MAX_BONDS_IN_FLASH);

if (err_code == NRF_SUCCESS)
{
    err_code = pstorage_clear(&mp_flash_sys_attr, MAX_BONDS_IN_FLASH);
}

return err_code;

}

When the program is in free run mode, I can detect the advertising signals from the test unit, so I am sure the softdevice is working correctly. Please advise.

Thank you! Joseph

Related