I am working with KW36 module for my BLE project. I have enabled the Pairing and Bonding to connect with mobile device using authentication. I have also enabled the NVM functionality to store BLE device information to NVM memory.
As per my requirement, I want to store only one BLE device information to NVM memory. So for another BLE device, first I have to remove the information of first BLE device and then store the second BLE device information.
I am using example code: frdmkw36_wireless_examples_bluetooth_w_uart_bm
Below are steps that I am following:
1. Turn on KW36 module in Peripheral mode.
2. Connect first mobile device with KW36 module. Device information will be store in NVM.
3. By sending command on UART via NXP IOT application, I am disconnecting the mobile device and removing the bond. Also erasing the first mobile device information.
4. After this I try to pair and bond with second device.
After following above steps, module does not stores the Second device information to NVM. Module gives Hard Fault error and enter into infinite loop.
Code flow for second mobile pairing and bonding as below:
1. First disconnected the first mobile device using Gap_Disconnect() function.
2. Removed the bonding of first mobile device using Gap_RemoveBond(uint8_t nvmIndex) function.
3. Erased data from Flash sector 0x7B800 to 0x7F7FF using "NV_FlashEraseSector()" function.
4. Program the Flash sector from 0x7B800 to 0x7F7FF as per initialization process.
But, still not able to store the second device information.
I am only able to pair, bond and store information to NVM of Second device after restart the KW36 module.
Please guide how can I store the second device information without restart the module?