How do I set the address of a device based on silicon-generated/SFlash?
The public device address (48 bits) of a Bluetooth device includes two parts:
- Company-ID part:
It is a 24-bit Organization Unique Identifier (OUI) address assigned by IEEE. For testing purposes, you can use the Cypress OUI (00A050). For production purposes, you should to get the OUI for your company. You can get your Company ID from the Bluetooth SIG (refer https://www.bluetooth.org/en-us/specification/assigned-numbers/company-identifiers ) after you get an adopter or associate membership, or can use an OUI assigned by the IEEE (refer https://standards.ieee.org/develop/regauth/oui/)
- Company Assigned part:
The 24 least significant bits constitute the Company Assigned part. For this part, either you can use silicon-generated company-assigned value or you can directly write a value into flash. To set this part based on silicon-generated value, open the BLE Component configuration in PSoC Creator TopDesign. Check the Silicon generated “Company Assigned” part of the device address check box (as shown in Figure 1).
Figure 1: BLE Component Configuration Setting for Public Device Address
When you enable this option, the “Company assigned” part of the device address is generated using the Wafer ID and X-Y die location on the wafer .PSoC creator then populates the company-assigned part of the device address using the 6 bits of the Die X register, 6 bits of the Die Y register, 5 bits of the Die wafer, and 7 bits of the Die Lot registers. Thus, you get 2^24 different device addresses.
The address configured here is static and is designed to be used for development purposes only. This address is programmed into the device via the SWD interface. Normally, this address must be programmed only once during mass production, and then never changed in field. However, user flash can be reprogrammed in-field many times.
During prototyping (firmware design), this address can be programmed using MiniProg3. To do so, use the SFlash Update Tool installed in the “C:\Program Files (x86)\Cypress\Programmer\Example\Misc\PSoC4-BLE-SFLASH-Update\Executable” folder of PSoC Programmer. See Figure 2.
On this tool, enter the device address structure of type CYBLE_GAP_BD_ADDR_T in the Row 0 line to store it in the SFLASH.
Figure 2: PSoC 4 BLE SFlash Update Tool
Row 1, Row 2, and Row 3 are not used by the Component and available for user information storage. Note that row addresses and length (128 or 256 bytes) depend on the flash memory size of the selected device. Row 0 address is 0x0FFF F200 for a device with 128 KB flash; it is 0x0FFF F400 for a device with 256 KB flash.
This application is provided in source code, and can be used as a reference example for implementation in production programmers.