{
//Set initial values to maximum, RX is set to max. by default(251 octets, 2120us)
#define APP_SUGGESTED_PDU_SIZE 251 //default is 27 octets(TX)
#define APP_SUGGESTED_TX_TIME 2120 //default is 328us(TX)
// This API is documented in hci.h
// See BLE5-Stack User's Guide for information on using this command:
// software-dl.ti.com/…/data-length-extensions.html
HCI_LE_WriteSuggestedDefaultDataLenCmd(APP_SUGGESTED_PDU_SIZE, APP_SUGGESTED_TX_TIME);
}
下面是noti函数
void Simple_Peripheral_NotiData(uint8_t *buf, uint16_t len)
{
// Subtract the total packet overhead of ATT and L2CAP layer from notification payload
uint16_t glen = 200+10;
bStatus_t status;
attHandleValueNoti_t noti;
noti.handle = 0x29;
// noti.len = len > SIMPLEPROGILE_ALL_LEN ? SIMPLEPROGILE_ALL_LEN : len;
noti.len = 0x15;
noti.pValue = (uint8 *)GATT_bm_alloc(0, ATT_HANDLE_VALUE_NOTI, glen, NULL);
if ( noti.pValue != NULL )
{
memcpy(noti.pValue, buf, len);
status = GATT_Notification(0, ¬i, FALSE);
if(status != SUCCESS)
{
GATT_bm_free( (gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI );
}
}
}
Viki Shi:
你用的协议栈版本是什么?2.2.0版本及以上才增加了LE Data Length Extension的支持
user5831375:
回复 Viki Shi:
cc2640r2协议栈版本要多少以上?
Viki Shi:
回复 user5831375:
用的是CC2640R2F?那旧版本就支持的,不过还是建议用最新版,修复了一些bug,也增加了其他功能,注意要收发双方都支持LE Data Length Extension,提供手册供参考:dev.ti.com/…/data-length-extensions.html
user5831375:
回复 Viki Shi:
主机方是支持的,但成功不了,还修改了MTU的大小也为251,还有什么地方需要修改吗?