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);

Reply
  • 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);

Children
Related