cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to read out the unique serial number of BlueNRGM2 module?

Thieny
Associate II

Hi,

I'm using the BlueNRGM2 BLE module in combination with a STM32L4 host controller. They are connected over SPI.

The BlueNRGM2 is running the DTM_SPI application from ST to act as network coprozessor. My user application is running on the host controller. For communication with the module I use the X-Cube-BLE2 software package.

In section 3.1.1 of the BlueNRG-2 BLE stack v2.x programming guidelines (PM0257) I found the following description:

The BlueNRG-1, BlueNRG-2 devices do not have a valid preassigned MAC address, but a unique serial number (read only for the user).The unique serial number is a six byte value stored at address 0x100007F4: it is stored as two words (8 bytes) at address 0x100007F4 and 0x100007F8 with unique serial number padded with 0xAA55.

Unfortunately I can't find any ACI command to read out this area of flash.

The only command I found in the DoxyGen documentation for the API is the "aci_hal_updater_read_data_blk" but it's only for flash address regions above 0x10020000.

So how can I read out the serial number?

Is the unique serial number the same as the random static device address generated by the BLE stack?

Thank you very much in advance.

Kind regards Thieny

1 ACCEPTED SOLUTION

Accepted Solutions
Sebastien DENOUAL
ST Employee

Hi @Thieny​ ,

Unique serial number is different from static random address.

This static random address is generated at 1st boot and stored in NVM. This static random address is kept unchanged during product life (except if a full mass erase is performed).

You can read this static random address from your STM32L4 host thanks to aci_hal_read_config_data (offset 0x80).

Regards,

Sebastien.

View solution in original post

5 REPLIES 5
AndyR1
Senior

Hello @Thieny​ 

Points the 2 words

#define BLUENRG_UUID ((uint32_t *)0x100007F4)
#define BLUENRG_UUID2 ((uint32_t *)0x100007F8)

and get it in variable from pointers

uint32_t id1= *BLUENRG_UUID;
uint32_t id2= *BLUENRG_UUID2;  
Buff[0]= (uint8_t)((id2&0xFF00)>>8);
Buff[1]= (uint8_t)(id2&0xFF);
Buff[2]= (uint8_t)((id1&0xFF000000)>>24);
Buff[3]= (uint8_t)((id1&0x00FF0000)>>16);
Buff[4]= (uint8_t)((id1&0x0000FF00)>>8);
Buff[5]= (uint8_t)(id1&0x000000FF);

I used a 8bit buffer but you can use 2 32 bits as well

regards,

Andy.

AndyR1
Senior

And if you want it as MAC address, use this function

tBleStatus aci_hal_write_config_data(uint8_t Offset, uint8_t Length, uint8_t Value[]);

 with the offset CONFIG_DATA_PUBADDR_OFFSET

I missed the DTM app, sorry

Thieny
Associate II

Unfortunately you're right, you missed the DTM app. But thanks for your reply anyway.

The DTM app running on the BlueNRG-2 (BlueNRG-M2) emulates the functionality of the BlueNRG-2N which gets connected to a host via SPI as well.

So I looked up in the datasheet of the BlueNRG-2N for a hint to an API call for getting the serial number of the device.

Under section 2.9 "Unique device Serial number" it says the following:

The BlueNRG-2N device has a unique six-byte serial number stored at address 0x100007F4: it is stored as two words (8 bytes) at addresses 0x100007F4 and 0x100007F8 with unique serial number padded with 0xAA55. Specific API allows such locations to get access.

This leads me to the assumption that there is an API command that solves my problem but there is no further information in the documentation.

Sebastien DENOUAL
ST Employee

Hi @Thieny​ ,

Unique serial number is different from static random address.

This static random address is generated at 1st boot and stored in NVM. This static random address is kept unchanged during product life (except if a full mass erase is performed).

You can read this static random address from your STM32L4 host thanks to aci_hal_read_config_data (offset 0x80).

Regards,

Sebastien.

Thieny
Associate II

That's exactly what I was looking for.

Thank you very much for solving my problem.

Best regards

Thieny