Hello Nordic team,
I'm a beginner on Nordic connect sdk, here have a question about how to increase nrf5340 sending data speed by NUS?
Below is what I testing model now.
Peripheral BLE : nrf5340 (peripheral_uart)
Central BLE: nrf52840 dongle (central_uart)
I want to use nrf5340 send data continuous to nrf52840 dongle. So, I rewrite "ble_write_thread" as below(Flag "enable_send" is opened when connected to nrf52840 dongle).
void ble_write_thread(void)
{
/* Don't go any further until BLE is initialized */
k_sem_take(&ble_init_ok, K_FOREVER);
for (;;) {
#if CUSTOMIZE_PROTOCOL
if(enable_send)
{
time_stamp = k_uptime_get_32();
LOG_INF("Time %d", time_stamp);
test_buf[0] = (uint8_t)((time_stamp >>24) & 0x000000FF);
test_buf[1] = (uint8_t)((time_stamp >>16) & 0x000000FF);
test_buf[2] = (uint8_t)((time_stamp >>8) & 0x000000FF);
test_buf[3] = (uint8_t)((time_stamp) & 0x000000FF);
bt_nus_send(NULL, test_buf, 40);
}
#else
/* Wait indefinitely for data to be sent over bluetooth */
struct uart_data_t *buf = k_fifo_get(&fifo_uart_rx_data,
K_FOREVER);
LOG_HEXDUMP_INF(buf->data,buf->len,"ble write thread");
if (bt_nus_send(NULL, buf->data, buf->len)) {
LOG_WRN("Failed to send data over BLE connection");
}
k_free(buf);
#endif
}
}
Then, I was tested nrf5340 can send 40 bytes and 50ms send one time. I want to decrease 50ms to maybe 20ms or less.
But, I cannot find which config or setting let me to decrease this thread trigger speed.
Can Nordic team give me some suggestion and I am happy to provide more info as required.
Allen