This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SEND LESS THAN 20 BYTES BLE APP UART

Hello, i would like to know if this is possible to send less than 20bytes per packets, by changing the parameters like BLE_GATT_ATT_MTU_DEFAULT or the max data len. My goal would be this thank you so much in advance. Have a great day. 

Parents
  • Hi,

    There is no minimal amount of payload data. If you want to send a single byte then just do it. There is no need to change the default ATT MTU or anything like that in order to do this. As you write "BLE APP UART" I assume you are using the NUS service from the nRF5 SDK. In that, you send data using ble_nus_data_send(). And this has a length field. If you want to send a single byte, then simply specify 1 as the length (pointer to length is number 3 in the parameter list). See API doc for reference:

    /**@brief   Function for sending a data to the peer.
     *
     * @details This function sends the input string as an RX characteristic notification to the
     *          peer.
     *
     * @param[in]     p_nus       Pointer to the Nordic UART Service structure.
     * @param[in]     p_data      String to be sent.
     * @param[in,out] p_length    Pointer Length of the string. Amount of sent bytes.
     * @param[in]     conn_handle Connection Handle of the destination client.
     *
     * @retval NRF_SUCCESS If the string was sent successfully. Otherwise, an error code is returned.
     */
    uint32_t ble_nus_data_send(ble_nus_t * p_nus,
                               uint8_t   * p_data,
                               uint16_t  * p_length,
                               uint16_t    conn_handle);

  • Yes, thank you. I would like to know why can i have a timeout? im sending now byte by byte but after 12 second i have a gatt error on my app with timeout. thank you

  • Can you elaborate? Where do you get a timeout? Please refer to code and specify exactly where and how you see this. Also let me know which SDK version you are using.

  • im using sdk 17.1  and i have this i'm trying to send a frame of 307 bytes but the problem is when i send by packets of 20 for example i dont have all the info so i'm trying to do byte per byte but i get a timeout rapidly.. What do you think?

  • i have the feeling that my app is crashing

Reply Children
Related