SparkFun Forums 

Where electronics enthusiasts find answers.

Tips, tricks, & best best practices using Artemis with your board designs.
User avatar
By idea--list
#226857
I would like to use BD_ADDR to uniquely identify my Artemis Thing Plus board.
My board has 66:77:88:23:BB:E0 as BD_ADDR, however i can not find any manufacturer in this list with 66:77:88 indentifier.
This makes wonder if the last 3 bytes are truly unique or they are just the same dummy bytes for all Artemis modules? I have only one of these boards so can not answer the question myself.

Can someone please confirm if the last 3 bytes of BD_ADDR of the Artemis modules are unique or not?
User avatar
By idea--list
#226873
For sure it *should*! But this answer does not help ;-)
Question is if it so even in case of Artemis modules despite the manufacturer is not recognizable based on the first 3 bytes.
If the manufacturer would follow best practice we could find them on the list based on the first 3 bytes... so they do not follow best practice.
The last 3 bytes should be assigned by the manufacturer but exactly that is questionable as they do not seem to follow best practice (did not inquire an OUI).
By paulvha
#226874
In earlier versions of the libraries de BD-ADDR was not unique. It was based on the default number in the Apollo3 chip, which was not unique. I had created a sketch where you can set the BD-ADDR ( viewtopic.php?f=183&t=54319&hilit=Bluetooth) It will need some changes, so read the top of sketch

That said, since then Sparkfun has made changes to also allow BD-ADDR update. It is a bit cryptic described in ...../packages/SparkFun/hardware/apollo3/2.1.0/cores/mbed-os/features/FEATURE_BLE/targets/TARGET_Ambiq_Micro/hal/apollo3/hci_drv_apollo3.c around line 160.
User avatar
By idea--list
#226890
Thanks Paul, that info helps a lot!
Forgot to mention that i am coding in official releases of Mbed OS, not with the Arduino core.
Your answer helped me to find hci_drv_apollo3.c in Mbed OS. The implementation of ap3_hciDrvWrite() contains this conditional section around line 660:
Code: Select all
#ifdef AM_CUSTOM_BDADDR
    if (type == HCI_CMD_TYPE)
    {
        uint16_t opcode;
        BYTES_TO_UINT16(opcode, pData);

        if (HCI_OPCODE_RESET == opcode)
        {

            extern uint8_t g_BLEMacAddress[6];
            am_hal_mcuctrl_device_t sDevice;
            am_hal_mcuctrl_info_get(AM_HAL_MCUCTRL_INFO_DEVICEID, &sDevice);
            g_BLEMacAddress[0] = sDevice.ui32ChipID0;
            g_BLEMacAddress[1] = sDevice.ui32ChipID0 >> 8;
            g_BLEMacAddress[2] = sDevice.ui32ChipID0 >> 16;

            HciVendorSpecificCmd(0xFC32, 6, g_BLEMacAddress);
        }
    }
#endif

So Mbed OS can change BD_ADDR based on CHIPID0 register. Based on page 133 of the MCU datasheet that register should contain a unique number.
After defining AM_CUSTOM_BDADDR to 1 the BD_ADDR has been changed for my board and remains the same after powercycling the board.

All this seems promising in case CHIPID0 register really contains a unique number, however i am not sure if that is the case or not.
Can you or someone else please confirm if that register is unique as it should be or even that is not the case?
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum