While loading firmware through USB interface the BLE MAC address space in QN908x will be reset to default value. If we use the SWD interface then in the nvds file we can predefine the necessary MAC address.
My query here is - how to set the BLE MAC address in a mass production where we wont be designing a separate nvds files for each BLE module, and if we choose USB interface then nvds config file option is also not available. So would like to know what the standard process every one follows here while using QN908x controller.
Solved! Go to Solution.
Hi Kishan
In my last reply, a missed adding the following line below the write of the new OUI into the UID. Could you please try adding it?
nvds_put(NVDS_TAG_BD_ADDRESS, NVDS_LEN_BD_ADDRESS, uid);
In this way, the new UID will be stored at the NVDS and the BLE stack, internally, will read this value after the next reset.
I'm sorry for the inconvenience this may cause you.
Please let me know if you need any more information.
Thanks for the update.
I did the modification as you suggested in the board.c file, the BLE MAC address returned by BOARD_GetMCUUid() is different than the BLE MAC address which gets shown while scanning in the BLE Central device.
Would like to know in QN908x where exactly the Organization Unique Identifier (OUI) is stored and is it modifiable?
In my side e0: 51: 24 (which is NXPs OUI) gets shown while advertising , in ble_controller_task_config.h file the value of BD_ADDR_OUI is 0x37,0x60,0x00.
Hi Kishan
In my last reply, a missed adding the following line below the write of the new OUI into the UID. Could you please try adding it?
nvds_put(NVDS_TAG_BD_ADDRESS, NVDS_LEN_BD_ADDRESS, uid);
In this way, the new UID will be stored at the NVDS and the BLE stack, internally, will read this value after the next reset.
I'm sorry for the inconvenience this may cause you.
Please let me know if you need any more information.
Hi Kishan
I'm really sorry for the delay on my response.
As you said, it doesn’t seem very practical to generate a custom NVDS binary file for each device. I guess you may be interested in setting the Bluetooth Device Address(BD ADDR) to use a specific Organization Unique Identifier (OUI). If this is your case, it may be a better option to use as a base the Default Bluetooth Address provided by NXP.
The default Bluetooth Address is stored at the Flash Information Page of the QN9080s, so it cannot be modified by users. These Bluetooth device addresses are unique for every 2^24 MCUs. The address of this value is defined as FSL_FEATURE_FLASH_ADDR_OF_VENDOR_BD_ADDR in our SDK.
I would recommend to get the value at this address and change its OUI part to be able to use it with your devices.
Could you please take a look at the function BOARD_GetMCUUid? It's defined on the board.c file. This function will return the Default Bluetooth Address if there is not valid value associated with the BD_ADDR tag in the NVDS section. Certain changes need to be made to this function to ensure that it always returns the Default Bluetooth Address. I have written below a way in which it can be assured.
By replacing the line:
if ((err != NVDS_OK) || (len != NVDS_LEN_BD_ADDRESS))
with
if (true)
it is ensured that the function will not return the BD_ADDR on the NVDS section.
To change the OUI value in the Default Bluetooth Address please set the definition BD_ADDR_OUI at the ble_controller_task_config.h file with the desired OUI. Then add in the BOARD_GetMCUUid function the line:
FLib_MemCpy(uid, (void *)gBD_ADDR_OUI_c, 3);
just below the line
FLib_MemCpy(uid, (uint8_t *)FSL_FEATURE_FLASH_ADDR_OF_VENDOR_BD_ADDR, BD_ADDR_SIZE);
Please let me know if you need any more information.