Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

extmod/nimble: Add timeout to deinit.#17247

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
andrewleech wants to merge2 commits intomicropython:master
base:master
Choose a base branch
Loading
fromandrewleech:nimble_deinit_timeout

Conversation

andrewleech
Copy link
Contributor

Summary

If the BLE radio stops responding before deinit is called the function can get stuck waiting for an event that is never received, particularly if the radio is external or on a separate core.

This PR adds a timeout, similar to the timeout already used in the init function. That init function timeout was also
simplified as part of this change.

Relates to#17246

Testing

This has been tested on a stm32wb55 where the deinit was intermittently locking up waiting for the state to change.
This happened on a semi-regular basis on an application automated test suite which was running through hundreds of cycles over a number of hours.

Trade-offs and Alternatives

The main alternative to this is relying on watchdog to break the unit out of the infinite C loop once the failure occurs, but this is not appropriate for all applications.

@codecovCodecov
Copy link

codecovbot commentedMay 5, 2025
edited
Loading

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.54%. Comparing base(bee1fd5) to head(5ddd3d2).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@##           master   #17247   +/-   ##=======================================  Coverage   98.54%   98.54%           =======================================  Files         169      169             Lines       21890    21898    +8     =======================================+ Hits        21572    21580    +8  Misses        318      318

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actionsGitHub Actions
Copy link

github-actionsbot commentedMay 5, 2025
edited
Loading

Code size report:

   bare-arm:    +0 +0.000% minimal x86:    +0 +0.000%    unix x64:    +0 +0.000% standard      stm32:    +0 +0.000% PYBV10     mimxrt:    +0 +0.000% TEENSY40        rp2:    +8 +0.001% RPI_PICO_W       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS  qemu rv32:    +0 +0.000% VIRT_RV32

@@ -629,13 +641,12 @@ int mp_bluetooth_init(void) {

// Run the scheduler while we wait for stack startup.
// On non-ringbuffer builds (NimBLE on STM32/Unix) this will also poll the UART and run the event queue.
mp_uint_ttimeout_start_ticks_ms = mp_hal_ticks_ms();
volatilemp_uint_tstart = mp_hal_ticks_ms();
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

volatile wasn't meant to be left here, I'll remove

@dpgeorgedpgeorge added the extmodRelates to extmod/ directory in source labelMay 6, 2025
@andrewleech
Copy link
ContributorAuthor

Should extend this to more closely match the init functionality with regard to raising exceptions on failure

@andrewleechandrewleechforce-pushed thenimble_deinit_timeout branch 2 times, most recently fromb4e4528 tod33dd07CompareMay 6, 2025 23:44
If the BLE radio stops responding before deinit is called thefunction can get stuck waiting for an event that is never received,particularly if the radio is external or on a separate core.Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
extmodRelates to extmod/ directory in source
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@andrewleech@dpgeorge@pi-anl

[8]ページ先頭

©2009-2025 Movatter.jp