cancel
Showing results for 
Search instead for 
Did you mean: 

aci_gatt_update_char_value_ext issue

APort
Associate III

Hello,

We are trying to use MTU larger than 24X bytes.

The characteristic size set to 483 bytes (CFG_BLE_MAX_ATT_MTU).

We tried to use aci_gatt_update_char_value_ext to set the value (as the HCI layer is limited to 255 bytes transfer).

aci_gatt_update_char_value_ext called twice (for both MPSs) , first part with 0 offset, and 2nd with 240.

First, Update_Type=GATT_CHAR_UPDATE_LOCAL_ONLY;  2nd call with GATT_CHAR_UPDATE_SEND_NOTIFICATION.

What happens is that random? number of bytes is sent (80).

 

If we always use GATT_CHAR_UPDATE_SEND_NOTIFICATION proper 480 bytes are sent, but twice (for both offset updates) ...

 

Thanks in advance

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

Hello @APort 

What I understand, you are looking to send more data. So, I suggest you refer to this description:

1. Modify CFG_BLE_MAX_ATT_MTU to 512 in app_conf.h

2. Call aci_gatt_exchange_config() after connecting in app_ble.c:

tBleStatus status = aci_gatt_exchange_config(BleApplicationContext.BleApplicationContext_legacy.connectionHandle);

 3. Change Notify characteristic size in p2p_stm.c: 

aci_gatt_add_char(aPeerToPeerContext.PeerToPeerSvcHdle, UUID_TYPE_128, &uuid16, CFG_BLE_MAX_ATT_MTU - 3, // [STM] CHAR_PROP_NOTIFY, ATTR_PERMISSION_NONE, GATT_NOTIFY_ATTRIBUTE_WRITE, /* gattEvtMask */ 10, /* encryKeySize */ 1, /* isVariable: 1 */ &(aPeerToPeerContext.P2PNotifyServerToClientCharHdle));

4. Change P2PS_STM_App_Update_Char function in p2p_stm.c:

tBleStatus P2PS_STM_App_Update_Char(uint16_t UUID, uint8_t *pPayload) { tBleStatus result = BLE_STATUS_INVALID_PARAMS; switch(UUID) { case P2P_NOTIFY_CHAR_UUID: aci_gatt_update_char_value_ext(0x0000, aPeerToPeerContext.PeerToPeerSvcHdle, aPeerToPeerContext.P2PNotifyServerToClientCharHdle, 0x00, 509, 0, 243, (uint8_t *) pPayload); aci_gatt_update_char_value_ext(0x0000, aPeerToPeerContext.PeerToPeerSvcHdle, aPeerToPeerContext.P2PNotifyServerToClientCharHdle, 0x00, 509, 243, 243, (uint8_t *) pPayload + 243); aci_gatt_update_char_value_ext(0x0000, aPeerToPeerContext.PeerToPeerSvcHdle, aPeerToPeerContext.P2PNotifyServerToClientCharHdle, 0x01, 509, 486, 23, (uint8_t *) pPayload + 486); break; default: break; } return result; }
View more

5. Modify P2PS_STM_Data_t structure in p2p_stm.h:

typedef struct { uint8_t * pPayload; uint16_t Length; }P2PS_STM_Data_t;

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
STTwo-32
ST Employee

Hello @APort 

What I understand, you are looking to send more data. So, I suggest you refer to this description:

1. Modify CFG_BLE_MAX_ATT_MTU to 512 in app_conf.h

2. Call aci_gatt_exchange_config() after connecting in app_ble.c:

tBleStatus status = aci_gatt_exchange_config(BleApplicationContext.BleApplicationContext_legacy.connectionHandle);

 3. Change Notify characteristic size in p2p_stm.c: 

aci_gatt_add_char(aPeerToPeerContext.PeerToPeerSvcHdle, UUID_TYPE_128, &uuid16, CFG_BLE_MAX_ATT_MTU - 3, // [STM] CHAR_PROP_NOTIFY, ATTR_PERMISSION_NONE, GATT_NOTIFY_ATTRIBUTE_WRITE, /* gattEvtMask */ 10, /* encryKeySize */ 1, /* isVariable: 1 */ &(aPeerToPeerContext.P2PNotifyServerToClientCharHdle));

4. Change P2PS_STM_App_Update_Char function in p2p_stm.c:

tBleStatus P2PS_STM_App_Update_Char(uint16_t UUID, uint8_t *pPayload) { tBleStatus result = BLE_STATUS_INVALID_PARAMS; switch(UUID) { case P2P_NOTIFY_CHAR_UUID: aci_gatt_update_char_value_ext(0x0000, aPeerToPeerContext.PeerToPeerSvcHdle, aPeerToPeerContext.P2PNotifyServerToClientCharHdle, 0x00, 509, 0, 243, (uint8_t *) pPayload); aci_gatt_update_char_value_ext(0x0000, aPeerToPeerContext.PeerToPeerSvcHdle, aPeerToPeerContext.P2PNotifyServerToClientCharHdle, 0x00, 509, 243, 243, (uint8_t *) pPayload + 243); aci_gatt_update_char_value_ext(0x0000, aPeerToPeerContext.PeerToPeerSvcHdle, aPeerToPeerContext.P2PNotifyServerToClientCharHdle, 0x01, 509, 486, 23, (uint8_t *) pPayload + 486); break; default: break; } return result; }
View more

5. Modify P2PS_STM_Data_t structure in p2p_stm.h:

typedef struct { uint8_t * pPayload; uint16_t Length; }P2PS_STM_Data_t;

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.