This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/CC2640R2F: Access to FCFG MAC address isn't working

Part Number: CC2640R2F

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?

  • Looking into the memory, I find the following:

    0x500012E8 FCFG1_MAC_BLE_0
    0x500012E8 0E20A399
    0x500012EC FCFG1_MAC_BLE_1
    0x500012EC FFFF546C
    0x500012F0 FCFG1_MAC_15_4_0
    0x500012F0 FFFFFFFF
    0x500012F4 FCFG1_MAC_15_4_1
    0x500012F4 FFFFFFFF

    So it appears the FCFG1_MAC_15_4_n value is not set in the CC2640R2F.

    The MAC_BLE, however, looks promising. I'll look at a few chips, but if someone can confirm that this value is unique (or suggest a different unique value programmed by TI) I'd appreciate it.
  • So that is a valid Texas Instruments MAC address, see www.adminsub.net/.../546c0e

    Independent confirmation that it is unique per device would be appreciated, so I'm leaving this question unanswered until TI responds about this (and it would be nice if they confirmed whether FCFG1_MAC_15_4 is meant to be unique and this is a failure, or if it is set to 0xFFFFFFFFFFFFFFFF by design).

    My final code for future reference is:

    ----------
    #include <ti/devices/DeviceFamily.h>
    #include DeviceFamily_constructPath(inc/hw_fcfg1.h)

    ...

    uint64_t * macAddressADDR;
    macAddressADDR = (uint64_t *)(FCFG1_BASE + FCFG1_O_MAC_BLE_0);

    uint64_t macAddressLocal;
    macAddressLocal = *macAddressADDR;
    -----------

    The BLE MAC address is the bottom 48 bits of macAddressLocal.
  • Hello. You are correct. The unique MAC address is the BLE address. The CC2640R2 is a "SimpleLink Bluetooth® low energy Wireless MCU" (www.ti.com/.../CC2640R2F) so that is why there is no unique 15.4 address.

    You can very this using Smart RF Flash Programmer 2 (http://www.ti.com/tool/FLASH-PROGRAMMER) by looking at the "BLE MAC Address":