FPGA DEVICES · ENGINEERING · SOURCING Source-linked information. Clear project requirements.

Tutorials

LSM6DSOX FIFO Watermark and Interrupt Service-Time Budget

Published · Updated

An LSM6DSOX FIFO reduces the need to service every individual sensor update, but it does not remove the need for a timing budget. A watermark must leave enough space for service latency, and the drain path must remove data faster than the long-term arrival rate. This guide explains the accounting and provides an abstract service-margin calculator. It is a design and verification method, not a loss-free driver or a report of measured nRF52840 firmware behavior.

Understand FIFO Words Tags and Capacity

FIFO word is not app recordST AN5272 Rev 5 FIFO format context; usable capacity depends on mode and enabled sources.FIFO word is not app record1 byteTag identifies the payload6 bytesFIFO payload7 bytesTransferred word exampleApplication formatMay combine many wordsConcept diagram / not a measurement
ST AN5272 Rev 5 FIFO format context; usable capacity depends on mode and enabled sources.

Keep three quantities separate: sensor measurements, FIFO words, and application records. In ST's AN5272 Rev 5 FIFO description, a FIFO word includes a tag and six payload bytes. The tag identifies how the payload should be interpreted. An application may combine several such words, add timestamps or sequence information, and store a different record format. Dividing available memory by an application's record length therefore does not directly determine the sensor FIFO's capacity.

The application note describes 3 KB of FIFO payload and compression-dependent capacity claims up to 9 KB. Those descriptions do not mean every configuration holds a fixed number of complete six-axis application records. Tags consume transfer bytes, enabled sources can produce different word types, and mode-specific behavior affects the usable boundary. Establish the capacity and interpretation for the exact configuration rather than using a product-page headline as the service-budget input.

For planning, express arrivals and occupancy in the same unit: FIFO words. If acceleration and angular-rate samples are separately batched, account for both streams. Include timestamp or other enabled records according to the selected configuration. Do not count one six-axis application update as one FIFO word unless the actual format explicitly supports that interpretation. Capture the configuration alongside the parser so that a future firmware change cannot silently change the data meaning.

The calculator accepts a user-entered usable capacity rather than asserting that a nominal physical depth is always available. Its example uses an abstract capacity of 500 words, not a recommended register value or a statement about every LSM6DSOX operating mode. Compression is not automatically credited as extra timing margin. If a design relies on compression, establish a conservative arrival bound and the exact documented behavior under the data patterns the application can produce.

Choose Batching Rates and a Watermark

Reserve service spaceAbstract planning example: (500 - 100 - 40) / 200 = 1.8 seconds; not a register recommendation.Reserve service spaceOccupancy budget at the watermarkWSRemainingWatermark W = 100Reserve S = 40Free margin = 360C = 500 words; R = 200/sConcept diagram / not a measurement
Abstract planning example: (500 - 100 - 40) / 200 = 1.8 seconds; not a register recommendation.

Distinguish the sensor output-data rate from the FIFO batching configuration. Determine which enabled sources enter the FIFO and at what rate. Convert those sources into a total conservative word-arrival rate. For example, two abstract streams contributing one word each at 100 updates per second produce 200 words per second before any additional records. This is an accounting example, not a complete LSM6DSOX register configuration.

Let C be usable capacity in words, W the watermark occupancy, S a reserved allowance, and R the conservative arrival rate in words per second. The remaining planning time after the watermark is reached is (C minus W minus S) divided by R. With C equal to 500, W equal to 100, S equal to 40, and R equal to 200, that margin is 1.8 seconds. The reserve is a design input, not a guarantee supplied by the sensor.

Compare the margin with the worst-case time until effective draining begins. Include interrupt recognition, scheduling, bus contention, and any work that must finish before the first data is removed. A low average response time is insufficient if occasional long delays exceed the available space. Measure the delay distribution under the combined application workload and investigate the largest observed delays, while recognizing that finite testing alone does not prove an absolute worst-case bound.

Watermark selection is a tradeoff. A lower threshold can request service more often and leave more occupancy margin. A higher threshold can allow larger transfers but leaves less room for delayed service. Choose using the application's timing and power requirements, then verify. The tool rejects invalid ordering such as a watermark at or beyond usable capacity. It also requires the watermark plus reserve to remain below capacity so that a positive planning margin exists.

Configure Interrupts and Drain in a Worker

Interrupt to worker serviceConcept scheduling sequence; interrupt routing and acknowledgement depend on configuration.Interrupt to worker service1Interrupt conditionNotify bounded work2Worker reads statusDiscover current occupancy3Drain complete wordsParse tags and check errors4Recheck conditionsAvoid a lost wakeupConcept diagram / not a measurement
Concept scheduling sequence; interrupt routing and acknowledgement depend on configuration.

