cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB Fails on SHCI_C2_BLE_Init

WSH
Associate III

Hello! I'm working with a custom STM32WB10CCU board and can't seem to get BLE working.

Here are the details:

  • I have no LSE on the board.. just HSE. I'm configuring RFWKP to HSE/1024 and RTC to HSE/32 (I know that LSE is strongly recommended -.. but from what I've read it's not a hard req unless you want to go into certain sleep modes)
  • I'm using STM32WB v1.2 core and have IPCC enabled with the added RTC_WKUP_IRQHandler call that's supposed to be implemented as per every BLE workshop video/slide deck
  • I have a ST-Link V2 and I'm stepping through the code. It's going to my Error handler directly after running the SHCI_C2_BLE_Init because it fails.. Not sure why.
  • I used STM32CubeProgrammer to upload the latest Wireless Stack via FUS and ensured it was abled. When reading FUS info with wireless stack enabled I'm getting version: 4.0.0.c
  • Since I'm running RTC off of HSE, I had to add HAL_PWR_EnableBkUpAccess(); to my HAL_RTC_MspInit call or else RTC init times out and fails. I think this could possibly be related to my problem?
  • I'm using the peer2peer BLE service

I don't know what else to put since I haven't done anything outside of configure the project and add the HSE configuration via OTP and added the other interrupt handler.

I'm at a loss and don't know where to go from here.. I verified there isn't an issue with my 32MHz source by de-soldering it from the board to see that SystemClock_Config would fail -- and it does.

Is there any other way to test that the M0 is active and accepting commands? I have a feeling something is wrong it, but don't know how to debug from this point.

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
WSH
Associate III

I figured it out! The Init struct must have the header. The reason why I was getting the memory error was due to the STM32WB10's limited memory capacity and an improper CubeMx setup.

For anyone using the STM32WB10, please note you are limited in GATT/GAP services you can initialize. The default CubeMx BLE setup will initialize BLE as if it's for the STM32WB55. You can look at the STM32WB15's sample project setup for the proper settings.

View solution in original post

9 REPLIES 9
WSH
Associate III

After further debugging. The error code SHCI_C2_BLE_Init is returning is: 0x07. This isn't defined anywhere in the shci.h. What does this code mean?

WSH
Associate III

Sorry for continuously bumping this... Want to provide information as I come across it.. Incase it helps someone else or helps us to the solution.

I found AN5270 and the HCI Status Error Codes. 0x07 corresponds to "Memory Capacity Exceeded" error. Which in BLE Core Specification 5.2 Vol. 2 Part D is: "The memory capacity exceeded error code indicates to the host that the controller has run out of memory to store new parameters."

So this either means something is off with the STM32WB10CC's M0+'s firmware or the p2p server code for sending the BLE_Init CMD is too big.. Don't quite know which.

WSH
Associate III

Update #3:

Within app_ble.c I found that removing the header from SHCI_C2_Ble_Init_Cmd_Packet_t seems to make SHCI_C2_BLE_Init return a status code of 0x00. Here is my CMD Packet struct:

SHCI_C2_Ble_Init_Cmd_Packet_t ble_init_cmd_packet =
  {
    {0,                                 /** pBleBufferAddress not used */
    0,                                  /** BleBufferSize not used */
    CFG_BLE_NUM_GATT_ATTRIBUTES,
    CFG_BLE_NUM_GATT_SERVICES,
    CFG_BLE_ATT_VALUE_ARRAY_SIZE,
    CFG_BLE_NUM_LINK,
    CFG_BLE_DATA_LENGTH_EXTENSION,
    CFG_BLE_PREPARE_WRITE_LIST_SIZE,
    CFG_BLE_MBLOCK_COUNT,
    CFG_BLE_MAX_ATT_MTU,
    CFG_BLE_SLAVE_SCA,
    CFG_BLE_MASTER_SCA,
    1,
    CFG_BLE_MAX_CONN_EVENT_LENGTH,
    CFG_BLE_HSE_STARTUP_TIME,
    CFG_BLE_VITERBI_MODE,
    CFG_BLE_OPTIONS,
    0,
    CFG_BLE_MAX_COC_INITIATOR_NBR,
    CFG_BLE_MIN_TX_POWER,
    CFG_BLE_MAX_TX_POWER}
  };

With this... Still not able to see the p2p advertising.

WSH
Associate III

Update 4:

I connected this up to my oscilloscope and RF_1 is outputting nothing. So either, I some how managed to fry the internal radio or my code is a bust..

Guess I'll look through the BLE guides again while waiting for someone to assist. :)

WSH
Associate III

Update 5:

Further debugging is showing that the current lockup is within the ExitLowPower method. The STM32WB is getting stuck on releasing the semaphore.

  while( LL_HSEM_1StepLock( HSEM, CFG_HW_RCC_SEMID ) ); //FIX ME -- NOT RELEASING

This enters an infinite loop and the radio isn't even given a chance to turn on... I don't see any of the HSEM registers changing in the SFR viewer...

WSH
Associate III

Update 6:

Managed to get past the lock issue by disabling LPM. Now I'm tracing issues with starting the GATT server. Here is what my output is starting at the gatt_init method.

Gatt Init Return Status: 71
Device Name aci_gatt_update_char_value failed.
Appearance aci_gatt_update_char_value failed.
Successfully Start Fast Advertising 

Still no BLE detected and no signal on RF pin.

WSH
Associate III

More debug traces:

evice Name aci_gatt_update_char_value failed.
Appearance aci_gatt_update_char_value failed.
First index in 0 state 
Successfully Start Fast Advertising 
** STOP ADVERTISING **  Failed 

WSH
Associate III

I figured it out! The Init struct must have the header. The reason why I was getting the memory error was due to the STM32WB10's limited memory capacity and an improper CubeMx setup.

For anyone using the STM32WB10, please note you are limited in GATT/GAP services you can initialize. The default CubeMx BLE setup will initialize BLE as if it's for the STM32WB55. You can look at the STM32WB15's sample project setup for the proper settings.

ERoja.2
Associate

Hi there, first of all ty for you help WSH,

You were right, i'm using the stm32wb15cc so as you appoint there's a bad configuration caused by the cube ide configurator, inside the file app_ble.c line 302, the function SHCI_C2_BLE_Init( &ble_init_cmd_packet ) returns a 0x07 as you stated before, so the way i was able to fix it was changing some default parameters in the WPAN configuration tab, here's a snapshot of the most important IMHO, there are others but i guess these are the most important because the stack size, so any way, checking all the parameters against the examples of wb15cc can solve the problem :-)

Regards!

0693W00000JPW9aQAH.png