cancel
Showing results for 
Search instead for 
Did you mean: 

What changes need to be made to run the demo application SensorDemo_BLESensor-App on acustom board with BLUENRG-M2SP ?

JMart.5
Associate II

Hi all,

I'm working on my first implementation of Bluetooth in a client custom bord. The board MCU is an STM32L151VeT6 with an BLUENRG-M2 module. I'm not new to STM32 development but new to Bluetooth. Im using STM32CubeMX with STM32IDE.

I started first with an X-Nucleo-BNRG2A1 with an Nucleo-L476RG. I got the SensorDemo_BLESensor-App working fine. All the config was done from scratch with MX.

Now the problem comes when I try to use the same demo with my custom board. I cannot get the module to initialize correctly.

I would like to know why using this demo application on my custom board in not as straight forward as I thought. I cannot find any help on the web.

I understand that the demo application was done for the X-Nucleo-BNRG2A1 but apparently changing Platform setting to match the custom board is not enough.

Are there any modifications other than in CubeMX that should be done in the generated source and header file when using a custom board??

HCI_init seems to be fin but I am getting a BLE_STATUS_TIMEOUT error when trying to do a hci_reset.

tBleStatus hci_reset(void)
{
  struct hci_request rq;
  tBleStatus status = 0;
  BLUENRG_memset(&rq, 0, sizeof(rq));
  rq.ogf = 0x03;
  rq.ocf = 0x003;
  rq.rparam = &status;
  rq.rlen = 1;
  if (hci_send_req(&rq, FALSE) < 0)
    return BLE_STATUS_TIMEOUT;
  if (status) {
    return status;
  }
  return BLE_STATUS_SUCCESS;
}

Thanks for your help!

7 REPLIES 7
BLin.3
Associate II

@JMart.5​ Any luck resolving this?

AElgh
Associate III

This topic is very interesting to me also, as I'm looking forward to modifying the SensorDemo_BLESensor-App to work differently according to the sensor data that I supply to it. Did you find the cause of that issue?

 

 

Thank you

Amir

"I am getting a BLE_STATUS_TIMEOUT error when trying to do a hci_reset."

I have exactly the same problem, I think that it come from a bad configuration in my (.ioc).
For me, I get the TIMEOUT because I am not able to connect to the chipset inside the while(1) loop of hci_send_request() (I guess). This while is looping until she timeout.

DKopp.2
Associate III

Hello JMart

I had the same issue- where my demo board was wonderful to work with and when we put the module on our custom board - I would run into timeout issues. 

The BLUENRG-M2 module does not have any image flashed on it when it comes out of the package. If you see Table 8 Pin Connection of the datasheet- you can see that the module needs to be in certain "MODE". You need to flash the program to set it into a "MODE" you need it in. 

Use the procedure in the following application note to flash the BLUENRG-M2 network processor.

https://www.st.com/resource/en/application_note/an5651-update-procedure-and-configuration-in-dtm-firmware-for-xnucleobnrg2a1-stmicroelectronics.pdf

Let me know how it goes.

Regards

D

Hello,

your getting a timeout because its failing to do the hci_reset(). Specifically in hci_send_req -->send_cmd()-->HCI_TL_SPI_Send(), where its waiting for the IRQ pin to be raised by the module (IsDataAvailable()).

IsDataAvailable() is contently looking if the assigned IRQ pin is set in hci_tl_interface.c  which means the after the SPI_CS pin is held low- the BLUENRG_M2 module is not setting the IRQ pin high to ACK being talked to from main controller.

I'm currently having the same issue. If any of you have success in talking to the BLUENRG_M2 module in a custom board. Please share.

Regards

D

Hi,

Thanks for information, I'll investigate. I'll reply this post if I have more information.
On which documentation did you based your project ?
I personnaly saw this video, and read UM2666

I also read some documentation about BlueNRG-2 and BLUENRG_M2

I used the same ones as you.

Regards

D