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

  • <info> app_timer: RTC: initialized.
    <info> app: Debug logging for UART over RTT started.
    <info> app_timer: RTC: initialized.
    <info> app: Debug logging for UART over RTT started.
    <info> app: Connected
    <info> app: Data len is set to 0xF4(244)
    <error> app: ERROR 1 [NRF_ERROR_SVC_HANDLER_MISSING] at C:\Users\linam_p1cpp71\Desktop\nRF5_SDK_17.1.0_ddde560\examples\ble_peripheral\ble_app_uart\main.c:603
    PC at: 0x0001A647
    <error> app: End of error report

  • I see the error what do you think?

    thank you

  • Hi,

    Very good, this is exactly what we need to continue. Now, the next question is what is around line 603 in your main.c. I assume it is an APP_ERROR_CHECK() checking the return value of a function call. Which function call is it? You can also upload the file here so that I can have a look.

  • thank you for your help again Einar

  • Hello again i have news, i took off the case app_uart_communication_error and it is working better i can see better data BUT i still have a problem. The application has the data but they are too long to receive because byte per byte is too long so i'm going to make packets of 20 bytes BUT my problem is that i have to clean the buffer first, do you have ideas of how can i do that? Thank you 

Reply
  • Hello again i have news, i took off the case app_uart_communication_error and it is working better i can see better data BUT i still have a problem. The application has the data but they are too long to receive because byte per byte is too long so i'm going to make packets of 20 bytes BUT my problem is that i have to clean the buffer first, do you have ideas of how can i do that? Thank you 

Children
No Data
Related