Plan initialization as a reviewed sequence tied to the selected driver and device documentation. Establish device identity, reset state, operating ranges, rates, FIFO mode, batching sources, watermark, and interrupt routing. Check the interrupt's electrical behavior against the host GPIO configuration. This article does not supply a register-value sequence because the correct values depend on the operating mode, board wiring, and driver version that the reader selects.

Keep the interrupt handler bounded where the host architecture permits it. A useful pattern is to record or signal that service is needed, then perform bus transfers in an appropriate worker context. The worker reads status, drains complete words using the documented procedure, interprets errors, and checks whether further service is required. Avoid treating one interrupt as proof that exactly one fixed-size batch is waiting; arrivals can continue while the worker is scheduled and running.

Prevent lost wakeups when the interrupt condition remains asserted or changes during service. Review whether the selected source is level-sensitive or latched and how it clears in that configuration. Recheck status according to the device documentation before allowing the worker to sleep. A design that services only a rising edge can fail if the condition never returns inactive. The exact acknowledgement and recheck logic must be validated on the chosen interrupt configuration.

Measure effective draining in words per second, including transaction overhead and software processing. A bus clock rate alone is not the drain rate. If average drain capacity is at or below the arrival rate, a larger FIFO merely postpones accumulation. The worksheet therefore flags D less than or equal to R even when the initial response delay appears acceptable. Separate the sensor FIFO from any host-side queue: moving data out of the sensor does not solve a downstream queue that fills indefinitely.

Interactive planning worksheet

The worked method remains in the article. JavaScript adds input fields and a local summary export; no data is submitted.

Parse Tags and Preserve Time

Interpret before combiningTag order and sample timing must not be inferred from a fixed alternation assumption.Interpret before combining1Read complete wordKeep tag with payload2Dispatch known typePreserve source meaning3Apply scale + timingUse saved configuration4Report exceptionsUnknown tags / gapsConcept diagram / not a measurement
Tag order and sample timing must not be inferred from a fixed alternation assumption.

Treat the tag as part of the record contract. Decode supported tag types using the selected official documentation and driver definitions, and dispatch each payload to the appropriate interpretation. Do not assume strict alternation between accelerometer and gyroscope words. Different batching rates, timestamps, configuration changes, or other enabled sources can break that assumption. Preserve unsupported or unexpected tag observations as diagnostic evidence rather than silently treating every payload as axis data.

Keep byte order, signed interpretation, scale, and units explicit in the parser. Raw integer values are useful for traceability, while converted values need the range and sensitivity configuration that produced them. Store that configuration in the recording metadata. If the application changes ranges or rates during a run, mark the transition and ensure the host reader can identify which interpretation applies to each segment.

Separate acquisition time from transfer time. A worker's execution timestamp indicates when software handled data, not necessarily when each sample was acquired. Use the documented sensor timing information and enabled timestamp features where appropriate, then define how they map to the host clock. Consider wraparound, restart, and any change in rate or synchronization. Do not reconstruct a precise timeline from a single interrupt timestamp without explaining the assumptions and their error.

Build parser tests from controlled records and explicitly malformed cases. Check a known tag sequence, an unsupported tag, an incomplete transfer, a timestamp discontinuity, and a configuration change. These tests can validate software behavior without pretending to validate sensor accuracy. Retain raw input records alongside expected decoded results so that a driver update can be compared against the same cases. Hardware captures should then confirm that the assumed stream structure matches the actual configured sensor.

Inject Delays and Detect an Overrun

A delay consumes free capacityIllustrative occupancy growth during an output-service delay, not a measured FIFO trace.A delay consumes free capacityCapacity boundaryWatermarkService delayTimeConcept diagram / not a measurement
Illustrative occupancy growth during an output-service delay, not a measured FIFO trace.

Test the service budget under deliberate delay. Begin with a configuration that has a comfortable calculated margin, then introduce a controlled delay before draining. Observe occupancy and status using the documented interface, and record the actual service timing. Increase the delay in a controlled experiment to confirm that the software detects the relevant full or overrun condition and reports data discontinuity. Do not assume a counter remaining unchanged proves no loss.

The illustrative 1.8-second margin makes a one-second response delay appear within the simplified budget, while a two-second delay exceeds it. These are calculator results, not measured sensor traces. Actual arrivals, mode behavior, burstiness, bus delays, and the chosen reserve can change the usable margin. The diagram is therefore labeled as a conceptual occupancy curve. A real report should add its own measured occupancy and timing evidence rather than reusing the concept plot as a measurement.

