2021-10-03 03:37 PM
I have an STM32WB55 board. I used the CUBEMX to generate a template that both activates the internal temperature sensor and BLE module.
However, if I ran the program generated, it will be blocked in the "hw_timeserver.c" at line 566, which is:
while(__HAL_RTC_WAKEUPTIMER_GET_FLAG(phrtc, RTC_FLAG_WUTWF) == RESET)
If I turn the ADC off, the program will start properly, and I am able to scan and connect. the problem seems relative to the clock configuration, but I have no idea how to debug it.
I attached my CUBEMX setting file. Can anyone helps me find the problem?
2021-10-26 05:53 AM
Hello,
Could you please provide us with the software's versions that you are using ( STM32CubeMX, Firmware, IDE..)
Best Regards,
Sara
2021-10-26 11:10 PM
I use CubeIde 1.7, the firmware version is STM32Cube_FW_WB_V1.12.1
2021-10-29 01:52 AM
I do not know if this is relevant to you @ZZou.1 but I discovered that using the latest versions of STM32CubeIDE and STM32Cube_FW_WB_V1.12.1 the timeserver does not get initialized with the RTC but during the call to MX_APPE_Init() which can cause a wakeup interrupt to be triggered and thus the RTC_WKUp_IRQ to be executed before the timeserver is initialized. This cause it to hang at the line you specified.
My quick fix is to initialize the timeserver with the RTC:
[file main.c, function MX_RTC_Init(); the exact file may vary depending on your code generation settings]
/* USER CODE BEGIN RTC_Init 2 */
HW_TS_Init(hw_ts_InitMode_Full, &hrtc);
/* USER CODE END RTC_Init 2 */
This ensure that when the first RTC WKUp interrupt is executed it will run correctly as the timeserver will be initialized.
I am not sure this is the best place to put this code but it does seems to do the trick. Maybe iy you have RTC WakeUp interrupts very frequently you might have to put this code at another place ?
Also, do not forget to remove the HW_TS_Init() function call from the MX_APPE_Init() function. You will have to remove it after every new code generation.
2021-11-02 10:10 PM
I also add ADC on temperature channel in project my_p2p_server4_ADC. Sometimes client doesn't see server. I pause debagger and see
"hw_timeserver.c" at line 411 (not 566 like @ZZou.1 ):
/**
* Wait for the flag to be back to 0 when the wakeup timer is enabled
*/
while(__HAL_RTC_WAKEUPTIMER_GET_FLAG(phrtc, RTC_FLAG_WUTWF) == SET);
CubeIde 1.7, the firmware version is STM32Cube_FW_WB_V1.12.1
PCB is MB1355C
Without ADC temperature channel works without this problem.
2022-02-04 04:07 AM
If anybody finds this post again and wants an answer, the bug might be related to the issue I opened on the github repository for STM32CubeWB. Several fixes are proposed. https://github.com/STMicroelectronics/STM32CubeWB/issues/52
2022-02-23 07:44 AM
Hello,
I have additional information, see my answer on this post:
Best Regards