Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

MAC address mismatch

I try to retrieve the current device's MAC address and print it through RTT so that it can be recognized automatically in the manufacturer's test. The weird thing is... the MAC address never matches the real MAC address. Here's what I do in my code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
char * macaddr( void )
{
static char _str[BLE_GAP_ADDR_LEN * 3] = "";
char * p = _str;
ble_gap_addr_t mac;
if ( !_str[0] )
{
pm_id_addr_get( &mac );
for ( int i = BLE_GAP_ADDR_LEN; i; )
{
if ( i-- != BLE_GAP_ADDR_LEN ) *p++ = ':';
p += sprintf( p, "%02X", mac.addr[i] );
}
}
return _str;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I have a device with address F5:B8:BC:C3:99:C5. But the above code reports F5:B8:BC:C3:99:C4. It's always the LSB that is wrong. Same thing with all the other samples I have.

Software: SDK15, hardware nRF52832