2025-04-28 5:58 AM
Hi guys,
I'm working on a pretty simple cable replacement client/server program to exchange data form one device to another.
When I enable traces in CubeMX for the WPAN/BLE part, my STM32WB5 is visible (I can see it from my phone or using a Nordic USB Dongle, connect to it and exchange data). All traces go to USART1.
Then, since everything works, I disable traces (CFG_HW_USART1_ENABLED to Disabled, CFG_DEBUG_* to Disabled, BLE_DBG_APP_EN to Disabled, etc.). At this point, I can't see anymore my device in the phone list even tough aci_gap_set_discoverable returns 0.
I don’t understand how disabling traces can prevent the rest of the BLE stack from running.
Any help on this would be appreciated.
Thx !
Solved! Go to Solution.
2025-04-30 1:10 AM
Some news about this issue: I completly restart my project from scratch (was previoulsy migrated from some older version of CubeMX) and I integrated my code step by step. It works now with the exact same code on my side and the exact same config in CubeMX.
Probably a bug (again...) in CubeMX generated code. I still do not understand why it did not work...
Thank you your help @STTwo-32
2025-04-28 10:02 AM - edited 2025-04-28 10:02 AM
Hello @GuilhemG
Without CFG_DEBUGGER_SUPPORTED, CFG_DEBUG_BLE_TRACE and CFG_DEBUG_APP_TRACE defines, the UART is not configured, then each access to the UART for any printf or traces are forbidden to do not generate some hardfault. CFG_DEBUG_BLE_TRACE and CFG_DEBUG_APP_TRACE defines can be disabled with the CFG_DEBUGGER_SUPPORTED define enabled. CFG_DEBUG_BLE_TRACE and CFG_DEBUG_APP_TRACE defines cannot be enabled without the CFG_DEBUGGER_SUPPORTED define enabled. This is managed with the following lines of the app_conf.h file:
#if ( (CFG_DEBUG_BLE_TRACE != 0) || (CFG_DEBUG_APP_TRACE != 0) )
#define CFG_DEBUG_TRACE 1
#endif
#if (CFG_DEBUG_TRACE != 0)
#undef CFG_LPM_SUPPORTED
#undef CFG_DEBUGGER_SUPPORTED
#define CFG_LPM_SUPPORTED 0
#define CFG_DEBUGGER_SUPPORTED 1
#endif
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-04-28 11:38 PM - edited 2025-04-28 11:43 PM
Thank you for your help ! But looks like it not answers my question though.
My current config is the following one:
- All CFG_HW_LP_* => Disabled
- All CFG_HW_US_* => Disabled
- CFG_DEBUGGER_SUPPORTED => Enabled (to be able to debug with some breakpoints)
- All CFG_DEBUG_* => Disabled
- BLE_DBG_APP_EN => Disabled
- USART1 is used in my custom app to exchange some data with a custom board so I don't want to use it to debug the BLE stuffs.
In this configuration, my device is not visible (I mean I cannot see it in ST BLE Toolbox smartphone app or in nRF Connect with my Nordic Dongle).
If, I enable again all the previous defines to get the traces on USART1, the Bluetooth is ok and I'm able to see (and exchange data) with the module.
So, looks like there is something missing in the CubeMX generated code to get a working Bluetooth communication without debug traces.
Here are some other interesting points:
- BLE Wireless Stack: FULL
- BLE Application Type: Server Profile
- Custom Template: Enabled
2025-04-29 12:25 AM - edited 2025-04-29 12:25 AM
I've personally tested on my side (using the NUCLEO-WB55 and the P2P_Server example, and I can't reproduce it. Do you have the same behavior will USART1 is Disabled. For me the only use case I've found that is similar to this behavior is the one I've described on the first comment.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-04-29 1:39 AM
I also tried with my NUCLEO-WB55 and I can't reproduce it either... So now I have to find the difference between the generated code for the nucleo and the one generated for the MCU only. Thanks for your help
2025-04-30 1:10 AM
Some news about this issue: I completly restart my project from scratch (was previoulsy migrated from some older version of CubeMX) and I integrated my code step by step. It works now with the exact same code on my side and the exact same config in CubeMX.
Probably a bug (again...) in CubeMX generated code. I still do not understand why it did not work...
Thank you your help @STTwo-32