cancel
Showing results for 
Search instead for 
Did you mean: 

Bluenrg-m2 SPI interface with stm32f103

MOhamed_Mehery
Associate III

#BlueNRG​  #STM32WB​ #BLE​ #[BLE Mesh]​ #[STM32 MCUs]​ #STM32F1​ 

I'm interfacing bluenrg-2m When I reset the reset pin, the bluenrg-2m set the boot pin to high, and this correspond to the external interrupt of mcu and this work successfully.

The external interrupt isr, reset the chip select pin and then start to receive over spi the first packet and set the chip select high again. and this work.

All this done smoothly, but then the mcu try to reset the chip select pin of spi to send data to bluenrg it doen't respond on it's boot pin (must set it high), however it worked at first time in same code context, what is the problem?

I'm always stuck at the same point: performing an hci_reset(); returns me a BLE_STATUS_TIMEOUT on the SPI send command because when doing a CS reset the IRQ pin never gets ready.

Please notice that there is hardware bug with uart pins.

```

  1. /* CS reset */
  2. HAL_GPIO_WritePin(HCI_TL_SPI_CS_PORT, HCI_TL_SPI_CS_PIN, GPIO_PIN_RESET);
  3.  
  4. /*
  5. * Wait until BlueNRG-2 is ready.
  6. * When ready it will raise the IRQ pin.
  7. */
  8. while(!IsDataAvailable())
  9. {
  10. if((HAL_GetTick() - tickstart_data_available) > TIMEOUT_DURATION)
  11. {
  12. result = -3;
  13. break;
  14. }
  15. }
  16. if(result == -3)
  17. {
  18. /* The break causes the exiting from the "while", so the CS line must be released */
  19. HAL_GPIO_WritePin(HCI_TL_SPI_CS_PORT, HCI_TL_SPI_CS_PIN, GPIO_PIN_SET);
  20. break;
  21. }

```

0 REPLIES 0