BLE extended advertising not working with a Pi Pico 2 W
I wanted to create a BLE peripheral that uses extended advertising to send lager advertisements than the limits of legacy advertising.
It looks like this does not work for Pi Pico 2 W. A minimal example where I try to set up a BLE peripheral using extended advertising can be seen here. ENABLE_LE_EXTENDED_ADVERTISING is set in the btstack_config.h and none of the gap_extended_advertising...() functions retuned an error during the setup of the extended advertising.
When digging deeper, I noticed that the hci_le_extended_advertising_supported method of BtStack returns false and with this it looks like the extended advertising is silently just ignored.
I then enabled the BtStack logging, still did not see an error or warning in regard to the extended advertising, but at startup it dumps the supported local HCI commands
[00:00:02.048] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_READ_REMOTE_EXTENDED_FEATURES (0) supported 2/6
[00:00:02.058] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE (1) supported 10/4
[00:00:02.069] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_READ_BUFFER_SIZE (2) supported 14/7
[00:00:02.078] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING (3) supported 18/3
[00:00:02.089] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_READ_ENCRYPTION_KEY_SIZE (4) supported 20/4
[00:00:02.098] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_SET_EVENT_MASK_PAGE_2 (5) supported 22/2
[00:00:02.108] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_WRITE_LE_HOST_SUPPORTED (6) supported 24/6
[00:00:02.117] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_LE_READ_REMOTE_FEATURES (7) supported 27/5
[00:00:02.127] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY (8) supported 32/1
[00:00:02.137] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_WRITE_SECURE_CONNECTIONS_HOST (9) supported 32/3
[00:00:02.148] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_READ_LOCAL_OOB_EXTENDED_DATA_COMMAND (10) supported 32/6
[00:00:02.158] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH (11) supported 34/0
[00:00:02.169] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_LE_SET_ADDRESS_RESOLUTION_ENABLE (12) supported 35/1
[00:00:02.180] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_LE_READ_MAXIMUM_DATA_LENGTH (13) supported 35/3
[00:00:02.190] LOG -- hci.c.2793: Command SUPPORTED_HCI_COMMAND_LE_SET_HOST_FEATURE_V1 (17) supported 44/1
[00:00:02.199] LOG -- hci.c.2800: Local supported commands summary 00023fff
To my suprise the SUPPORTED_HCI_COMMAND_LE_SET_EXTENDED_ADVERTISING_ENABLE is not in this supported commands dump. This as I understood that extended advertising was added with Bluetooth 5 and Pico 2 W claims Bluetooth 5.2:
Raspberry Pi Pico 2 W features 2.4GHz 802.11n wireless LAN and Bluetooth 5.2, giving you even more flexibility in your IoT or smart product designs and expanding the possibilities for your projects.
Infineon states even Bluetooth® 5.4 for the CYW43439
Infineon’s AIROC™ CYW43439 single-chip combo device features 1x1 single-band 2.4 GHz Wi-Fi 4 (802.11n) and Bluetooth® 5.4 is a reliable entry-level solution for low-cost applications.
So I wonder is this an issue of BtStack or is it an issue of the included CYW43439 cyw43_driver/firmware?
Or is it really not possible to use extended advertising with Pico 2 W hardware (released ~8 years after the release of extended advertising)?
HW & SW Versions
https://forums.raspberrypi.com/viewtopic.php?p=2235712&hilit=computer+says#p2235712
07/10/24 08:36:16.624 COM23@115200 c> Reset
HCI Command
COM23@115200
[03 0C 00 ]
opcode = 0x0C03 (3075, "Reset")
07/10/24 08:36:16.630 COM23@115200 <c Reset
HCI Command Complete Event
COM23@115200
[0E 04 ]: 01 03 0C 00
event = 0x0E (14,"Command Complete")
Num_HCI_Command_Packets = 0x1 (1)
Command_Opcode = 0xC03 (3075, "Reset")
Status = 0x0 (0, "Success")
07/10/24 08:38:34.440 COM23@115200 c> LE_Set_Extended_Advertising_Enable
HCI Command
COM23@115200
[39 20 06 ]: 01 01 00 00 00 00
opcode = 0x2039 (8249, "LE_Set_Extended_Advertising_Enable")
Enable = 0x1 (1, "Advertising is enabled")
Number_of_Sets = 0x1 (1)
Advertising_Handle[0] = 0x0 (0)
Duration[0] = 0x00 (0)
Max_Extended_Advertising_Events[0] = 0x0 (0)
07/10/24 08:38:34.442 COM23@115200 <c LE_Set_Extended_Advertising_Enable
HCI Command Complete Event
COM23@115200
[0E 04 ]: 01 39 20 01
event = 0x0E (14,"Command Complete")
Num_HCI_Command_Packets = 0x1 (1)
Command_Opcode = 0x2039 (8249, "LE_Set_Extended_Advertising_Enable")
Status = 0x1 (1, "Unknown HCI Command")
Since cyw43_driver just forwards from CYW43439, I bet it just doesn't recognise for example LE_Set_Extended_Advertising_Enable command, thus extended advertising is not supported (it is an optional feature, and it is an entry-level chip).
Apart changing message in a legacy advertisement for more capacity, hardware multiple advertisements are available. 8 plus normal one. But they will have maximum TX power a bit lower than max for legacy one.
PS. Maybe BT firmware will get such functionality somewhen in the future. Seems like CYW43439 is an updated CYW4343W and firmware binaries are smaller, so there might be some patch RAM left (or something like that) to do so.
I see, so I was misled by the Bluetooth 5.2 statements 😢.
PS. Maybe BT firmware will get such functionality somewhen in the future. Seems like CYW43439 is an updated CYW4343W and firmware binaries are smaller, so there might be some patch RAM left (or something like that) to do so.
Do you know if there is somewhere a roadmap of what is planned?
It's hard to get any changes made to the firmware.
Do you know if there is somewhere a roadmap of what is planned?
That was just my wild guess
@bittailor Good catch! @peterharperuk It does not hurt to ask 🫣
Is it possible to state, if there ever will be BLE extended advertising and if a rough timeframe?
I ask, as to continue with my project, I need BLE extended advertising. Therefore, I need to decide to switch to another board/chip if Pi Pico 2 W will not get support for it.
A side note: In all the documents about the just released Raspberry Pi Radio Module 2 which contains the same wireless chip I again find statements about Bluetooth 5.2 support, but again nowhere that only the minimal 5.2 features of it are supported and which features are not supported. For me, it would have been very helpful and save some time if somewhere the BLE features had been listed like the Bluetooth part on this Espressif SoC Product Portfolio overview.
Hi there.
As you have realized, the Bluetooth Core Version number is pretty useless. The only information it implies it which functionality a device will not support, e.g. if it's listed as Bluetooth v4.2 it will not support LE Audio (LE Isochronous Connections) as that was introduced in Core v5.2.
Bluetooth SIG finally seems to have realized this problem and is urging its members to list features with well-defined names instead, like Espressif has done. https://www.bluetooth.com/communicating-supported-bluetooth-functionality/
The details for the CYW43439 on the Pico (2) W can be found in the Link Layer ICS category, if you have Bluetooth SIG login: https://qualification.bluetooth.com/ICSDetails/222970
Comparing these to the supported features, the CYW43439 supports:
- LE Secure Connections (although that's implemented in software in pico-sdk)
- Classic Audio
- Mesh (Mesh only needs to send/received legacy advertisements)
Caveats:
- BTstack doesn't support Mesh.
- There is a long-standing issue with the custom gSPI transport used on the Pico (2) W and SCO doesn't work, so HSP/HFP is not supported
The CYW43439 also supports LE Data Length Extension, which isn't in the official list, but gives up to 2x higher LE throughput.
I don't expect Infineon to add new features to old products as their goal most likely is to sell new chips.
Cheers Matthias
But on the other hand, according to: https://datasheets.raspberrypi.com/pico/pico-2-product-brief.pdf, Pico 2 series has still around 15 years of in-production time.
PS. Speaking of advertising, if there will be a wish list, I would add "Periodic Advertising" and maybe "Periodic Advertising with Responses" it it might be possible in the future.
@matsobdev Periodic Advertising is supported by BTstack - but not the CYW43439. Periodic Advertising with Response (PAwR) was introduced for Smart Shelf Labels (configure & update hundreds of battery powered devices from a single gateway). This is on the BTstack list of things we will probably implement.