This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F BLESTACK传输的最大字节数

Other Parts Discussed in Thread: BLE-STACK, CC2640R2F

hi!我使用的是ble-stack ,我将一些使用的记录储存在一个252字节的缓冲区中,我希望CC2640R2F能够将这252个字节传输到我的手机上,notify可以胜任这个功能吗?一次性传输252个字节,最大的传数量为多少呢?

  • 目前最大PDU size应该是251字节,即Data Length Extension
  • 最大只能向手机传传输251个字节了吗?如果要传输251个字节我该如何修改代码呢?有没有一些例程供我参考?
  • 用CC2640R2F的话,新版SDK已经默认开启Data Length Extension了,也就是设备连接后会发起数据包大小协商,如果双方都使能了DLE,即可传输251字节。代码可参考simple peripheral/central

    // Set default values for Data Length Extension
      // Extended Data Length Feature is already enabled by default
      {
        // Set initial values to maximum, RX is set to max. by default(251 octets, 2120us)
        // Some brand smartphone is essentially needing 251/2120, so we set them here.
        #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 the LE Data Length Extension section in the BLE5-Stack User's Guide for information on using this command:
        // software-dl.ti.com/.../
        HCI_LE_WriteSuggestedDefaultDataLenCmd(APP_SUGGESTED_PDU_SIZE, APP_SUGGESTED_TX_TIME);
      }