Tutorials
BLE Motion Logger MTU: Count Whole Records per Notification
Published · Updated
Set the message size from the ATT MTU available on the active connection. The configured maximum and the phone’s negotiated value can differ.
Budget payload after the ATT and application headers

A single ATT Handle Value Notification has a one-byte opcode and a two-byte attribute handle. Its attribute value holds at most ATT_MTU − 3 bytes. For an eight-byte application header and fixed 12-byte motion records, MTU 23 leaves 20 bytes of attribute value, which fits one record. MTU 185 leaves 182 bytes, which fits 14 records after the application header.
Check the characteristic value and stack limits in addition to the negotiated MTU. Define every field’s size, byte order and version. If a record plus its header cannot fit, use a defined fragmentation format or reject that streaming mode at the small MTU. Silent truncation produces an ambiguous record.
Convert record rate to required sustained delivery

For 104 records/s, one record per notification requires 104 notifications/s. Packing 14 records reduces the long-run demand to about 7.43 notifications/s when blocks are full. If you flush partial blocks on a latency timer, packet demand rises. A full block also takes about 125 ms from first to last record at 104 Hz, before connection scheduling delays.
Benchmark using the actual phone and connection configuration. Log negotiated MTU, payload size, send-queue backpressure and committed records per second. Link-layer packet length, PHY and connection interval affect throughput through separate limits. An MTU change alone does not set a guaranteed delivery rate.
Let the recorder continue independently of the radio if capturing through disconnection is a requirement. Include a sequence number so the receiver can detect gaps and distinguish an empty stream from a paused transfer.
Does MTU 185 allow 15 records with an eight-byte header?
No. Fifteen records plus the header require 188 value bytes, which exceed the 182-byte limit.
Show the three-step example

ATT MTU 23: 20 B value → 1 record. ATT MTU 185: 182 B value → 14 records. 104 records/s: 104 vs. 7.43 notifications/s.
nRF52840 host documentation · Motion logger project and storage worksheet · FIFO watermark and service-time budget · Calculate a queue for a transport stall · LSM6DSOX device documentation
Bring negotiated MTUs, record/header sizes, partial-flush policy and measured sustained delivery from the intended phone. Prepare an engineering review.
References
Back to Tutorials