Skip to content
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

Zephyr 3.7 RC2 BLE on STM32 Nucleo WB55 does not work #75318

Closed
piotrParf opened this issue Jul 2, 2024 · 18 comments · Fixed by #76577
Closed

Zephyr 3.7 RC2 BLE on STM32 Nucleo WB55 does not work #75318

piotrParf opened this issue Jul 2, 2024 · 18 comments · Fixed by #76577
Assignees
Labels
area: Bluetooth bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: medium Medium impact/importance bug

Comments

@piotrParf
Copy link

Describe the bug
I am using Zephyr 3.7 RC2 but the issue is vissible also with 3.7 RC1.
I am trying if everything still works for the STM32WB55 device. I am using STM32 Nucleo WB55.
I checked radio firmware stm32wb5x_BLE_HCILayer_fw.bin in version 1.18.0 from STM32WB Copro Wireless Binaries.
The issue is visible with the radio version 1.19.1 and also with the firmware file stm32wb5x_BLE_HCILayer_extended_fw.bin.
Demos with BLE do not work on STM32 Nucleo WB55. I have also my own application but also demo iBeacon does not work.

The issue seems coming from the bt_ipm_ble_init function.

It was working with Zephyr 3.4 when I last checked.

To Reproduce
Have radio firmware loaded with radio fw.
Build the "zephyr/samples/bluetooth/ibeacon" demo for -DBOARD=nucleo_wb55rg flash and run.

Expected behavior
Working demo and visible iBeacon node on BLE scanner.

Impact
BLE on STM32 Nucleo WB55 does not work.

Logs and console output
When I read the log I got the below report:

*** Booting Zephyr OS build v3.7.0-rc1-588-g40810983ead2 ***
Starting iBeacon Demo
E: ***** USAGE FAULT *****
E:   Illegal use of the EPSR
E: r0/a1:  0x080094f4  r1/a2:  0x20002ac8  r2/a3:  0x00080000
E: r3/a4:  0x00000000 r12/ip:  0x20000224 r14/lr:  0x080035b1
E:  xpsr:  0x20000000
E: Faulting instruction address (r15/pc): 0x00000000
E: >>> ZEPHYR FATAL ERROR 35: Unknown error on CPU 0
E: Current thread: 0x20000490 (unknown)
E: Halting system

Environment (please complete the following information):
Linux Debian 11
CMake version: 3.21.0
Zephyr version: 3.7.0-rc2
west 1.2.0
host-tools: zephyr 0.16.1
toolchain: zephyr 0.16.1

@piotrParf piotrParf added the bug The issue is a bug, or the PR is fixing a bug label Jul 2, 2024
@aescolar aescolar added the platform: STM32 ST Micro STM32 label Jul 2, 2024
@ajarmouni-st
Copy link
Collaborator

Hi @piotrParf, have you seen?

Note that since STM32WB Cube package V1.13.2, "full stack" binaries are not compatible
anymore for a use in Zephyr and only "HCI Only" versions should be used on the M0
side.

@piotrParf
Copy link
Author

@ajarmouni-st
As I mentioned in bug description I tried stm32wb5x_BLE_HCILayer_fw.bin and stm32wb5x_BLE_HCILayer_extended_fw.bin from packages in version 1.18.0 and 1.19.1. Both firmwares are HCI only. Firmware 1.18.0 works with Zephyr 3.4 (our current base which we want to migrate to new version).

@erwango
Copy link
Member

erwango commented Jul 2, 2024

^^@asm5878

@erwango erwango added the priority: medium Medium impact/importance bug label Jul 2, 2024
@asm5878
Copy link
Collaborator

asm5878 commented Jul 4, 2024

^^@JoeGitST

@asm5878
Copy link
Collaborator

asm5878 commented Jul 4, 2024

Thanks to @JoeGitST we have identified the commit causing the regression:
501e715

Investigation is on going

@asm5878
Copy link
Collaborator

asm5878 commented Jul 8, 2024

^^ @jhedberg

@asm5878
Copy link
Collaborator

asm5878 commented Jul 8, 2024

After the update of BLE HCI API drivers we have realized we have an issue in management of TX/RX HCI commands.
The first HCI cmd (any) is causing an usage fault.

Investigation will continue to clearly analyze the root cause.

@jhedberg
Copy link
Member

jhedberg commented Jul 8, 2024

@asm5878 I took a quick look at the driver code, and it seems like the core issue is likely that the driver attempts to send HCI commands inside bt_ipm_open(). No driver should do that, since from the perspective of the host (which owns the bt_hci_cmd_send*() APIs) the HCI transport is functional only after the drivers's open() callback has successfully returned. What the driver should instead do is to implement a setup() callback (which gets called by the host immediately after open()) and perform any HCI command sending from within that callback instead.

@jhedberg
Copy link
Member

jhedberg commented Jul 8, 2024

@asm5878 the exact failure is probably simply that the driver hasn't yet set its hci->recv callback pointer before it attempts to send HCI commands (recv() is needed to pass the command completion events to the host), however even if you fixed that it's not right for the driver to call any HCI command APIs from open() rather those should be moved into setup().

@jhedberg
Copy link
Member

jhedberg commented Jul 8, 2024

@asm5878 also, this is not the first HCI driver to have such a bug, take a look e.g. at #73711 for a recent similar fix.

@jhedberg
Copy link
Member

@asm5878 @erwango are you able to submit a fix based on my feedback? The fix itself should be fairly quick & simple but at least I'm not able create it as I'm on vacation this and next week. For the fix to make it to 3.7 it needs to be submitted latest today (two days review time and rc3 is coming on Friday).

