Skip to main content
Mickael1
Associate
October 14, 2022
Solved

Trouble exporting BLE server from Nucleo to custom board.

  • October 14, 2022
  • 3 replies
  • 1679 views

Hello,

Working on a custom BLE server (peripheral role), I face a trouble exporting the working sources from a Nucleo project (STM32WB55) to a custom board (STM32WB55) project.

Everything is working fine on the Nucleo: advertissing, connection, bidirectional communication etc...

On the custom board, the BLE master sees the advertissing slave, but there is no way to connect to it. It fails connecting!

2 softwares were used on the Master side: ST BLE Toolbox and nRF Connect. Both give same results.

The nRF connect show an additional log error 133(0x85): GATT Error.

The custom board does not implement LSE crystal. HSE is used instead. I follow this URL but cannot find CFG_BLE_LSE_SOURCE in BLE configuration.

(community.st.com/s/article/configuring-stm32wb-for-bluetooth-le-without-an-lse-crystal).

I was expecting a trouble from this point, and found several ticket on the knowledge base, but no one have solution:

- community.st.com/s/question/0D50X0000C3BaK3SQK/migration-from-nucleo-to-my-own-board-doesnt-work

- st.force.com/community/s/question/0D53W000006qrigSAA/stm32wb55-pnucleowb55-advertising-works-but-i-cant-connect-when-building-application-using-code-generated-by-cubemx

No uart debug is possible on the custom board. Is there a way to use custom server application debug trace though STLink/JTAG?

The following items were verified on the custom board:

- Master clock is the expected one, verified on MCO pin.

- The application heartbeat is the expected. The system boot properly as well as the BLE full firmware stack.

- Debugging though STlink/JTAG is working.

- The RTC_WKUP_IRQHandler is verified woked up every 100ms (by toggling a pin).

- The advertising name, device type, tx power level and flags are properly received on the BLE master.

- Connect and Disconnect requests from master trigger the slave to go through Custom_APP_Notification CUSTOM_CONN_HANDLE_EVT and CUSTOM_DISCON_HANDLE_EVT cases on the custom application. This looks like a timeout is triggered on the master, not receiving properly the connection request.

Do you have any clue to help debug the situation?

This topic has been closed for replies.
Best answer by Remy ISSALYS

Hello,

Since your custom board doesn't implement LSE, you should use HSE/1024 for RF wakeup clock, and for this, you should enable the calibration for the RF system wakeup clock source in STM32CubeWB package v1.14.1, so you should have this configuration:

/**
 * LsSource
 * Some information for Low speed clock mapped in bits field
 * - bit 0: 1: Calibration for the RF system wakeup clock source 0: No calibration for the RF system wakeup clock source
 * - bit 1: 1: STM32W5M Module device 0: Other devices as STM32WBxx SOC, STM32WB1M module
 */
 
#if defined(STM32WB5Mxx)
 #define CFG_BLE_LSE_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LSE_CALIB | SHCI_C2_BLE_INIT_CFG_BLE_LSE_MOD5MM_DEV)
#else
 #define CFG_BLE_LSE_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LSE_CALIB | SHCI_C2_BLE_INIT_CFG_BLE_LSE_OTHER_DEV)
#endif

Best Regards

3 replies

Remy ISSALYS
Remy ISSALYSBest answer
ST Technical Moderator
October 19, 2022

Hello,

Since your custom board doesn't implement LSE, you should use HSE/1024 for RF wakeup clock, and for this, you should enable the calibration for the RF system wakeup clock source in STM32CubeWB package v1.14.1, so you should have this configuration:

/**
 * LsSource
 * Some information for Low speed clock mapped in bits field
 * - bit 0: 1: Calibration for the RF system wakeup clock source 0: No calibration for the RF system wakeup clock source
 * - bit 1: 1: STM32W5M Module device 0: Other devices as STM32WBxx SOC, STM32WB1M module
 */
 
#if defined(STM32WB5Mxx)
 #define CFG_BLE_LSE_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LSE_CALIB | SHCI_C2_BLE_INIT_CFG_BLE_LSE_MOD5MM_DEV)
#else
 #define CFG_BLE_LSE_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LSE_CALIB | SHCI_C2_BLE_INIT_CFG_BLE_LSE_OTHER_DEV)
#endif

Best Regards

Mickael1
Mickael1Author
Associate
October 19, 2022

Dear Remy,

This is it!

Thank you so much.

One thing to take care:

CubeMX generates the SHCI_C2_BLE_INIT_CFG_BLE_LSE_NOCALIB for CFG_BLE_LSE_SOURCE, even when HSE/1024 is seleted.

The correction of the RF system wake up clock source calibration needs to be handled manually after cubeMx code generation, between USER CODE BEGIN/END.

Sincerely

Remy ISSALYS
ST Technical Moderator
October 19, 2022

Hi,

Yes, you have right, in the next release (v1.15.0), the define CFG_BLE_LSE_SOURCE will be managed by cubeMX according to RF system wake up clock configuration.

Best Regards