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

  • lm said:
    What do you think?

    The timeout you are referring to here is the supervision timeout? If so, yes, it could be that there is an issue (like a "crash") on the nRF. I suggest you debug to see what happens there. It could be that an APP_ERROR_CHECK has been hit, for instance.

  • yes but how can i solve this? Thank you

Reply Children
  • In order to solve the issue you first need to figure out what is happening. And for that, there is no way around debugging. I suspect an error handler is hit, and you may find some good information in An introduction to error handling in nRF5 projects.

  • I debugged the program, my problem is that i think the time out has to be lower but when i put it lower i don't have what i want the error timeout persists. I didn't have the problem with larger packets but my goal is to have packet of 1 only not to lost any info what do you think? thank you 

  • I cannot suggest anything without knowing what is wrong (to fix the issue we kneed to know what the issue is), so you must debug and let me know of your findings. If that is difficult, perhaps you can enable debug logging as is used in the SDK examples, and share the debug log. That should show if any APP_ERROR_CHECK has been hit. That may not be the case, but it is not unlikely and easy to check.

  • <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

Related