-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ST: STM32WB0: Implement BLE feature #79734
Conversation
subsys/bluetooth/host/Kconfig
Outdated
@@ -344,7 +344,7 @@ config BT_USER_DATA_LEN_UPDATE | |||
info is available in the connection info. | |||
|
|||
config BT_AUTO_DATA_LEN_UPDATE | |||
bool "Auto-initiate Data Length Update procedure" | |||
bool "Auto-initiate Data Length Update procedure" if !BT_STM32WB0 | |||
depends on BT_DATA_LEN_UPDATE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to this file should not be required, based on the changes to soc/st/stm32/stm32wb0x/Kconfig.defconfig
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this config has prompt, it is user configurable. So, if in an application, like BT shell (available under tests/bluetooth/shell
), it is activated in prj.conf
then the default value will be ignored as well as changes in soc/st/stm32/stm32wb0x/Kconfig.defconfig
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see. Then is is the case as well for bunch of these options (BT_HCI_ACL_FLOW_CONTROL
for instance) and yet this is never used. Anyway, I let this to subsystem maintainers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason these options must remain disabled for this controller? Is it because the controller doesn't support them? Does it incorrectly report support for them when querying its features over HCI? (the host shouldn't initiate such procedures if the controller reports that it doesn't support them).
Either way, having HCI driver specific references in the host Kconfig is not the right way to deal with this. What the right/best way is depends on the answers to my earlier questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zephyr host starts several BLE procedures in parallel during connection (perform_auto_initiated_procedures
in subsys/bluetooth/host/conn.c
); however, ST controller does not support this "parallelism" and according to the ST Bluetooth stack experts, host should not initiate a new procedure before previous one is completed. In such case, ST controller returns a "controller busy" error (0x3A) which is not managed by the host and it's only reported on the console.
We may request further clarification in the future, but for the time being to avoid showing console error, I disabled CONFIG_BT_AUTO_PHY_UPDATE and CONFIG_BT_AUTO_DATA_LEN_UPDATE.
By the way, I will remove any changes in the host part added for handling special use cases to minimize the impact on any other piece of code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alwa-nordic @jhedberg, I was reporting the opinion of our BLE stack team people and I will try to involve them in the conversation. On the other hand, I suspect it could be a fairly long discussion. Our target was to have this PR approved before next code freeze. Is there anyway we could push this PR for approval ? or you prefer to clean the controller busy with a quirk or a
discussion with host guys ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do the quirk: I suggest we do it defensive programming-style, with a delayed retry. The delay should be timeout-based, but optionally some events can reduce or skip the timeout.
@alwa-nordic, you mean to implement the quirk at driver level which should implement a delayed retry when controller busy is detected? Or you mean that host part should be changed to make a delayed retry when controller busy is returned? I would reckon that last approach would extend the host to properly handle controller busy cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with this PR adding an override of the default y
. But only if @jhedberg also agrees. In this case, you should also consider adding BUILD_ASSERT
in your driver to deny these configs completely.
Aside: I even think we should consider globally removing the default y
. I think explicit is better than implicit, and especially as new features are introduced, it's safer not to automatically add extra effects. We could have snippets or a config for "recommended getting-started config", that selects "most" features and automatics, but is explicitly asked for by the application developer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alwa-nordic, you mean to implement the quirk at driver level which should implement a delayed retry when controller busy is detected? Or you mean that host part should be changed to make a delayed retry when controller busy is returned? I would reckon that last approach would extend the host to properly handle controller busy cases.
Either in the Host or the driver is fine by me. The driver could implement this with vendor-specific events, so it might be more performant. OTOH, in the Host, defensive programming is never a bad idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alwa-nordic @jhedberg, I was reporting the opinion of our BLE stack team people and I will try to involve them in the conversation. On the other hand, I suspect it could be a fairly long discussion. Our target was to have this PR approved before next code freeze. Is there anyway we could push this PR for approval ? or you prefer to clean the controller busy with a quirk or a discussion with host guys ?
Optimally, the fix should be in the Controller. So if we could convince them, that would be great. I welcome the discussion.
The following west manifest projects have changed revision in this Pull Request:
Additional metadata changed:
⛔ DNM label due to: 1 project with metadata changes Note: This message is automatically posted and updated by the Manifest GitHub Action. |
subsys/bluetooth/host/Kconfig
Outdated
@@ -344,7 +344,7 @@ config BT_USER_DATA_LEN_UPDATE | |||
info is available in the connection info. | |||
|
|||
config BT_AUTO_DATA_LEN_UPDATE | |||
bool "Auto-initiate Data Length Update procedure" | |||
bool "Auto-initiate Data Length Update procedure" if !BT_STM32WB0 | |||
depends on BT_DATA_LEN_UPDATE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason these options must remain disabled for this controller? Is it because the controller doesn't support them? Does it incorrectly report support for them when querying its features over HCI? (the host shouldn't initiate such procedures if the controller reports that it doesn't support them).
Either way, having HCI driver specific references in the host Kconfig is not the right way to deal with this. What the right/best way is depends on the answers to my earlier questions.
subsys/bluetooth/Kconfig
Outdated
default y if !BT_CTLR && !BT_STM32_IPM && !BT_ESP32 && !BT_STM32WBA | ||
default y if !BT_CTLR && !BT_STM32_IPM && !BT_ESP32 && !BT_STM32WBA && !BT_STM32WB0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is starting to get messy. We should probably instead create a virtual option that the HCI drivers select and then here we only depend on that one virtual option. That said, do you realize that BT_CTLR
is actually a generic option for describing any local (same memory & CPU) controller? I think we should work toward having all such HCI drivers enable BT_CTRL
and associated options. Nordic already enables BT_CTRL
for the upstream open source split link layer, as well for their downstream closed source SoftDevice controller, but no other HCI driver does this at the moment.
drivers/bluetooth/hci/hci_stm32wb0.c
Outdated
static uint8_t legacy_cmd_issued = FALSE, extended_cmd_issued = FALSE; | ||
uint8_t allowed = TRUE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't these bool
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@erwango Is this still for v4.0.0? |
@alwa-nordic Indeed, this will rather go in v4.1.0. We identified a late license issue. This is now fixed but too late for v4.0.0 |
@HoZHel Would you mind rebasing ? |
I'm waiting for the merge on hal_stm32 side. After that, I'll rebase and fix the SHA for |
Introduce Kconfig parameter for STM32WB0x HCI Bluetooth driver. Signed-off-by: Ali Hozhabri <[email protected]>
Add a yaml file required by STM32WB0x bluetooth HCI driver. Signed-off-by: Ali Hozhabri <[email protected]>
Add Bluetooth HCI driver for STM32WB0x series. Modify CMakeLists.txt to compile the driver based on its kconfig parameter. Signed-off-by: Ali Hozhabri <[email protected]>
Add BLE feature to STM32WB0x series at SOC level. Signed-off-by: Ali Hozhabri <[email protected]>
Dedicate RAM section on STM32WB0x for BLE part based on the number of radio tasks and device type. Signed-off-by: Ali Hozhabri <[email protected]>
…UPDATE Put the default value for BT_AUTO_PHY_UPDATE and BT_AUTO_DATA_LEN_UPDATE to "n" at SOC level since they cause "controller busy" due to starting several parallel BLE procedures during connection by "perform_auto_initiated_procedures" function. At the moment, ST controller does not support parallelism, i.e. host should not initiate a new procedure before previous one is completed. Disable CONFIG_BT_HCI_ACL_FLOW_CONTROL at SOC level. Signed-off-by: Ali Hozhabri <[email protected]>
Enable BLE feature for Nucleo-WB09KE and Nucleo-WB05KZ. Dedicate 32KB and 8KB at the end of flash memory to storage partition on Nucleo-WB09KE and Nucleo-WB05KZ respectively. Add ble tag to the both devices yaml file. Signed-off-by: Ali Hozhabri <[email protected]>
6b6751b
to
7a7ae2f
Compare
Rebased to resolve conflict with |
Modify west.yaml to update hal_stm32. Signed-off-by: Ali Hozhabri <[email protected]>
7a7ae2f
to
4d09440
Compare
Updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
Provide BLE support for STM32WB0x:
Prior building a Zephyr BLE application, user should run
west blobs fetch hal_stm32
to fetch binary blob so as to provide BLE controller support.BLOB request: #79652 (TSC Approved on 23/10/24)
hal_stm32: zephyrproject-rtos/hal_stm32#236