Title: [Bug]: [BLE_HeartRateFreeRTOS] Temperature-based radio calibration silently fails after the first measurement: critical section makes ADCCTRL mutex return osErrorISR · Issue #11 · STMicroelectronics/STM32CubeWBA · GitHub
Open Graph Title: [Bug]: [BLE_HeartRateFreeRTOS] Temperature-based radio calibration silently fails after the first measurement: critical section makes ADCCTRL mutex return osErrorISR · Issue #11 · STMicroelectronics/STM32CubeWBA
X Title: [Bug]: [BLE_HeartRateFreeRTOS] Temperature-based radio calibration silently fails after the first measurement: critical section makes ADCCTRL mutex return osErrorISR · Issue #11 · STMicroelectronics/STM32CubeWBA
Description: Bug Summary With USE_TEMPERATURE_BASED_RADIO_CALIBRATION enabled, the link-layer temperature measurement succeeds exactly once (during init, before the scheduler runs) and silently fails on every subsequent request. The radio therefore k...
Open Graph Description: Bug Summary With USE_TEMPERATURE_BASED_RADIO_CALIBRATION enabled, the link-layer temperature measurement succeeds exactly once (during init, before the scheduler runs) and silently fails on every s...
X Description: Bug Summary With USE_TEMPERATURE_BASED_RADIO_CALIBRATION enabled, the link-layer temperature measurement succeeds exactly once (during init, before the scheduler runs) and silently fails on every s...
Opengraph URL: https://github.com/STMicroelectronics/STM32CubeWBA/issues/11
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: [BLE_HeartRateFreeRTOS] Temperature-based radio calibration silently fails after the first measurement: critical section makes ADCCTRL mutex return osErrorISR","articleBody":"### Bug Summary\n\nWith `USE_TEMPERATURE_BASED_RADIO_CALIBRATION` enabled, the link-layer temperature measurement succeeds exactly once (during init, before the scheduler runs) and silently fails on every subsequent request. The radio therefore keeps using the boot-time temperature for calibration.\n\n### Detailed Description\n\n- `ll_intf_cmn_set_temperature_value()` is called only once, at init.\n- Afterwards the path `ll_sys_request_temperature()` -> semaphore release ->\n `TempMeasureLL_Task` -> `TEMPMEAS_RequestTemperatureMeasurement()` runs, but\n `ADCCTRL_RequestTemperature()` returns ADCCTRL_NOK (1) and the temperature\n value is never updated. No error is reported anywhere: return codes are\n discarded and BLE keeps working normally.\n\n### Expected Behavior\n\nRemove the outer `UTILS_ENTER_LIMITED_CRITICAL_SECTION()/EXIT` pair in `TEMPMEAS_RequestTemperatureMeasurement()`. The RCC-sensitive sequences it was protecting are already protected by their own `UTILS_ENTER_CRITICAL_SECTION()` inside `AdcActivate()`/`AdcDeactivate()`/`ADCCTRL_RequestIpState()` (Projects/Common/WPAN/Modules/adc_ctrl.c), and cross-client serialization is provided by the ADCCTRL mutex itself. (Alternative: make `ADCCTRL_MutexTake()` aware of the masked state, but an RTOS mutex cannot be acquired safely while BASEPRI/PRIMASK masking is active, so removing the outer section is the cleaner fix.)\n\n### Actual Behavior\n\n`TEMPMEAS_RequestTemperatureMeasurement()` in `Projects/Common/WPAN/Modules/temp_measurement.c` wraps the ADCCTRL calls in: UTILS_ENTER_LIMITED_CRITICAL_SECTION(RCC_INTR_PRIO\u003c\u003c4); /* sets BASEPRI */ `ADCCTRL_MutexTake()` in `Projects/.../Core/Src/app_entry.c` calls `osMutexAcquire(adcCtrlMutex, osWaitForever)` whenever the scheduler is running. The CMSIS-RTOS2 FreeRTOS adapter (cmsis_os2.c) treats the \"interrupts masked\" state as ISR context (`IRQ_Context()` -> `IS_IRQ_MASKED()`, PRIMASK or BASEPRI set), so `osMutexAcquire()` returns `osErrorISR` -> `ADCCTRL_MutexTake()` returns `ADCCTRL_NOK` -> every `ADCCTRL_Request*()` that takes the mutex is rejected. The first measurement works only because `ADCCTRL_MutexTake()` short-circuits to OK when `xTaskGetSchedulerState() != taskSCHEDULER_RUNNING`, i.e. during early init. The ThreadX example variant (BLE_HeartRateThreadX) shares the same temp_measurement.c but is unaffected, because `tx_mutex_get()` does not reject calls made with interrupts masked - which likely explains how the shared module shipped broken for FreeRTOS.\n\n### Environment\n\n- STM32CubeWBA V1.9.0 - Example: Projects/NUCLEO-WBA65RI/Applications/BLE/BLE_HeartRateFreeRTOS - Board/chip: NUCLEO-WBA65RI, STM32WBA65 - RTOS: FreeRTOS + CMSIS-RTOS2 (cmsis_os2.c adapter) - Config: USE_TEMPERATURE_BASED_RADIO_CALIBRATION = 1, ADCCTRL_USE_DYNAMIC_VREF = 1\n\n### Severity\n\nNone","author":{"url":"https://github.com/ARON6666666","@type":"Person","name":"ARON6666666"},"datePublished":"2026-11-19T02:55:56Z","url":"https://github.com/STMicroelectronics/STM32CubeWBA/issues/11"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:358a9571-cd65-1d20-2d88-2e987b721333 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 88DE:7F1CA:6B772:94147:6B05774B |
| html-safe-nonce | 9f2d9826d34ed5bb165c7bdeaafa1a6728c390461bffb9a153ae0ae2e6132caa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OERFOjdGMUNBOjZCNzcyOjk0MTQ3OjZCMDU3NzRCIiwidmlzaXRvcl9pZCI6IjI5ODcyNTMyMzA1MTU2MTU1NjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ee7f5c386dd04e804e2faa0eba8c785935f029346a31f82bfc7b25fc11d31d23 |
| hovercard-subject-tag | issue:6481340191 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/STMicroelectronics/STM32CubeWBA/11/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1bf160a56c6c66313d6ecd16667bf4339f81f0e13c8aee3f634f020c2db9aa1f/STMicroelectronics/STM32CubeWBA/issues/11 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1bf160a56c6c66313d6ecd16667bf4339f81f0e13c8aee3f634f020c2db9aa1f/STMicroelectronics/STM32CubeWBA/issues/11 |
| og:image:alt | Bug Summary With USE_TEMPERATURE_BASED_RADIO_CALIBRATION enabled, the link-layer temperature measurement succeeds exactly once (during init, before the scheduler runs) and silently fails on every s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ARON6666666 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 507b2d62524c0f595c35a2a2ee8a6ec54b119f245b3c59eaa070013b70ed1ada |
| turbo-cache-control | no-preview |
| go-import | github.com/STMicroelectronics/STM32CubeWBA git https://github.com/STMicroelectronics/STM32CubeWBA.git |
| octolytics-dimension-user_id | 10744877 |
| octolytics-dimension-user_login | STMicroelectronics |
| octolytics-dimension-repository_id | 610889875 |
| octolytics-dimension-repository_nwo | STMicroelectronics/STM32CubeWBA |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 610889875 |
| octolytics-dimension-repository_network_root_nwo | STMicroelectronics/STM32CubeWBA |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e7a883ae3b439b8952652eaa7803e2587f30e339 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width