I would like to write to multiple characteristics in a loop but the second call to sd_ble_gattc_write() causes a NRF_ERROR_BUSY error. From reading the documentation, I should be waiting for the BLE_EVT_TX_COMPLETE before calling sd_ble_gattc_write() again.
What's the proper way to call sd_ble_gattc_write() and then wait for the BLE_EVT_TX_COMPLETE to occur before calling this again with the next value in the loop?
I have the following code in on_ble_evt(), but this never gets entered:
case BLE_EVT_TX_COMPLETE:
tx_busy = 0;
break;