2022-05-11 05:23 AM
So I am trying to use BlueNRG-MS, SPBTLE-RF device on a custom board. To use this device i tried to use BLE cube expansion with SampleApp application. I am configuring SPI and GPIO pins correctly. Project builds and loads fine but after booting but code sometimes gets in to a loop at here (in while). hci_notify_asynch_evt return 0.
any suggestions and feedback are welcome.
Thanks in advance,
Marco
2022-05-31 07:19 AM
Hi @MCANT.2 ,
I assume your development is based on X-CUBE-BLE1, do you know the version release ?
As soon as data is ready (event or ble data) , BlueNRG-MS raised the SPI IRQ, X-CUBE-BLE1 package flush data into an internal FIFO, then application will flush this FIFO.
If this FIFO is full (due to lots of comings events, data) , you can enter in a deadlock situation where only a reset is possible. This has been solved long time ago or maybe there are still some paths to investigate.
1. Could you check your X-CUBE-BLE1 package and potentially switch to latest one.
2. Could you make sure in hci_tl_lowlevel_isr you have the test conditions if host MCU FIFO is full
void hci_tl_lowlevel_isr(void)
{
/* Call hci_notify_asynch_evt() */
while(IsDataAvailable())
{
if (hci_notify_asynch_evt(NULL))
{
return;
}
}
Regards,
Sebastien.
2022-05-31 12:52 PM
Hi Sebastien,
My X-cube-ble1 version is 6.2.0 and i verified the code in hci_tl_interface.c, the function hci_tl_lowerlevel_isr() is so done:
/**
* @brief HCI Transport Layer Low Level Interrupt Service Routine
*
* @param None
* @retval None
*/
void hci_tl_lowlevel_isr(void)
{
/* Call hci_notify_asynch_evt() */
while(IsDataAvailable())
{
if (hci_notify_asynch_evt(NULL))
{
return;
}
}
/* USER CODE BEGIN hci_tl_lowlevel_isr */
/* USER CODE END hci_tl_lowlevel_isr */
}
My application sends by BLE ,every 25 ms, 40 bytes (a sort of real time data) and the code works but after a long time the application goes to deadlock. I have to reset the device.
Only way to exit from this deadlock is to disable spi interrupt because IsDataAvailable() return true and hci_notify_asynch_evt(NULL) return 0.
The operations :
"Disable interrupt" and then "enable interrupt" in hci_user_evt_proc() are not correct for my application because interrupts the exchange "real time" data between device and smartphone.
Any suggestions