RAK4630/RAK4631 how to get serial number and BLE MAC?

From an Arduino sketch, how can I retrieve the unique RAK4631 (4630) serial number and BLE MAC address into strings?

Within the Arduino IDE I can click Tools → Get Board Info I can see the unique serial number, so I assume it’s stored in FLASH or otherwise? Not sure where the BLE MAC would be stored.

Thank you.

Some code snippets from my libraries for nRF52:

/**@brief Unique Devices IDs register set (nRF52)
 */
#define ID1 (0x10000060)
#define ID2 (0x10000064)

void BoardGetUniqueId(uint8_t *id)
{
	id[7] = ((*(uint32_t *)ID1));
	id[6] = ((*(uint32_t *)ID1)) >> 8;
	id[5] = ((*(uint32_t *)ID1)) >> 16;
	id[4] = ((*(uint32_t *)ID1)) >> 24;
	id[3] = ((*(uint32_t *)ID2));
	id[2] = ((*(uint32_t *)ID2)) >> 8;
	id[1] = ((*(uint32_t *)ID2)) >> 16;
	id[0] = ((*(uint32_t *)ID2)) >> 24;
}

BLE MAC

// Internal address for the BLE MAC
uint32_t addr_high = ((*((uint32_t *)(0x100000a8))) & 0x0000ffff) | 0x0000c000;
uint32_t addr_low = *((uint32_t *)(0x100000a4));

char helper_string[256] = {0};

sprintf(helper_string, "%02X%02X%02X%02X%02X%02X", 
		(uint8_t)(addr_high), (uint8_t)(addr_high >> 8), (uint8_t)(addr_low),
		(uint8_t)(addr_low >> 8), (uint8_t)(addr_low >> 16), (uint8_t)(addr_low >> 24));
1 Like