Showing results for 
Search instead for 
Did you mean: 

BLUENRG-M2SP MAC Address issue & DTM Firmware

Associate II


In one of my projects, I use BLUENRG-M2SP as a network coprocessor with a host microcontroller from STM32L0 series together. I flashed BLUENRG-M2SP with pre-compiled DTM_SPI.hex which is used by X-NUCLEO-BNRG2A1. 

My application code is run by host uC. Default BLE firmware is used as I indicated  (BlueNRG-1_2 DK 3.2.3\Firmware\BLE_Examples\DTM\BlueNRG-2\DTM_SPI.hex) 

In this configuration, it operates as expected well. 

But, I would like to use my custom Mac address. To do that I have 3 questions; 

 1) As I understand from application notes & community forum, to use my custom mac address, I need to write it to a specific location of flash (I have done it by BlueNRG-X Flasher Utility while flashing firmware). and then I need to read from the flash again and write it down  by following: ret=aci_hal_write_config_data(CONFIG_DATA_PUBADDR_OFFSET,CONFIG_DATA_PUBAD DR_LEN, bdaddr); 

am I right ? 

2) If I am right, should I read the mac address (@ specific flash address) in DTM_SPI application code (in Bluenrg-2 module) or in host uC ?  (Do you propose a way to do that? ) 

3) To test of ability of recompile DTM_SPI, I have tried to compile it in DTM_SPI configuration from STSW-BLUENRG1-DK DTM  project folder (BlueNRG-1_2 DK 3.2.3\Project\BLE_Examples\DTM\MDK-ARM\BlueNRG-2\DTM.uvprojx). But, compiled hex file did not work in the module as expected before. As I said in my current operating design, I used the pre-compiled firmware (BlueNRG-1_2 DK 3.2.3\Firmware\BLE_Examples\DTM\BlueNRG-2\DTM_SPI.hex ) which is supposed to have been compiled from the same project directory.

Is there any further pre-configuration or exception ( except HS_SPEED_XTAL=HS_SPEED_XTAL_32MHZ,   LS_SOURCE=LS_SOURCE_INTERNAL_RO, SMPS_INDUCTOR=SMPS_INDUCTOR_NONE) of the project to get the same firmware from the project directory?  

Thank you in advance,


Ilker B.

Winfred LU
ST Employee

The BLE API command to set the MAC address is aci_hal_write_config_data(), which means that you are to provide the MAC address as a part of the config. During initialization, BlueNRG-M2SP reads the config including the MAC address provided.


Therefore, the MAC address needs to be stored in a specific Flash location, on your host uC. So that when the application code starts, it knows where (the specific location) to fetch the MAC address and then provide to the BlueNRG-M2SP in config.


It will be your implementation freedom to choose that specific location. A common practice is to have some Flash sector dedicated for storing user configuration, and MAC address can also be saved somewhere in that sector.



Hi @Winfred LU 

Thank you for your prompt reply. 

I would like to exploit BLUENRG-X-FLASHER UTILITY ability to program MAC Address to BLUENRG-2  from the ST-link command line interface in mass manufacturing. Is it possible to do my intention? 

Thank you in advance. 

Ilker B.

Winfred LU
ST Employee

Hi Ilker B,

The function has been already available in RF-Flasher Utility.

at the top right corner in the GUI:

RF-Flasher Utility v4.3.0.png

Best Regards,


Hi @Winfred LU , 

I use this option exactly. But my problem is that; how to read this flash address from my host microcontroller  ? 


Ilker B. 

Winfred LU
ST Employee

Do you mean in host uC to read M2SP's flash thru ACI? There would be no such stack library ACI to pass some flash data.

The simplest workaround is to program the data (MAC address in this case) in the flash on host uC, then in the application read the data accordingly.