Hi,I am using Zephyr's BLE for transmissionIn the peripheral, I record the time when I send the notify to cental (start time)Then when I received the central write_without_response command, I also noted the time (end time)Treat end_time - start_time as my transmission latencyI tested it 1000 times. Is it normal for his latency (as shown below) to jitter?
Y axis unit is ms
The x-axis unit is times
I would assume so. You're asking and RTOS kernel to initiate a BLE notification, at what time that is executed is dependent on when you ask, tick rate of the kernel, how far into the current kernel 'time frame' you're in. Then you have response time of the peer BLE stack and application, BLE slave latency and connection interval, package loss, etc. The latency is fairly non-deterministic.
I would also try to split the measurement to the HV Notification and the Radio acknowledgement for the HV Notification and similarly on the client side the Write without response and the Radio Acknowledgement for the Write without response. In the Nordic softdevice architecture the BLE_GATTS_EVT_HVN_TX_COMPLETE is the event for the Radio level ack for the notification packet and the BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE is the event for the Radio level ack for the write without response packet. This should provide data for the notify() and the complete event for the GATT Client and the similar measurements for the write without response on the will give you data for the GATT Server
There should be similar events in the Zephyr BLE as well to help you with the measurements.