cancel
Showing results for 
Search instead for 
Did you mean: 

Hello,I'm using The BlueNRG-M2SP with the x-nucleo-BNRG2A1, and I wan't to send and receive ascii and hex, from the ble to my phone using "UART". I wan't to know if there is an example to use for this situation with or without flashing the BLE, Regards,

abach.1
Associate II

I'm using : the X-Nucleo-bnrg2A1

A nucleo L476RG

and I already tried to Flash my bluetooth with the examples on the firmware ST BLUENRG DK, especially the DTM. And tried the BLE_chat but I can't see the bluetooth in my phone using BLE Scanner.

8 REPLIES 8
Laurent LOUAZON
ST Employee

Hello,

You should flash the BlueNRG-M2SP with BLE serial port from latest SDK BlueNRG-1_2 DK 3.2.3 available on st.com.

Of course, you should rebuilt BLE serial port example (server) with the proper pre processing option for M2SP (see DT0137).

Your BlueNRg-M2SP will then act as a BLE to UART bridge.

Regards

Laurent

Thank you so much Laurent for your answer,

I've already flashed my x-nucleo-bnrg2a1 with the serial_port example from the latest SDK, but I can see the bluenrg on my phone to communicate with the module, I tried with BLE scanner and nrF connect.

The 0 ohm resistors that I soldered on my x-nucleo-bnrg2a are R87, R86, R73

and removed the R76 to properly communicate using UART pins.

My board works correctly i tried the st bluenrg GUI and it works using USB to UART

The problem I'm having now is that I cannot connect to my phone using the bluenrg

Thank you in advance

Anas

Laurent LOUAZON
ST Employee

Have you just flashed serial_port example or have you rebuilt the project to adpat it to M2SP as I wrote previously?

Hello, yes it works but i'm not able to receive more than 20 bytes data on my characteristic

Anas

Laurent LOUAZON
ST Employee

Hi,

Good to read.

It should be logical as characteristic is defined with 20B.

Please keep in mind this is just a code example and you can adapt it (more characteristics or characteristic size)

Below is code showing 20 is defined.

ret = aci_gatt_add_char(SerialPortServHandle, UUID_TYPE_128, &char_uuid, 20, CHAR_PROP_NOTIFY, ATTR_PERMISSION_NONE, 0,

        16, 1, &TXCharHandle);

Regards

Laurent

abach.1
Associate II

thank you Laurent for your response, meanwhile I tried to modify the char_value_length which is 20 to 124 by doing this : ret = aci_gatt_add_char(SerialPortServHandle, UUID_TYPE_128, &char_uuid, 124, CHAR_PROP_NOTIFY, ATTR_PERMISSION_NONE, 0,

        16, 1, &TXCharHandle); but when I flash the bluenrg M2SP, I cannot see it anymore on my phone

Regards

Anas

Laurent LOUAZON
ST Employee

Hello ,

You may also have to increase array size for attribute table (see below code from serialport_config.h

As can be seen here, we have a max of 80 defined for Rx and Tx size.

Increasing this value should allow you to increase characteristic size.

#define ATT_VALUE_ARRAY_SIZE  (44 + 80 + OTA_ATT_VALUE_ARRAY_SIZE) //(GATT + GAP) = 44 + serial port (TX (41) + RX (39) characteristics)  Services

Regards

Laurent

Hello,

Thank you for your response,

I increased the array size for attribute table by doing

#define ATT_VALUE_ARRAY_SIZE  (44 + 496 + OTA_ATT_VALUE_ARRAY_SIZE) //(GATT + GAP) = 44 + serial port (TX (249) + RX (247) characteristics)  Services

becasue I wan't to send 124B,

I can see again the Bluetooth device on the BLE Scanner, but meanwhile the read characteristic doesn't surpass 20B,

Regards,

Anas