Tool/software: Code Composer Studio
While the use case looks odd, this is just test code to verify that I can access the unique MAC address TI programs into this chip.
Near the top of the file:
#include <ti/devices/DeviceFamily.h>
#include DeviceFamily_constructPath(inc/hw_fcfg1.h)
static uint8_t advertData[] =
{
// Flags; this sets the device to use limited discoverable
// mode (advertises for 30 seconds at a time) or general
// discoverable mode (advertises indefinitely), depending
// on the DEFAULT_DISCOVERY_MODE define.
0x02, // length of this data
GAP_ADTYPE_FLAGS,
DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
// complete name
11,
GAP_ADTYPE_LOCAL_NAME_COMPLETE,
'S', 'O', 'M', 'E', 'T', 'H', 'I', 'N', 'G', '1',
// manufacturer data
0x07,
GAP_ADTYPE_MANUFACTURER_SPECIFIC,
0xFF, 0xFE, // Company ID code, testing only TODO: replace with actual company ID
0x01, 0x02, 0x03, 0x04, // NOTE: This is overwritten, if moved you must change the code that alters this
};
Right before advertdata is sent to the BLE stack:
uint32_t macAddressLocal;
macAddressLocal = *((uint64_t *)(FCFG1_BASE + FCFG1_O_MAC_15_4_0));
advertData[19] = (macAddressLocal >> 24) & 0xFF;
advertData[20] = (macAddressLocal >> 16) & 0xFF;
advertData[21] = (macAddressLocal >> 8) & 0xFF;
advertData[22] = (macAddressLocal) & 0xFF;
// Initialize Advertisement data
GAPRole_SetParameter(GAPROLE_ADVERT_DATA, sizeof(advertData), advertData);
When run the manufacturer data is still 01020304 rather than whatever is stored in FCFG MAC register.
What am I doing wrong?