cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB Does master hold slaves MAC address?

DS.4
Senior II

Slave can configure his MAC address either in the payload or internally. This I know.

My question is , after connection, does the masters packets hold that (slaves) MAC address?

Can Slave extract (its own) MAC address from the Masters packets?

If, so , how can slave get hold of this data from code?

12 REPLIES 12
Remi QUINTIN
ST Employee

Not sure I understand your question.

It is possible to get the address of the remote device in the connection complete event . Then

Each connection is identified via the access address. No need to know/hold the remote address.

It can be up to the application to register parameters (like addresses extracted from the CON-REQ packet for example) associated with a connection.

DS.4
Senior II

How can I get hold of the CON-REQ packet?

I am interested in seeing the packet sent by the master, does it hold my MAC address?

Remi QUINTIN
ST Employee

To be clearer, each BLE device has a 48-bit BD address with the 32-bit lowest part of this address being significant.

A Bluetooth device also has a MAC address assigned to it with a similar format.

But both addresses do not necessarily match.

If you are really looking for the MAC address of the device, I am afraid there is no way to get it via the BLE frames for sure.

The CON-REQ packet embedds the BD address but this address is not the MAC address for sure.

DS.4
Senior II

You mean when the master sends a packet, it does not hold the slave's MAC/BD address? No API way for the slave to get one of them?

Remi QUINTIN
ST Employee

No, I just wanted to say that the MAC address and the BD address are two different types of addresses. Only the BLE address is used in BLE communication.

BD address is inserted in all BLE packet as part of the payload.

For example, the BD address of the advertising peripheral is loaded as part of the PDU of the advertising packet.

The peripheral can register the central address (as initiator of the connection) which is part of the connection request packet.

Once the communication is established, the connection is identified via the channel number on which the data exchange takes place.

DS.4
Senior II

Ok, thanks, so I can't get the MAC.

Can I get the BD extracted from the master's packet?

Remi QUINTIN
ST Employee

You can use the HCI_READ_BD_ADDR function to read the public device address of your device.

Have a look at AN5270 detailing all API functions part of the WB FW package.

DS.4
Senior II

I mean can I get my BD address from the packets I receive?

Remi QUINTIN
ST Employee

You can get your BD address when you receive a CONNECT_REQ packet.

See in attachment a description of this packet format.

You just have to analyze the received packed to extract your BD address depending on the role of your device: Initiator = Client or Advertiser = Server.

One the connection is accepted by the advertiser, the connection is identified by the  AccessAddress field that reflects the value of the AA (AccessAddress) field which is the first item of the Link Layer field of the PDU.