2020-04-09 01:39 AM
I am trying to set up a new project with BLE in it. Initially, it simply reads an accelerometer over SPI and flashes LEDS. I then used the configurator (the Cube bit) to turn on the BLE functionality. It adds a load of config code, but when I run it, the board runs through the initialisation and then hangs. If I run it in debug mode, and pause it after it hangs, it is in this code:
/**
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
*
* @param None
* @retval None
*/
.section .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
b Infinite_Loop
.size Default_Handler, .-Default_Handler
I have tried to set up the Cube configuration the same as the BLE_p2pserver setup, including all the interrupts, but it still does not work. I have tried putting while(1); blocks in each of the interrupts, but none of them seem to catch this.
Is there a step-by-step example somewhere to start and build a project with BLE in STM32CubeIDE that works?
I am happy to upload my project somewhere if that helps.
Solved! Go to Solution.
2020-04-09 08:16 AM
The IPCC unit is the interprocessor communication mechanism, which enables the control of the BLE stack running on the M0+ core by the application running on the M4 core via commands and events.
When one of the core wants to send information to the other, it writes data in a message posted in a mailbox and then rises an interrupt to inform the other core that some data are available.
Therefore, these IPC IRS handlers are key. This is why you do not have any BLE activity.
You must add them in your code. Otherwise, you will trigger the default handler that is set by default for all interrupts of the system.
Look at the startup_stm32wb55xx_cm4.s file. This file contains the setting of all the possible interrupt handlers of the system to the Default_Handler.
If one of these IRQ Handlers is called but was not initialised in the stm32wbxx_it.c, then you fall in an infinite loop.
I would advise you to have a look at the IPCC training module of the WB OLT that you can find either on YouTube or on our st.com web site.
2020-04-09 02:19 AM
I have done some more comparison between my project and the P2Pserver one, and looking in "stm32wbxx_it.c", I found three interrupt handlers at the the bottom that I didn't have:
void RTC_WKUP_IRQHandler(void)
{
HW_TS_RTC_Wakeup_Handler();
}
void IPCC_C1_TX_IRQHandler(void)
{
HW_IPCC_Tx_Handler();
return;
}
void IPCC_C1_RX_IRQHandler(void)
{
HW_IPCC_Rx_Handler();
return;
}
I copied these into my project and it now runs my LEDS and SPI reads. Still no BLE though :(
There were a couple of other handlers, but these are for the external switches, which i am not using.
By individually commenting our the handlers, I find that it is the IPCC_C1_RX_IRQHandler that causes it to hang. None of the three functions called exists in my project, so I wonder whether this is part of the problem.
2020-04-09 08:16 AM
The IPCC unit is the interprocessor communication mechanism, which enables the control of the BLE stack running on the M0+ core by the application running on the M4 core via commands and events.
When one of the core wants to send information to the other, it writes data in a message posted in a mailbox and then rises an interrupt to inform the other core that some data are available.
Therefore, these IPC IRS handlers are key. This is why you do not have any BLE activity.
You must add them in your code. Otherwise, you will trigger the default handler that is set by default for all interrupts of the system.
Look at the startup_stm32wb55xx_cm4.s file. This file contains the setting of all the possible interrupt handlers of the system to the Default_Handler.
If one of these IRQ Handlers is called but was not initialised in the stm32wbxx_it.c, then you fall in an infinite loop.
I would advise you to have a look at the IPCC training module of the WB OLT that you can find either on YouTube or on our st.com web site.
2020-04-10 05:24 AM
Hi Remi, thanks for the information. In the end I went back and worked through the MOOC STM32WB workshop (https://www.st.com/content/st_com/en/support/learning/stm32-education/stm32-moocs/STM32WB_workshop_MOOC.html)
This was great until I got to workshop 4 (modifying the BLE profile) to find that both the STM32CubeIDE and STM32CubeMX have changed significantly with regard to the STM32_WPAN configuration. I will raise a separate question about this.
Thanks again Remi.