cancel
Showing results for 
Search instead for 
Did you mean: 

X-NUCLEO-BNRG2A1 stuck on reset using X-CUBE-BLE2

PFuen.1
Associate III

Hi, recently I got a X-NUCLEO-BNRG2A1 and I am trying to use it with NUCLEO-G070RB without success. I have created a project with STM32CubeMx assistance using SampleApp of X-CUBE-BLE2, mapping the pins of the expansion board to my nucleo board as follows:

RST - PA8

SPI_SCK - PA5

SPI_MOSI - PA7

SPI_MISO - PA6

CS - PA1

SPI_EXTI_IRQ - PA0

The project successfully built and uploaded into the MCU, however the application does not do anything it just stuck in the function HCI_TL_SPI_Reset. I have already tried installing the DTM hex file into X-NUCLEO-BNRG2A1, however it does not solve the problem.

is it a problem of the DTM software?

24 REPLIES 24

I manage to make it work! However I am not sure why using the STM32CubeMx does not work. The problem appears to be the SPI frequency (it must be 1MHz). It works with a HAL that I developed, but it does not work with ST HAL, I don't know if I am doing something wrong.

Congrats! Look out at the PREESCALER which determines the final baudrate.

I also make mine work!

At the *ioc->Software Pack -> Select Component -> X-CUBE-BLE2 if configured HCI_TL as "Basic" and HCI_TL_INTERFACE as "Template".

Using the "Template" I still need to configure some functions to send/receive SPI.

I was trying to make it works using the "User board" option in the HCI_TL_INTERFACE... and that didn't work because it reconfigured lots of pins and the spi port itself... the CubeMX generator was a mess with this example.

Thanks for your support :D

Thank you too, I had given up, but when I saw that there was someone else with this problem, I tried again.

I manage to get it work with UserBoard too, STCubeMx does not put the interrupt handler, so that's why it got stuck there, I just add this to the stm32g0xx_it.c (in my case):

void EXTI0_1_IRQHandler(void)
{
  HAL_EXTI_IRQHandler(&H_EXTI_0);
}

And that's it.

Thanks for your support, too. :grinning_face:

satyam9896
Associate II

hi @PFuen.1​ did you resolved the issue? if yes can you help me out with the same. I too not able to even initiate the bnrg2a1, its getting stuck in one of the while loop after getting gatt init failed, bdarr failed.

PFuen.1
Associate III

@satyam9896​ hi, yes I did, however I don't remember exactly what it was.

- You should check if "hci_tl_lowlevel_isr" is called in the external pin interrupt.

- SPI MUST have this configuration:

ClockPhase: LL_SPI_PHASE_2EDGE

ClockPolarity: LL_SPI_POLARITY_LOW

Note that LL_SPI_PHASE_2EDGE and LL_SPI_POLARITY_LOW belongs to the LL driver, but you can find the equivalent for the HAL library easily as they should have a similar name.

I'm attaching the ss for simpler changes which you said . i just wanted to know regarding hci_tl_lowlevel_isr that it is correct ay to call ?0693W00000WLX1gQAH.png

0693W00000WLX20QAH.png

satyam9896
Associate II

still im getting same errors.0693W00000WLX6wQAH.png

@satyam9896​  Hmm no, remove "hci_tl_lowlevel_isr" from there. When using the HAL it should be done with the function HAL_EXTI_RegisterCallback. You have to only check that you have this in "stm32xxx_it.c":

void EXTI0_IRQHandler(void)
{
  HAL_EXTI_IRQHandler(&H_EXTI_0);
}

And that in "hci_tl_interface.c", the function hci_tl_lowlevel_init has attached "hci_tl_lowlevel_isr" into the interrupt:

void hci_tl_lowlevel_init(void)
{
  tHciIO fops;
 
  /* Register IO bus services */
  fops.Init    = HCI_TL_SPI_Init;
  fops.DeInit  = HCI_TL_SPI_DeInit;
  fops.Send    = HCI_TL_SPI_Send;
  fops.Receive = HCI_TL_SPI_Receive;
  fops.Reset   = HCI_TL_SPI_Reset;
  fops.GetTick = BSP_GetTick;
 
  hci_register_io_bus (&fops);
 
  HAL_EXTI_GetHandle(&hexti0, EXTI_LINE_0);
  HAL_EXTI_RegisterCallback(&hexti0, HAL_EXTI_COMMON_CB_ID, hci_tl_lowlevel_isr); // <--- THIS
  HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
  HAL_NVIC_EnableIRQ(EXTI0_IRQn);
 
}

Also, make sure that whenever "MX_SPIx_Init" is defined, it must have this configuration:

  hspi->Init.CLKPolarity = SPI_POLARITY_LOW;
  hspi->Init.CLKPhase = SPI_PHASE_2EDGE;

hi, i have done all three changes done but still its showing same errors.0693W00000WLbIHQA1.png0693W00000WLbI7QAL.png