Hi Gurpreet,
I do not know why you get that behavior. Typically BlueZ should detect that this is an LE-only controller with no public address and would assign one to it.
Maybe it’s because you seem to have more than one controller? you are using hci1 on your btmgmt log.
I just tested this locally by doing:
sudo btattach -B /dev/ttyACM0 -S 1000000 -P h4
Attaching Primary controller to /dev/ttyACM0
Switched line discipline from 0 to 15
Device index 0 attached
and then:
$ sudo btmgmt --index 0
[hci0]# auto-power
Found controller with index 0
[hci0]# advertising on
hci0 Set Advertising complete, settings: powered bondable le advertising secure-conn static-addr
And in btmon it clearly set a random static address:
@ MGMT Command: Set Advertising (0x0029) plen 1
{0x0004} [hci0] 123.901998
Advertising: Enabled (0x01)
< HCI Command: LE Set Scan Response Data (0x08|0x0009) plen 32
#77 [hci0] 123.902018
Length: 13
Name (complete): zephyr-nrf
> HCI Event: Command Complete (0x0e) plen 4
#78 [hci0] 123.904563
LE Set Scan Response Data (0x08|0x0009) ncmd 1
Status:
Success (0x00)
< HCI Command: LE Set Random Address (0x08|0x0005) plen 6 #79
[hci0] 123.904604
Address: 32:82:D4:FE:B2:0F (Non-Resolvable)
> HCI Event: Command Complete (0x0e) plen 4
#80 [hci0] 123.906514
LE Set Random Address (0x08|0x0005) ncmd 1
Status:
Success (0x00)
< HCI Command: LE Set Advertising Parameters (0x08|0x0006) plen 15
#81 [hci0] 123.906548
Min advertising interval: 1280.000 msec (0x0800)
Max advertising interval: 1280.000 msec (0x0800)
Type: Non connectable undirected - ADV_NONCONN_IND (0x03)
Own address type: Random (0x01)
Direct address type: Public (0x00)
Direct address: 00:00:00:00:00:00 (OUI 00-00-00)
Channel map: 37, 38, 39 (0x07)
Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
> HCI Event: Command Complete (0x0e) plen 4
#82 [hci0] 123.907511
LE Set Advertising Parameters (0x08|0x0006) ncmd 1
Status:
Success (0x00)
< HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1
#83 [hci0] 123.907569
Advertising: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4 #84
[hci0] 123.909506
LE Set Advertise Enable (0x08|0x000a) ncmd 1
Status:
Success (0x00)
From: Gurpreet Singh <gurpreet@...>
Sent: 30 May 2018 14:32
To: Cufi, Carles <carles.cufi@...>
Cc: users@...
Subject: Re: [Zephyr-users] Unable to set Static Address on nRF52 using Zephyr v1.11.0
Hi Carles
Yes. I've been doing that but the Mac address comes up as all zeroes. Which is my original problem.
So how do I set a Mac address? Or why is it all zeroes?
Gurpreet
Hi Gurpreet,
If you are using BlueZ 5.48 then, as stated in the instructions you don’t need to set the static address manually.
Instead you should just do:
sudo btmgmt --index 0
[hci0]# auto-power
Regards,
Carles
From: Gurpreet Singh <gurpreet@...>
Sent: 29 May 2018 19:51
To: Cufi, Carles <carles.cufi@...>
Cc: users@...
Subject: Re: [Zephyr-users] Unable to set Static Address on nRF52 using Zephyr v1.11.0
I should have mentioned that I did see those instructions at zephyr and have already updated my
/lib/systemd/system/bluetooth.service file.
Thats the only real change I've noticed between the blog instructions and the zephyr instructions.
Is there something else that I need to do as well?
On Tue, May 29, 2018 at 1:47 AM, Cufi, Carles <Carles.Cufi@...> wrote:
Hi there,
If you are using a recent version of BlueZ then the sequence that you need to do is different from what’s on that blog post.
Here are updated instructions:
http://docs.zephyrproject.org/subsystems/bluetooth/devel.html#using-bluez-with-zephyr
http://docs.zephyrproject.org/subsystems/bluetooth/devel.html#testing-zephyr-based-controllers-with-bluez
I will update the blog post to reflect this since I see it’s still being used as a reference.
Carles
From:
users@... <users@...>
On Behalf Of Gurpreet Singh
Sent: 28 May 2018 18:40
To: users@...
Subject: [Zephyr-users] Unable to set Static Address on nRF52 using Zephyr v1.11.0
I've been chugging along nicely with Zephyr v1.11.0 and the nRF52DK so far, being able to get it to scan and advertise using the hci_uart sample
code and my Linux (ubuntu) computer.
My linux is on BlueZ 5.48 and kernel 4.15.0-22. This setup is just to get the ball rolling until we get sample boards from our manufacturer.
I have run into an issue where setting the address on the chip is being rejected.
I came across this post in the forum,
but have been unable to find any clean resolution for it.
For advertisements, you can see the all zero source mac address in the attached PCAP.
Interestingly, the same error persists even when following the blog
post on how to use the BLE controller with linux's BlueZ. (Step 5 in particular)
--- btmgmt
[hci1]# static-addr FF:02:03:04:05:FF
Set static address failed with status 0x0b (Rejected)
[hci1]#
--- btmon
@ MGMT Command: Set Static Address (0x002b) plen 6 {0x0004} [hci1] 9585.454699
Address: FF:02:03:04:05:FF (Static)
@ MGMT Event: Command Status (0x0002) plen 3 {0x0004} [hci1] 9585.454706
Set Static Address (0x002b)
Status: Rejected (0x0b)
To bring up the chip, I ran:
~ 11:49:30>sudo btattach -B /dev/ttyACM0 -S 1000000 -P h4
Attaching Primary controller to /dev/ttyACM0
Switched line discipline from 0 to 15
Device index 1 attached
The btmon log after this is in the attached txt file.
Do you have any tips or suggestions on what I could do?
Essentially, I would like to be able to program the BLE chip with a MAC address that uses the Mist OUI.
--