Hello there!
I need to send via BLE NUS an array of at least 3000 values (coming from ADC sampling) from a central device to a peripheral.
I saw that in order to use "ble_nus_c_string_send" I need to write the values in a string and the maximum length of the string is BLE_NUS_MAX_DATA_LEN.
So, the idea is split the string in substring with lenght BLE_NUS_MAX_DATA_LEN and send all of them consequently.
The sysyem crash with errore 0x13.
I think that it is a problem of queue of the BLE messages (the SoftDevice should handle the queue autonomously).
I also try to insert a delay between each call of ble_nus_c_string_send (nrf_delay_ms(100)), without any success.
Any idea?
The snipped code is inside a custom function so I think I can't exploit BLE_EVT_TX_COMPLETE flag.
uint8_t iterations = (storage_lenght->packet_lenght) / BLE_NUS_MAX_DATA_LEN;
uint8_t reminder = (storage_lenght->packet_lenght) % BLE_NUS_MAX_DATA_LEN;
for (int i=0; i<iterations; i++)
{
do
{
ret_val = ble_nus_c_string_send(m_ble_nus_, TempStorageBuffer_PacketCounter+(BLE_NUS_MAX_DATA_LEN*i), BLE_NUS_MAX_DATA_LEN);
if ((ret_val != NRF_ERROR_INVALID_STATE) &&
(ret_val != NRF_ERROR_RESOURCES) &&
(ret_val != NRF_SUCCESS) &&
(ret_val != NRF_ERROR_BUSY) &&
(ret_val != NRF_ERROR_NOT_FOUND))
{
APP_ERROR_CHECK(ret_val);
}
} while (ret_val == NRF_ERROR_BUSY || ret_val == NRF_ERROR_RESOURCES);
}


