You are here

Programmatically Changing BLE device name | Cypress Semiconductor

Programmatically Changing BLE device name

Summary: 3 Replies, Latest post by Nick Gart on 26 May 2016 12:22 AM PDT
Verified Answers: 1
Last post
Log in to post new comments.
Nick Gart's picture
6 posts

I want to have the last 4 characters of my device name be the last 4 hex characters of the MAC address.

So in order to do this:

-How do I retrieve the device MAC address? 

-How do I programmatically set the device name ?

BMAH's picture
Cypress Employee
189 posts

Use CyBle_GetDeviceAddress to get the device MAC address. Use CyBle_GapSetLocalName to set the device local name. Call this API before the advertisement start APIs so that the device advertises with the new address.

Nick Gart's picture
6 posts



I am testing on a few devices, and for every single device I am getting same address when calling CyBle_GetDeviceAddress  with the addr type set to 0 for public address.


I have 'Silicon generated "Company assigned" part of the address' checked in the BLE component, and the public address remains as:


on every call to CyBle_GetDeviceAddress  I am getting: 0x80 0x95 0x19 0x29 0x49 0x80

Am I comparing two different addresses? Shouldn't the company prefix and 'die' assigned address be there?


Nick Gart's picture
6 posts


I got a little further following this advice:

I am now waiting until the BLESS state is event_close before getting the device address.

    while( CyBle_GetBleSsState() !=  CYBLE_BLESS_STATE_EVENT_CLOSE )


This gets me unique mac addresses.

The other issue I ran into was that CyBle_GapSetLocalName was truncating the custom name I was setting based on the length I put in the component:


Once I padded out the name I put in the component settings, this stopped truncating. 

Is there a better way to do that?



Log in to post new comments.