Define the recovery policy before running the fault test. Depending on the selected FIFO mode and application, recovery might require resynchronizing the parser, restarting a recording segment, or reinitializing the stream. Preserve a gap marker or session boundary so that downstream analysis does not interpolate across missing data unknowingly. Use the device documentation to determine what data remains valid after the observed condition; this guide does not prescribe one recovery sequence for all modes.

Also stress downstream work. Exercise wireless traffic, storage writes, logging, and other tasks that share the processor or bus. Record maximum observed service delay, effective drain rate, sensor status, host queue occupancy, and detected gaps. A short isolated sensor demonstration can pass while the integrated product fails. Report the exact workload and run duration with the result so that “no detected overrun” remains a bounded observation, not an unconditional promise of loss-free operation.

Save Configuration and Timing Evidence

Keep assumptions with evidenceA reproducible report separates calculated bounds, observed behavior and recovery policy.Keep assumptions with evidenceConfigurationMode / rates / watermarkTiming budgetC / W / S / R / L / DMeasured behaviorDelay / drain / statusRecovery recordGap / reset / raw dataConcept diagram / not a measurement
A reproducible report separates calculated bounds, observed behavior and recovery policy.

Save the full configuration needed to reproduce the experiment: hardware revision, device identity, driver and application revisions, output rates, batching rates, FIFO mode, watermark, interrupt routing, host GPIO setup, bus configuration, and timestamp interpretation. Include the source document revision and relevant sections. A list of register values without their intended meaning is difficult to review; retain both the values and the human-readable configuration.

Export the calculator inputs and result with the measurement plan. Label R as a conservative assumed arrival rate until established for the configuration, and label D and L as assumed until measured or otherwise bounded. When measurements become available, replace the assumptions and keep the earlier record for comparison. If the tool reports insufficient sustained draining, address throughput or workload before tuning the watermark. Increasing capacity does not remove a sustained rate imbalance.

Without JavaScript, calculate the remaining words after watermark and reserve, divide by arrival rate, and compare the result with response delay. Separately verify that effective draining exceeds arrivals with suitable engineering margin. Reject negative values, missing inputs, and capacity combinations that leave no free space. This simplified arithmetic is useful for selecting experiments, but it does not model every FIFO mode, bus transaction, or real-time scheduling behavior.

Use the LSM6DSOX chip page for device documentation and the nRF52840 page when that controller is your candidate host. The broader logger article addresses storage and wireless architecture; this task focuses on the sensor service path. For engineering review, provide the exported budget, configuration, raw records, and failure log through the project entry. State what was simulated, calculated, and measured separately. That evidence is the useful output, rather than an unsupported claim that a particular watermark prevents every lost sample.

Sequence illustration and static alternative

Concept animation: highlighted stages show the order of checks, not elapsed time or a measured hardware result. Close the disclosure to hide motion. The numbered static diagram provides the same sequence.

Static four-stage sequence for LSM6DSOX FIFO and Interrupts Without Losing Samples
Read the numbered stages from top to bottom. All stages are conceptual.
Show the short illustrative animationNamed task animation: LSM6DSOX FIFO and Interrupts Without Losing Samples

Continue the specific engineering task

  • lsm6dsox — Review the exact device identity and linked documentation.
  • nrf52840 — Review the exact device identity and linked documentation.
  • power on plan — Use this related method or service to resolve the next requirement.
  • power rails — Use this related method or service to resolve the next requirement.
  • Explore related engineering tutorials — Use this related method or service to resolve the next requirement.
  • Prepare an engineering review — Use this related method or service to resolve the next requirement.

Prepare an enquiry after reviewing the result

Copy or download your worksheet first. Include the exact part, quantity and unresolved conditions for a component enquiry, or board revision, requirements and test scope for a project discussion. These links open the enquiry entry; this page does not submit a request or promise automatic prefill.

Open the component enquiry entry · Discuss the engineering scope

Source scope and editorial method

ST AN5272 LSM6DSOX application note Rev 5 is the primary manufacturer reference for this article. Source check: 2026-11-13. This article presents planning methods; it does not establish measured prototype results, current stock or delivery availability.

Additional reference addresses (plain text; scope must be checked for the selected board and software):

ST LSM6DSOX official product page — https://www.st.com/en/mems-and-sensors/lsm6dsox.html

Back to Tutorials

Related evidence and next tasks

Continue the task with the relevant source scope. These reading paths do not establish interchangeability or current supply.

Source addresses and citation trail

Full source addresses are retained below. Read each citation with its document revision, page, table and applicability conditions above.

  1. https://www.st.com/resource/en/application_note/dm00571818-lsm6dsox-alwayson-3d-accelerometer-and-3d-gyroscope-stmicroelectronics.pdf