10 years, 2 months ago.

How to change BLE MAC Address on mbed nrf51822

Hi,

I am trying to change the mac address on my mbed NRF51822.

I am trying to use this line:

const uint8_t address1[] = {0xAA,0xAA,0xAA,0xAA,0xAA,0xAA};
ble.setAddress(Gap.ADDR_TYPE_PUBLIC, address1);

but I get this error:

Error: Type name is not allowed in "main.cpp", Line: 112, Col: 32

Can someone please help me?

Thank you!

Question relating to:

The nRF51822-mKIT is a low cost ARM mbed enabled development board for Bluetooth® Smart designs with the nRF51822 SoC. The kit gives access to all GPIO pins via pin headers …

Solved!

const uint8_t address1[] = {0xe7,0xAA,0xAA,0xAA,0xAA,0xAA}; ble.setAddress(Gap::ADDR_TYPE_PUBLIC, address1);

posted by Naum N 28 Aug 2014

Hi, did this actually change the advertised mac address?

posted by arie matsliah 08 Jan 2015

Thank you!! It works on my ST Nucleo IDB04A1

posted by Josué Olmeda 15 Apr 2015

So far, I had to use ble.gap().setAddress(BLEProtocol::AddressType::PUBLIC, address1); to make this work (STNucleo F072 + IDB04A1)

posted by Filippo Montano 13 Apr 2016

3 Answers

10 years, 1 month ago.

Here's a patch to add getAddress() API. This will be a part of the next release, but it doesn't justify making a new release. Thanks.

Accepted Answer
10 years ago.

how do I read the mac address of the client (iphone) from mbed?

Hi,

You cant due to the fact that when a beacon message is sent, there is no connection.

-Naum

posted by Naum N 27 Oct 2014
10 years, 1 month ago.

Hi, I have a question about this topic - how can I read default mac ?

Hi,

Thanks for bringing this up. I should add an API for fetching the default MAC address. While this doesn't take much time, I would still like to wait a little while before pushing out the change as a part of a larger release. I will collect the diff and attach it here so that you can make use of it.

thanks again, rohit.

posted by Rohit Grover 06 Oct 2014