@asm5878
Copy link
Collaborator

asm5878 commented Jul 11, 2024

Hello @jhedberg,
I was off for a couple of days.
We will try our best (according our current priorities) to offer a solution ASAP.

Thanks for your precious feedback

@FRASTM
Copy link
Collaborator

FRASTM commented Jul 17, 2024

@asm5878 do you have a fix ready ?

@asm5878
Copy link
Collaborator

asm5878 commented Jul 22, 2024

@FRASTM we have a potential fix. Unlocking the regression but with warning/errors.
I will check directly and I'll let you know

@asm5878
Copy link
Collaborator

asm5878 commented Jul 26, 2024

Dear All,

Status update:

We had some regressions due to Zephyr BLE updates.
Now we have a working patch.
BLE works as expected.
But still some issue just after connection:

Connected
[00:03:44.083,000] bt_hci_core: opcode 0x2016 status 0x3a
[00:03:44.083,000] bt_hci_core: Failed read remote features (-5)

Attached you can find a patch unlocking the BLE behavior (thanks @JoeGitST ).
STM32WB_BLE_Unlock.patch

M0 binary FW tested is:
https://github.com/STMicroelectronics/STM32CubeWB/blob/v1.19.1/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x/stm32wb5x_BLE_HCILayer_fw.bin

asm5878 added a commit to asm5878/zephyr that referenced this issue Aug 1, 2024
Implementing HCI setup function to have a correct and proper
initialization procedure to fix zephyrproject-rtos#75318 issue

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
asm5878 added a commit to asm5878/zephyr that referenced this issue Aug 1, 2024
Enabling BT_HCI_SET_PUBLIC_ADDR for STM32WB55 to have a
correct and proper initialization procedure to fix
zephyrproject-rtos#75318 issue

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
asm5878 added a commit to asm5878/zephyr that referenced this issue Aug 1, 2024
Implementing HCI setup function to have a correct and proper
initialization procedure to fix zephyrproject-rtos#75318 issue

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
asm5878 added a commit to asm5878/zephyr that referenced this issue Aug 1, 2024
Enabling BT_HCI_SETUP for STM32WB55 to have a
correct and proper initialization procedure to fix
zephyrproject-rtos#75318 issue

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
carlescufi pushed a commit that referenced this issue Aug 5, 2024
Enabling BT_HCI_SETUP for STM32WB55 to have a
correct and proper initialization procedure to fix
#75318 issue

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
zephyrbot pushed a commit that referenced this issue Aug 5, 2024
Implementing HCI setup function to have a correct and proper
initialization procedure to fix #75318 issue

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
(cherry picked from commit 7ca2072)
zephyrbot pushed a commit that referenced this issue Aug 5, 2024
Enabling BT_HCI_SETUP for STM32WB55 to have a
correct and proper initialization procedure to fix
#75318 issue

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
(cherry picked from commit 4fc7724)
@erwango erwango reopened this Aug 5, 2024
@jhedberg
Copy link
Member

jhedberg commented Aug 5, 2024

@erwango why did you reopen this?

@jhedberg
Copy link
Member

jhedberg commented Aug 5, 2024

@erwango why did you reopen this?

E.g. I don't think the backport requires this to be open, rather it's sufficient that there is evidence (i.e. this original issue) that there was a bug that needed fixing.

@erwango
Copy link
Member

erwango commented Aug 5, 2024

E.g. I don't think the backport requires this to be open, rather it's sufficient that there is evidence (i.e. this original issue) that there was a bug that needed fixing.

Oh, ok. I'll close it then. Thanks

@erwango erwango closed this as completed Aug 5, 2024
nashif pushed a commit that referenced this issue Aug 6, 2024
Implementing HCI setup function to have a correct and proper
initialization procedure to fix #75318 issue

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
(cherry picked from commit 7ca2072)
nashif pushed a commit that referenced this issue Aug 6, 2024
Enabling BT_HCI_SETUP for STM32WB55 to have a
correct and proper initialization procedure to fix
#75318 issue

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
(cherry picked from commit 4fc7724)
topisani pushed a commit to topisani/zephyr that referenced this issue Aug 28, 2024
Implementing HCI setup function to have a correct and proper
initialization procedure to fix zephyrproject-rtos#75318 issue

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
(cherry picked from commit 7ca2072)
topisani pushed a commit to topisani/zephyr that referenced this issue Aug 28, 2024
Enabling BT_HCI_SETUP for STM32WB55 to have a
correct and proper initialization procedure to fix
zephyrproject-rtos#75318 issue

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
(cherry picked from commit 4fc7724)
Chenhongren pushed a commit to Chenhongren/zephyr that referenced this issue Aug 29, 2024
Implementing HCI setup function to have a correct and proper
initialization procedure to fix zephyrproject-rtos#75318 issue

(cherry picked from commit 7ca2072)

Original-Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
GitOrigin-RevId: 7ca2072
Cr-Build-Id: 8740450565536499009
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8740450565536499009
Change-Id: I4c3a74a8b336f136c54048bd08d58da665c0962f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5762726
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Chenhongren pushed a commit to Chenhongren/zephyr that referenced this issue Aug 29, 2024
Enabling BT_HCI_SETUP for STM32WB55 to have a
correct and proper initialization procedure to fix
zephyrproject-rtos#75318 issue

(cherry picked from commit 4fc7724)

Original-Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
GitOrigin-RevId: 4fc7724
Cr-Build-Id: 8740450565536499009
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8740450565536499009
Change-Id: Ie3525142aab6a256efb219867b61528cd71988d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5762727
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants