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

samples/bluetooth/hci_pwr_ctrl stack overflow on nRF52DK_nRF52832 #31433

Closed
cederom opened this issue Jan 19, 2021 · 2 comments · Fixed by #31869
Closed

samples/bluetooth/hci_pwr_ctrl stack overflow on nRF52DK_nRF52832 #31433

cederom opened this issue Jan 19, 2021 · 2 comments · Fixed by #31869
Assignees
Labels
area: Bluetooth area: Samples Samples bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@cederom
Copy link

cederom commented Jan 19, 2021

Describe the bug
Random stack overflow on CPU 0 jumps in when running samples / bluetooth / hci_pwr_ctrl on nRF52DK (nRF52832). It happens once per day.

To Reproduce
Steps to reproduce the behavior:

  1. cd $ZEPHYR_BASE/samples/bluetooth/hci_pwr_ctrl
  2. west build -b nrf52dk_nrf52832
  3. Flash firmware.
  4. Watch console logging output and observe random stack overflows :-)

Expected behavior
Sample application does not crash.

Impact
Sample program contains bug. I am not sure if this is setup (stack size build time configuration) or HCI Bluetooth stack bug.

Logs and console output

*** Booting Zephyr OS build zephyr-v2.4.0-2806-gdb5270bd933c  ***
Starting Dynamic Tx Power Beacon Demo
Bluetooth initialized
Dynamic Tx power Beacon started
Get Tx power level ->-> default TXP = 0
[00:00:00.270,904] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.270,904] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.270,935] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 2.4 Build 99
[00:00:00.271,606] <inf> bt_hci_core: Identity: F1:E8:9E:D0:47:0E (random)
[00:00:00.271,636] <inf> bt_hci_core: HCI: version 5.2 (0x0b) revision 0x0000, manufacturer 0x05f1
[00:00:00.271,636] <inf> bt_hci_core: LMP: version 5.2 (0x0b) subver 0xffff

...

Get Tx power level -> TXP = 0
Set Tx power level to -3
Actual Tx Power: -4
Get Tx power level -> TXP = -4
Set Tx power level to -8
Actual Tx Power: -8
Get Tx power level -> TXP = -8
Set Tx power level to -15
Actual Tx Power: -16

...

[00:50:19.449,462] <err> os: ***** MPU FAULT *****
[00:50:19.449,462] <err> os:   Stacking error (context area might be not valid)
[00:50:19.449,462] <err> os: r0/a1:  0xffeffc9f  r1/a2:  0x20229f00  r2/a3:  0xfffaefdf
[00:50:19.449,493] <err> os: r3/a4:  0x82080041 r12/ip:  0xeeb7fad6 r14/lr:  0x20204101
[00:50:19.449,493] <err> os:  xpsr:  0x4c904800
[00:50:19.449,493] <err> os: Faulting instruction address (r15/pc): 0x2fe7dfe3
[00:50:19.449,493] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
[00:50:19.449,493] <err> os: Current thread: 0x20000810 (unknown)
[00:50:20.150,115] <err> os: Halting system

Environment (please complete the following information):

  • OS: FreeBSD 12.2-RELEASE-p1
  • Toolchain: arm-none-eabi-gcc (GNU Arm Embedded Toolchain) 9.3.1 20200408 (release)
  • Commit: db5270bd933cc2e7b222f93a791a9351157c3ce0 (HEAD -> master, origin/master)

Additional context
Crash always happens at that exact PC location.
Its nice to see my first Zephyr kernel crash :-) :-)

@cederom cederom added the bug The issue is a bug, or the PR is fixing a bug label Jan 19, 2021
@ioannisg ioannisg added the priority: medium Medium impact/importance bug label Jan 23, 2021
@nashif
Copy link
Member

nashif commented Jan 26, 2021

@carlescufi please assign

@carlescufi carlescufi added priority: low Low impact/importance bug area: Bluetooth area: Samples Samples and removed priority: medium Medium impact/importance bug labels Jan 26, 2021
@carlescufi carlescufi assigned joerchan and unassigned carlescufi Jan 26, 2021
joerchan added a commit to joerchan/zephyr that referenced this issue Feb 2, 2021
Fix stack overflow in the TX power control sample.
Current stack usage with 0.11.1 zephyr toolchain was at 100% stack
usage of the DYN TX stack.

Fixes: zephyrproject-rtos#31433

Signed-off-by: Joakim Andersson <[email protected]>
nashif pushed a commit that referenced this issue Feb 2, 2021
Fix stack overflow in the TX power control sample.
Current stack usage with 0.11.1 zephyr toolchain was at 100% stack
usage of the DYN TX stack.

Fixes: #31433

Signed-off-by: Joakim Andersson <[email protected]>
@cederom
Copy link
Author

cederom commented Feb 2, 2021

Thank you! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth area: Samples Samples bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants