B-L475E-IOT01A2 - When using the XCUBE-BLE2 pack it seems that MCU hangs when the code resets the BLE module during initialization
Hello,
I use the B-L475E-IOT01A2 board and I try to integrate/experiment with the BLE module.
I created a new project using the STM32CubeIDE where I let the IDE apply the basic configuration for the board.
Then I select the BLE2 pack which I configure to use the SensorDemoBLESensor application.
In the Pinout & Configuration tab I apply the platform settings for the XCUBE BLE2 pack.
So far, the code is only what is generated by the IDE tool.
In other words, I have not intervened in the code yet.
When I flash the code the MCU seemed to hang.
So I started in debug mode and I found out that it hangs when the HCI_TL_RST_PIN is set with GPIO_PIN_SET value as seen in the following code block (line 8):
int32_t HCI_TL_SPI_Reset(void)
{
// Deselect CS PIN for BlueNRG to avoid spurious commands
HAL_GPIO_WritePin(HCI_TL_SPI_CS_PORT, HCI_TL_SPI_CS_PIN, GPIO_PIN_SET);
HAL_GPIO_WritePin(HCI_TL_RST_PORT, HCI_TL_RST_PIN, GPIO_PIN_RESET);
HAL_Delay(5);
HAL_GPIO_WritePin(HCI_TL_RST_PORT, HCI_TL_RST_PIN, GPIO_PIN_SET);
HAL_Delay(5);
return 0;
}This code block is from the hci_tl_interface.c file.
I believe that the project should work just fine since it is an example application automated by the tool to work with this particular board.
I also tried to comment out line 8 of the code above.
In this case the MCU did not hang but I got the following error in my serial terminal:
Read Static Random address failed.
Static Random address not well formed.Debugging again I found that the problem is at the following code block in the hci_tl_interface.c file:
/*
* Wait until BlueNRG-2 is ready.
* When ready it will raise the IRQ pin.
*/
while(!IsDataAvailable())
{
if((HAL_GetTick() - tickstart_data_available) > TIMEOUT_DURATION)
{
result = -3;
break;
}
}A timeout happened since the BlueNRG was not ready.
Am I missing something?
Do I also have to intervene somehow on the board?
Any help would be appreciated!
Thank you!
