5 months, 3 weeks ago.
BLE_STACK_BUSY error more frequent over time
I have a BLE application running Mbed 9.7.2 on an nRF52832 (softdevice 132). I have a connection interval (to the central) of 11.25 ms and specify a slave latency of 3. I have a custom service that houses 3 custom characteristics (notify). Each characteristic is 20 bytes in size and consists of 8 2-byte values and a single 4-byte value. The application will fill a single characteristic with new data every 10 ms; when all 3 characteristics are updated I call BLE::Instance().gattServer().write() to write the new data over BLE during the next connection interval.
My issue is as follows. When I attempt BLE::Instance().gattServer().write() I log the result. When the application first starts the result of this operation is BLE_ERROR_NONE - signifying that all is well. As time progresses the result of BLE::Instance().gattServer().write() more often becomes BLE_STACK_BUSY.
Any insights as to this are very welcome.
5 months, 2 weeks ago.
It looks like the tx buffers are full, so the stack is not able to take more data into the queue, and the reason might be the previous packet is under retransmission so the queue is still occupied. I would suggest two ways.
- Increase GATTS tx queue size
You can use
sd_ble_cfg_set(BLE_CONN_CFG_GATTS, &ble_gatts_conn_cfg, *ram_start) to increase GATTS_HVN_TX_QUEUE_SIZE, but it may just delay the busy scenario.
- Check the data is sent
Or you can add a data send callback by
GattServer::onDataSent(), the callback will be called when the notification is confirmed, and then you are good to send the next one.
Please feel free to ask me any questions!
Desmond, team Mbed
To post an answer, please log in.