Hi,
I am using the NRF52840, softdevice: s140, example: ble_app_uart from nRF5_SDK_15.2.0_9412b96.
short description of my application: i am developing an application that samples external ADC and sends the data sampled over BLE.
the biggest sampling frequency is 1000Hz Set of 8 samples (sampling 8 samples in frequency of 1000 Hz) , and the biggest message rate is 500 messages per second, I am sending every 16 samples in one message, one message is 60B.
when I am sampling in the biggest sampling frequency the NRF52840 manages to sample all the samples and I really get 8000 samples in total as it should be.
when i am adding the communication code to during the samples (sending every 16 samples together) the NRF52840 didn't manage to samples all the required samples ( sampled only ~210 set of 8 samples in one second).
the problem is from the while loop that waits for the sending message, but i did some changes
1. changed the BLE_GATT_ATT_MTU_DEFAULT from 23 to 247 , it helped to increase the samples to ~296 set of 8 samples in one second
2. the NRF_SDH_BLE_GAP_DATA_LENGTH is 251 already
3. tried to cancel the loop for message sending, every time i received NRF_ERROR_RESOURCES when I am trying to send message I added this message to message buffer to send, after that I enter the sending message in my application main loop and whenever this buffer have messages to send I try to send the next message to send. but something weird happens.
-when it is a sending loop that try to send the message every time it return NRF_ERROR_RESOURCES it works.
- but when I added this buffer to help me get the sending be part of my application loop , and when I tried to send a message that I got NRF_ERROR_RESOURCES for it before, i got a NRF_ERROR_TIMEOUT error from the ble_nus_data_send() function.
can you say what i am doing wrong !?
why when the loop is small and trying to send before it all it works.
and when I try to send once in my application loop, I got NRF_ERROR_TIMEOUT for something tried to send before and got NRF_ERROR_RESOURCES for it .