We are developing a BLE interface between Raspberry Pi4 and the nrf52833dk. The requirements are we need to send 40bytes every 4 msec. The Raspberry Pi4 is the client and the nrf52833dk is the peripheral. The issue we are having is something is blocking the transmission at 4msec. We are using a modified nrf peripheral uart example. The attached graph is an I/O pin toggling when we send data from the nrf52833dk. You see the transmission every 4msec then a long delay. Any ideas/suggestions on if this is a result of buffering on the Nordic side due to latency issues on the Raspberry Pi4. Also, included is the config file. We tried just sending 20 bytes and have the same issue.
void main(void)
{
int blink_status = 0;
uint8_t i=0;
configure_gpio();
gpio_init();
setup_bt();
while (1) {
dk_set_led(RUN_STATUS_LED, (++blink_status) % 2);
//k_sleep(K_MSEC(RUN_LED_BLINK_INTERVAL));
k_sleep(K_MSEC(4));
nrf_gpio_pin_toggle(31);
//if (SendData == true) {
/* Don't go any further until BLE is initialized */
//k_sem_take(&ble_init_ok, K_FOREVER);
//TODO verify bt is init and connected
for(i=0;i<40;i++){
send_data[i]=i+65;
}
nrf_gpio_pin_set(30);
if (bt_nus_send(NULL, send_data, 40)) {
LOG_WRN("Failed to send data over BLE connection");
}
nrf_gpio_pin_clear(30);
// LOG_INF("Data Sent");
//k_free(send_data);
// k_sleep(K_MSEC(100));
// SendData = false;
// }
}
}
Copyright (c) 2018 Nordic Semiconductor # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # # Enable the UART driver #CONFIG_UART_ASYNC_API=y #CONFIG_NRFX_UARTE0=y CONFIG_SERIAL=y CONFIG_GPIO=y # Make sure printk is printing to the UART console CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_HEAP_MEM_POOL_SIZE=2048 CONFIG_BT=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME="NG-Proto" CONFIG_BT_DEVICE_APPEARANCE=833 CONFIG_BT_MAX_CONN=1 CONFIG_BT_MAX_PAIRED=1 # Enable the NUS service CONFIG_BT_NUS=y # Enable bonding CONFIG_BT_SETTINGS=y CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y # Enable DK LED and Buttons library CONFIG_DK_LIBRARY=y # This example requires more workqueue stack CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 # Config logger CONFIG_LOG=y CONFIG_USE_SEGGER_RTT=y CONFIG_LOG_BACKEND_RTT=y CONFIG_LOG_BACKEND_UART=n CONFIG_ASSERT=y