hi Dialog
if my code stored in QSPI flash, but I writed a BD address in OTP ROM by PLT, how to make ble stack use BD address in OTP ROM instead of the one in NVMS or defaultBLE_STATIC_ADDRESS? Moreover, how to read the BD address from OTP ROM? Is there any example code anout this case?
thanks
Nigel
Device:
Hi Nigel,
The BD Address in placed in specific address (0x07F8EA58) in the OPT header. Please try to read the OPT Header with the OTP tool from the SmartSnippets toolbox. In order to read the BD Address from the OTP Header you should follow the procedure below:
1. Add the LLD (low level drivers) of the OTP controller
2. Add the function which reads from the OTP memory, named read_bd_address_from_otp(). The source code is below:
3. Retrieve the BD address from the OTP memory
Thanks, PM_Dialog
hi Dialog,
My test based on your function seems not work for DA14681. Can you tell me why "cell_offset" is 0x1D4B ? and what is the relation with 0x07F8EA58 (BD address in OTP) ? I am curious that "physical_otp_address = hw_otpc_cell_to_mem(otp_cell_offset)", however, physical_otp_address = 0x7F80000 + (cell_offset << 3) in hw_otpc_cell_to_mem( ). It will not be 0x07F8EA58.
thanks
Nigel
Hi nigelyang,
param [in] otp_cell_offset :The offset of the OTP cell. The formula to calculate the physical memory address is (0x7F80000 + (otp_cell_offset << 3)). E.g. the offset 0x1D4B corresponds to 0x7F8EA58 physical address (location of the BD address)
param [in] bd_address : The cell's contents in chunks of 1 byte
param [in] phy_otp_address : The physical address of the OTP memory cell (for verification purposes)
param [out] : True if the read request has been successfully performed, false otherwise
As I mentioned in my precious answer, the BD Address in placed in specific address (0x07F8EA58) in the OPT header. Did you read the OPT Header with the OTP tool from the SmartSnippets toolbox. Is the BD Address located into 0x07F8EA58? Otherwise, in which OTP address is located?
Thanks, PM_Dialog
Hi Dialog,
I found my problem comes from using cm_sys_clk_set(sysclk_PLL48) for systme clock setting. I got the correct BD address of OTP after changing by cm_sys_clk_set(sysclk_XTAL16M); One more question, what is correct way to read OTP BD address if using cm_sys_clk_set(sysclk_PLL48) ?
thanks
Hi nigelyang,
Yes, you should read the BD Address with the same way. If you change the clock to PLL are you able to access the OPT Header from the toolbox and read the contains? If you found the previous answers useful please mark one of them as “accepted”.
Thanks, PM_Dialog