This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE_ERROR_NO_TX_BUFFERS, current and safety

I am running the UART example with the S110 softdevice on nrf51822. Sometimes my application transmits more data than can be carried and backs up. So the main thread's transmitter code is:

    uint32_t rx;
    while (true) {
        rx = sd_ble_gatts_hvx(p_nus->conn_handle, &hvx_params);
        if (rx != BLE_ERROR_NO_TX_BUFFERS)
            break;
        sd_app_evt_wait();
    }

Without the call to sd_app_evt_wait, the function is identical but of course the current is much higher because the main loop is spinning.

Is this safe? If event BLE_EVT_TX_COMPLETE occurs just after the sd_ble_gatts_hvx call has returned BLE_ERROR_NO_TX_BUFFERS, then the subsequent call to sd_app_evt_wait will return immediately.

At least, I assume this is how things work, and just want to confirm here the correct pattern.

Parents Reply Children
No Data
Related