PSoC4-BLE-SFLASH-Update.exe will perform Erase All target flash. Please perform SFlash update first and program the project hex file.
1. Based on your comment, I use PSoC4-BLE-SFLASH-Update.exe to write the row 0 as follow "02 00 00 B0 07 00 00".
2. And then use PSOC Creator re-program the hex file into the chip again.
3. And run the debugger with the following code:
static CYBLE_GAP_BD_ADDR_T local_bdAddr;
static CYBLE_API_RESULT_T ret;
local_bdAddr.type = 0;
ret = CyBle_GetDeviceAddress(&local_bdAddr);
After step through CyBle_GetDeviceAddress, I get the return code and the structure as the followings:
ret <--- CYBLE_ERROR_OK
But the local_bdAddr <--- 0x80 0x95 0x19 0x29 0x49 0x80
(It ise garbage, I expect it should be "0x02 0x00 0x00 0xB0 0x07 0x00"
If non-zero value is programmed into the row 0 of user SFLASH, the BLE component will take the first 6 bytes as BLE device address. This procedure happens after the event CYBLE_EVT_STACK_ON in CyBle_EventHandler function (BLE_eventHandler.c). So, please call CyBle_ProcessEvents() atleast once before CyBle_GetDeviceAddress(&local_bdAddr)
It is working great! Thanks for your support!