cancel
Showing results for 
Search instead for 
Did you mean: 

X-Nucleo-BNRG2A1 BLE Central disconnects right after connection.

NafiurRahman
Associate II

I am trying to use X-Nucleo-BNRG2A1 as a BLE Central Device. My BLE peripheral is based on STM32WB15CC (Which is working fine). On the central code, I am using the central example from CubeIDE. I can scan and see my peripheral. I managed to connect to it. However, as soon as it connects, it disconnects giving me "GATT Procedure completed with error 0x41 0x0806". Here, 0x41 = error code (referring to Failed). And 0x0806 is the connection handle.

I tried to modify the example by adding a primary service discovery inside the connection complete event callback. It fails to discover service. The debug message I get is "aci_gatt_disc_all_primary_services() failed: 0x46". No idea what 0x46 refers to.

FYI, the connection code (in the central) is: aci_gap_create_connection(SCAN_P, SCAN_L,

                 saved_devices.dev_info[dev_index].addr_type,

                 saved_devices.dev_info[dev_index].bdaddr,

                 PUBLIC_ADDR, 6, 80, 1, 60, 2000 , 2000);)

and the advertising code in the peripheral is: aci_gap_set_discoverable(

    ADV_TYPE,

    CFG_FAST_CONN_ADV_INTERVAL_MIN,

    CFG_FAST_CONN_ADV_INTERVAL_MAX,

    CFG_BLE_ADDRESS_TYPE,

    ADV_FILTER,

    0,

    0,

    0,

    0,

    6,

    80);

I tried changing the min max intervals. No luck either. Btw, I can connect to the peripheral using any BLE app and it works fine. Any idea what I'm doing wrong in the central code?

11 REPLIES 11

Hi @Sebastien DENOUAL​,

The problem is now solved. I was using the Nucleo Expansion Board with a black pill module with necessary connections (In the image attached). I ordered a nucleo board and hooked up the expansion board with it. And it worked like a charm. Seems like in order to use it with the black pill module, I need to do something extra for a reliable connection. Do you happen to know what extra connections I need to consider?0693W00000KboPZQAZ.jpg

Sebastien DENOUAL
ST Employee

Hi @NafiurRahman​ ,

Good news ! Thanks for the update.

Reference documentation to use is the one for X-CUBE-BLE2 package ( which apply to X-NUCLEO-BNRG2A1) . I attached it to this post. This doc describe how to configure both SW and Nucleo HW.

Please take care that the screen copy you attached on your last post is a different board (IDB04A1) which must be used together with X-CUBE-BLE1 package. Slightly different from the one we are discussing here

Regards,

Sebastien.