This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2340R5: BLE MAC address

Part Number: CC2340R5
Other Parts Discussed in Thread: SYSCONFIG,

I use 
and set
Then use IOS and Android phones to test respectively.


Android phone: There is a broadcast, and the address on the broadcast display has been changed to CF, FF, FF, FF, FF, CF, but connect cannot connect to it.


IOS phone: Cannot scan the broadcast


Is there any other way to successfully change the MAC Address and scan and broadcast successfully?

  • Hi Ryan,

    Thanks for reaching out! We will look into this and get back to you shortly. What version of the SDK do you have installed and what example project have you modified?

    Best regards,

    Luke

  • SDK version : 7_10_00_35

    CCS version : 12.2.0.00009 

  • I want to clarify a few questions:
    1. Does CC2340 have two addresses?
    The first one is the default address, which can also be called the main address. This address has been burned into the chip, so it cannot be changed. The second one is the backup address, also called the Secondary Address. It can be set through the Random Address mode of .Syscfg or the Flash Programmer software or the function HCI_EXT_SetBDADDR(), etc.

    And if the Secondary Address is set, CC2340 will overwrite the "Primary Address" and use "Secondary Address" as the Device Address, so the Address displayed on the broadcast will be changed to "Secondary Address". My understanding is correct?

    2. In the picture I posted in the article, is HCI_EXT_SetBDADDR() used to change the "Secondary Address"?

    3. If the questions in points 1 and 2 are true, then the API HCI_EXT_SetBDADDR() has annotations. This API can only be used during initialization, and the CC2340 must be in the Standby state. Currently, I am in the "non-initialized" state HCI_EXT_SetBDADDR () call. Is it possible that this is the reason why the connection cannot be connected even though the Address shown in the broadcast has been changed?

    4.Which initialization does the "initialization" period mentioned in the HCI_EXT_SetBDADDR() annotation refer to? Is it appMain() -> BLEAppUtil_init(&criticalErrorHandler, &App_StackInitDoneHandler,&appMainParams, &appMainPeriCentParams)?

    5. If question 3 is true, is there any way to change the Address during "non-initialization" through code (without using software or .Syscfg)? For example, if I create a Function, when I enter the Function via Command via Bluetooth, I can change the Secondary Address and successfully connect and broadcast.

    6. If CC2340 does not support Secondary Address, can the Address be customized only through the Random Address mode in .Syscfg?

    7. If point 6 is true, then I select the Random Address mode in .Syscfg and set it to pRandomAddress in appMainParams.pDeviceRandomAddress. But if I can modify pDeviceRandomAddress during execution and let BLE successfully update the MAC Address and connect successfully?

    8. If point 7 is true, how do I refresh the MAC address and ensure that it can successfully connect and everything is normal?

    CC2340R5: basic_ble crashes using static random address - Bluetooth forum - Bluetooth®︎ - TI E2E support forums

  • Hi Ryan,

    First of all, I highly recommend to update the SDK version to use 7.40 or newer. Several improvements and bug fixes have been implemented since SDK 7.10. Please use the following link to access the newest SDK version: https://www.ti.com/tool/download/SIMPLELINK-LOWPOWER-F3-SDK

    1. Does CC2340 have two addresses?
    The first one is the default address, which can also be called the main address. This address has been burned into the chip, so it cannot be changed. The second one is the backup address, also called the Secondary Address. It can be set through the Random Address mode of .Syscfg or the Flash Programmer software or the function HCI_EXT_SetBDADDR(), etc.

    This description is not totally exact. Please allow me to clarify a few elements.

    • The CC2340 has only one public address (as you mentioned physically burned in the chip).
    • The CC2340 allows you to specify a random address using HCI_EXT_SetBDADDR(). However, this does not affect the public address. Also, when using HCI_EXT_SetBDADDR(), you should ensure the address is set in accordance with the Bluetooth specifications (e.g. you cannot give the same address to several devices, you cannot use the same random address continuously, etc.). Using this function can also conflict with the configuration set in SysConfig (see after). For these reasons I recommend to avoid using HCI_EXT_SetBDADDR().
    • In order to change the address mode of the CC2340, I recommend using SysConfig as you seem to have been doing (but don't use HCI_EXT_SetBDADDR)

    And if the Secondary Address is set, CC2340 will overwrite the "Primary Address" and use "Secondary Address" as the Device Address, so the Address displayed on the broadcast will be changed to "Secondary Address". My understanding is correct?

    The public address cannot be easily changed - or at least it may require extra steps on the production line.

    2. In the picture I posted in the article, is HCI_EXT_SetBDADDR() used to change the "Secondary Address"?

    I am afraid the usage of HCI_EXT_SetBDADDR() is not correct in your case.

    3. If the questions in points 1 and 2 are true, then the API HCI_EXT_SetBDADDR() has annotations. This API can only be used during initialization, and the CC2340 must be in the Standby state. Currently, I am in the "non-initialized" state HCI_EXT_SetBDADDR () call. Is it possible that this is the reason why the connection cannot be connected even though the Address shown in the broadcast has been changed?

    The connection/detection issues are rather caused by the "conflict" between SysConfig and HCI_EXT_SetBDADDR(). Said differently, you set one addressing mode with SysConfig and force an incorrect address with HCI_EXT_SetBDADDR. Recommendation is to not use HCI_EXT_SetBDADDR.


    4.Which initialization does the "initialization" period mentioned in the HCI_EXT_SetBDADDR() annotation refer to? Is it appMain() -> BLEAppUtil_init(&criticalErrorHandler, &App_StackInitDoneHandler,&appMainParams, &appMainPeriCentParams)?

    5. If question 3 is true, is there any way to change the Address during "non-initialization" through code (without using software or .Syscfg)? For example, if I create a Function, when I enter the Function via Command via Bluetooth, I can change the Secondary Address and successfully connect and broadcast.

    The CC2340 offers the Random Private Address (RPA) mode. This addressing mode set the device to change automatically its address periodically. This ensures privacy and ensure a Bluetooth compliant address is used.
    Is it what you are looking for?

    6. If CC2340 does not support Secondary Address, can the Address be customized only through the Random Address mode in .Syscfg?

    It is not the only way per say. But, in order to avoid extra efforts, I would suggest you share the requirements for your system addressing mode and review my previous suggestions.

    7. If point 6 is true, then I select the Random Address mode in .Syscfg and set it to pRandomAddress in appMainParams.pDeviceRandomAddress. But if I can modify pDeviceRandomAddress during execution and let BLE successfully update the MAC Address and connect successfully?

    8. If point 7 is true, how do I refresh the MAC address and ensure that it can successfully connect and everything is normal?

    See answer suggesting to leverage the Random Private Address (RPA) mode.

    This point should be solved in SDK 7.40

    I hope this will help,

    Best regards,

  • The goal I want to achieve is to be able to change the MAC Address during execution, and to be able to update on the broadcast and successfully connect.
    The MAC Address will no longer change after the update, so RPA mode is not considered.
    If the product is mass-produced later, it is impossible to use Syscfg to reset the MAC Address every time.

    Currently using SDK: 7_10_00_35, the development has reached a stage, and we are not considering using SKD: 7_40 for the time being.


    1. It is indeed possible to customize the Device Address using the Random Address Mode of .Syscfg. However, as mentioned above, it is impossible to open CCS every time during mass production to change the Random Address of .Syscfg. Is there a way for me to do this? Device Address is successfully changed directly during execution?

    2.If, as you said, the Address is updated on the broadcast but remains connected when connected, it is because the Syscfg setting conflicts with HCI_EXT_SetBDADDR(). Then I set the Random static Address in Syscfg, then use HCI_EXT_SetBDADDR()? Will there be no connection problems?

  • Hi,

    Currently using SDK: 7_10_00_35, the development has reached a stage, and we are not considering using SKD: 7_40 for the time being.

    Please make sure to review the release notes of SDK 7.20 and 7.40 before making such decision.

    1. It is indeed possible to customize the Device Address using the Random Address Mode of .Syscfg. However, as mentioned above, it is impossible to open CCS every time during mass production to change the Random Address of .Syscfg. Is there a way for me to do this? Device Address is successfully changed directly during execution?

    As already mentioned, this is not totally Bluetooth compliant as Random Address should be changed at each reboot.
    If this Bluetooth noncompliance is ok for you, you can consider modify the image produced by the toolchain (without opening SysConfig).
    Here is the procedure I would suggest:

    1. Set the random address using SysConfig (don't use HCI_EXT_SetBDADDR)
    2. Build the code. as a .bin. Either configure the toolchain to also produce a .bin or flash the .hex obtained on to a CC2340R5 and dump it as a .bin.
    3. Identify where the address is set in the .bin image. Either use the .map file and check the address of the variable "pRandomAddress", or build the image two times with two different address and run a diff.
    4. Write a python script taking the image built as input and producing copies of it with modified addresses.

    I hope this will help,

    Best regards,

  • I will explain in more detail why I want to modify the MAC Address. I hope that after you understand my needs, you can give me a solution that better meets my needs.

    Our company has the MAC address for purchasing Bluetooth. That’s why we hope that the product can be modified to the MAC address we purchased, and that it can successfully adversiting and connect. However, it has been confirmed that the Public Address of CC2340 cannot be changed, so I would like to ask if there is a way to do this without going through Syscfg and Have any way to modify the MAC Address ?. The reason why you don’t want to use Syscfg is that when the product is in the mass production stage, it is impossible to use Syscfg to change it every time.

     

  • Hi Ryan,

    The suggestion I have made only requires a one time usage of SysConfig, would it work for you?

    Regards,

  • Sorry ,I understand wrong. I think it is not good method.

    I now understand that Random Static Address is not what I want, Public Address is. After all, Public Address is fixed and will never change, but there is no method or software to change the Public Address of CC2340?

  • Hi Ryan,

    Thank you for telling me.

    I know there is a solution to set your own public address but I don't have the details just yet. Allow me a few days to check with my colleagues and coma back to you.

    Please kindly let me know if this blocks your development.

    Best regards,

  • Hi Ryan,

    I have some initial findings in order to help you implement a way to specify your own public address.

    1- Set the device to use Public address

    2- After the stack initialization (in App_StackInitDoneHandler), call HCI_EXT_SetBDADDRCmd. Note that no other Bluetooth operation should be started before the address has been set (i.e. HCI_BDADDR_UPDATED_EVENT has been received)

    Let me know how it goes.

    Best regards,

  • Hi Clément,

    I try to set HCI_EXT_SetBDADDRCmd() after App_StackInitDoneHandler() as shown below ,then I checked two phones with different operating systems.

    Andriod : 1.Advertising is OK 
                    2.but Public address not be changed 
                    3.can be connect

    IOS :1. Advertising is OK
             2.T
    he IOS system cannot view the Address , so I do not check it be changed 
             3.it can not be connect (  always connecting )

    PS . appInitDoneHandler() = App_StackInitDoneHandler() in bleapputil_process.c

  • Hi Ryan,

    I am a bit confused. In the code you have shared, it seems the address modification is not done in App_StackInitDoneHandler() as suggested. To me, this is a problem because you cannot be sure the address is set before the advertisement is turned on.

    I have tested the same on my end. No connection issue found and the address displayed on Android devices is correct.

    Here is the process I have followed:

    1- Set the device to use Public Address in SysConfig

    2- Ensure you find a valid Public Address (I used 14:A0:CC:D0:C7:E5)

    3- Add the following code at the beginning of App_StackInitDoneHandler

        hciStatus_t addrStatus;
        unsigned char newAddress[6] = {0xE5, 0xC7, 0xD0, 0xCC, 0xA0, 0x14 };
        addrStatus = HCI_EXT_SetBDADDRCmd(newAddress);
        if(addrStatus != HCI_SUCCESS)
        {
            while(1){}
        }
    
        sleep(1);
    

    I hope this will help,

    Best regards,

  • I success !
    It turns out that HCI_EXT_SetBDADDRCmd() was called at the beginning of App_StackInitDoneHandler(). I originally tried to call HCI_EXT_SetBDADDRCmd() after calling App_StackInitDoneHandler().

    Thanks,Clément !

    I still have some questions. Does the function HCI_EXT_SetBDADDRCmd() directly modify the MAC Address in FCFG? Or does it modify the read MAC after reading the MAC Address of FCFG?

  • Hi,

    Thank you for confirming!

    HCI_EXT_SetBDADDRCmd() only modify the address used by the BLEStack, but it does not alter the MAC Address in FCFG.

    The MAC address in FCFG cannot be altered after production in TI's factories.

    Best regards,

  • OK , I understand finally.

    Thanks , Clément