cancel
Showing results for 
Search instead for 
Did you mean: 

How sent Notification from peripheral to Central using Stbluenrg2msp

MCV.1
Associate II

Hi I using bluenrg2 m2sp chip as pheripheral role and st ble sensor App as a Central , i need to sent notification from peripheral to Central whenever event occur , con you share information , which api i need to use in order to sent notification from peripheral to client.

Manukumar

7 REPLIES 7
Winfred LU
ST Employee

You will need to initialize the characteristic with Notification property (ACI: ACI_GATT_ADD_CHAR()) - CHAR_PROP_NOTIFY

BLE stack will then generate notifications whenever the GATT attribute is modified to the subscribed devices (your Central device).

In the GATT server (peripheral device here), you may use ACI_GATT_UPDATE_CHAR_VALUE_EXT() to modify an attribute and send a notification.

MCV.1
Associate II

Hi Winifred Thanks for replay ,

Winfried i found one situation were ble chip going hang mode , the detailed situation i explained below .

Here i using Bluenrg2-m2sp as peripheral role and st ble Sensor app Acts like a central

i Created one Service As notification service and one characteristics' as notification characteristic,.

the issue occur below situation .

in other Service like data service and data characteristic , when Read data validation characteristic i am performing some data validation .

if data validation is wrong i trying to sent notification for client ,

during this scenario i using existing notification characteristic, if i sent the data through this characteristic chip will hang . there is no response . i need to restart ble chip

Here may know the reason .

Note : here i am not using data validation characteristic acts like notification . just i trying to use existing notification characteristic.

This kind of scenario looks OK to me.

Maybe there is some dead lock in the application firmware?

You may attach a debugger to check the real status of the embedded MCU.

Hi Winfred thanks for Replay ,

Winfried I Enable the Notification , using characteristics property with notify and characteristic length type is variable length , here i found the issue when i tries to send the variable length data from 1-20 , bytes its working fine , if variable length greater than 20 bytes , its sending only 20 bytes , may know the reason for this ,

if you provide have any same syntax for sending variable length notification its helpful for me .

Reads

Manukumar

By default ATT_MTU value is 23 bytes, which determines the maximum attribute size when performing notification to 23 - 3 = 20.

Please try to enlarge ATT_MTU.

The MTU is set in the parameters during initialization with BlueNRG_Stack_Initialization(),

The client and server exchange the MTU size with:

tBleStatus aci_gatt_exchange_config(uint16_t Connection_Handle);

In response to an exchange MTU request, the aci_att_exchange_mtu_resp_event() callback is triggered, and Server_RX_MTU specifies the agreed MTU value.

void aci_att_exchange_mtu_resp_event(uint16_t Connection_Handle, uint16_t Server_RX_MTU);

Thanks Winfred your Replay , I will try to enlarge and test , i tried to use gatt api to enlarge ATT _MTU (because st ble acts as network co -processor and communicate host controller through uart ,) i did not find proper api , can you suggest me which api i need to use .

Regards

Manukumar

In my code, aci_att_exchange_mtu_resp_event() callback  never gets triggered. I found the __weak function and implemented it like
void aci_att_exchange_mtu_resp_event( uint16_t Connection_Handle, uint16_t Server_RX_MTU ){}
Am I missing something? I thought the callback functions worked just like that, but it does not get called.