2021-08-05 09:19 AM
Hello! I'm working with a custom STM32WB10CCU board and can't seem to get BLE working.
Here are the details:
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!
Solved! Go to Solution.
2021-08-09 05:23 AM
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.
2021-08-05 01:41 PM
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?
2021-08-05 02:41 PM
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.
2021-08-05 03:42 PM
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.
2021-08-05 09:50 PM
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. :)
2021-08-07 07:56 AM
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...
2021-08-07 11:49 AM
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.
2021-08-07 03:42 PM
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
2021-08-09 05:23 AM
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.
2022-02-11 09:58 AM
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!