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.
Just to give more explanation i cant "control" the info because they are frames for examples of 246 bytes or 150 bytes and if I'm putting bigger packets I don't have all the info because the buffer is not full so I told myself why not create packets of 1 byte to have all the info, I don't see another issue if someone have ideas :)
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);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?