# Amazon Embedded Software Engineer Interview Questions

Interview questions and coding challenges based on skills from public Amazon job postings.

Not affiliated with or endorsed by Amazon. Amazon is a trademark of its owner, used here only to say which postings this page describes.

To ask for a change or removal: support@ohmwork.io

https://ohmwork.io/study-guides/for/amazon-embedded-software-engineer-interview-questions

Start practicing: [First Shift](https://ohmwork.io/challenge/116-first-shift)

## From public job postings

- Embedded C and C++: 20 of 22
- Microcontrollers such as STM32: 7 of 22
- Working within tight memory and other resource limits: 6 of 22
- An RTOS such as FreeRTOS or Zephyr: 17 of 22
- Bare metal firmware and interrupt handlers: 3 of 22
- Real time limits: timing, latency and deterministic behaviour: 9 of 22
- Serial buses: I2C, SPI, UART, RS-422 and RS-485: 11 of 22
- Device drivers: 7 of 22
- CAN and CAN FD: 7 of 22
- Bringing up new boards: 11 of 22
- Debugging and root cause across hardware and software: 17 of 22
- Lab tools: logic analyzers, oscilloscopes, JTAG and schematics: 4 of 22
- Motor control and actuation firmware: 7 of 22
- Closed loop control: commutation, current and speed loops: 5 of 22
- Safety systems and functional safety, such as IEC 61508: 13 of 22
- Diagnostics, telemetry and system health: 8 of 22
- Testing: test procedures, integration tests and hardware in the loop: 15 of 22
- Embedded Linux beside an RTOS: 12 of 22, not practiced here
- Wireless, such as Wi-Fi and Bluetooth: 8 of 22, not practiced here
- Power consumption and power management: 7 of 22, not practiced here
- Rust: 7 of 22, not practiced here
- Bootloaders and firmware update: 3 of 22, not practiced here

### Sources (27)

1. [Embedded Software Development Engineer, Ring Team](https://www.amazon.jobs/en/jobs/10410364/embedded-software-development-engineer-ring-team), Sunnyvale, CA, checked December 1, 2026
2. [SDE II, Embedded, Device Software Team](https://www.amazon.jobs/en/jobs/10588996/sde-ii-embedded-device-software-team), Hawthorne, CA, checked December 1, 2026
3. [Alarm and Accessories, Sr. Embedded SDE, Ring](https://www.amazon.jobs/en/jobs/10574286/alarm-accessories-sr-embedded-sde-ring), Sunnyvale, CA, checked December 1, 2026
4. [Senior Embedded Software Engineer, Emerging Devices Software](https://www.amazon.jobs/en/jobs/10438853/senior-embedded-software-engineer-emerging-devices-software), Sunnyvale, CA, checked December 1, 2026
5. [Sr. Software Development Engineer, EDS Device Software](https://www.amazon.jobs/en/jobs/10581080/sr-software-development-engineer-eds-device-software), Sunnyvale, CA, checked December 1, 2026
6. [Embedded SDE II, Prime Air](https://www.amazon.jobs/en/jobs/10404153/embedded-sde-ii-prime-air), Seattle, WA, checked December 1, 2026
7. [Embedded SDE, Leo Payload](https://www.amazon.jobs/en/jobs/10449656/embedded-sde-leo-payload), Sunnyvale, CA or Redmond, WA or San Diego, CA, checked December 1, 2026
8. [Embedded SDE, Payload Radio Gateway](https://www.amazon.jobs/en/jobs/10594926/embedded-sde-payload-radio-gateway), Sunnyvale, CA or Redmond, WA or San Diego, CA, checked December 1, 2026
9. [Software Development Engineer, Embedded, Flight Computer Software](https://www.amazon.jobs/en/jobs/10603660/software-development-engineer-embedded-flight-computer-software), Redmond, WA, checked December 1, 2026
10. [Sr. SDE, Embedded](https://www.amazon.jobs/en/jobs/10555705/sr-sde-embedded), Sunnyvale, CA or Redmond, WA or San Diego, CA, checked December 1, 2026
11. [Embedded Software Development Engineer II, Amazon Robotics Firmware](https://www.amazon.jobs/en/jobs/10458828/embedded-software-development-engineer-ii-amazon-robotics-firmware), North Reading, MA, checked December 1, 2026
12. [Embedded Software Engineer, Fauna](https://www.amazon.jobs/en/jobs/10610208/embedded-software-engineer-fauna), New York, NY, checked December 1, 2026
13. [Senior Embedded Software Engineer, Fauna](https://www.amazon.jobs/en/jobs/10585815/senior-embedded-software-engineer-fauna), New York, NY, checked December 1, 2026
14. [Firmware Engineer II](https://www.amazon.jobs/en/jobs/10530521/firmware-engineer-ii), North Reading, MA, checked December 1, 2026
15. [Firmware Engineer, Amazon Robotics](https://www.amazon.jobs/en/jobs/10605748/firmware-engineer-amazon-robotics), North Reading, MA, checked December 1, 2026
16. [Senior Embedded Software Engineer](https://www.amazon.jobs/en/jobs/10530503/senior-embedded-software-engineer), North Reading, MA, checked December 1, 2026
17. [Sr. Embedded Firmware Engineer, Robotics](https://www.amazon.jobs/en/jobs/10568774/sr-embedded-firmware-engineer-robotics), Sunnyvale, CA, checked December 1, 2026
18. [Sr. Embedded Software Engineer, Mobile Robotics](https://www.amazon.jobs/en/jobs/10489397/sr-embedded-software-engineer-mobile-robotics), North Reading, MA or Westborough, MA, checked December 1, 2026
19. [Software Development Engineer II, Motor Control](https://www.amazon.jobs/en/jobs/10569588/software-development-engineer-ii-motor-control), Bellevue, WA or Seattle, WA, checked December 1, 2026
20. [Sr. Embedded Engineer, Amazon Robotics](https://www.amazon.jobs/en/jobs/10486141/sr-embedded-engineer-amazon-robotics), North Reading, MA or Westborough, MA, checked December 1, 2026
21. [Senior Software Development Engineer, Amazon Industrial Robotics](https://www.amazon.jobs/en/jobs/3168733/senior-software-development-engineer-amazon-industrial-robotics), North Reading, MA, checked December 1, 2026
22. [Software Development Engineer II, Amazon Industrial Robotics](https://www.amazon.jobs/en/jobs/3168533/software-development-engineer-ii-amazon-industrial-robotics), North Reading, MA, checked December 1, 2026
23. [FreeRTOS User Guide, The FreeRTOS kernel scheduler](https://docs.aws.amazon.com/freertos/latest/userguide/freertos-kernel-scheduler.html), docs.aws.amazon.com, checked December 1, 2026
24. [FreeRTOS User Guide, Kernel memory allocation](https://docs.aws.amazon.com/freertos/latest/userguide/kernel-memory-allocation.html), docs.aws.amazon.com, checked December 1, 2026
25. [FreeRTOS User Guide, Intertask coordination](https://docs.aws.amazon.com/freertos/latest/userguide/inter-task-coordination.html), docs.aws.amazon.com, checked December 1, 2026
26. [FreeRTOS User Guide, Software timers](https://docs.aws.amazon.com/freertos/latest/userguide/software-timers.html), docs.aws.amazon.com, checked December 1, 2026
27. [FreeRTOS User Guide, Configure the kernel (FreeRTOSConfig.h)](https://docs.aws.amazon.com/freertos/latest/userguide/freertos-config.html), docs.aws.amazon.com, checked December 1, 2026

## Embedded C on microcontrollers

21 of 22 jobs

### A robot's controller board uses GPIO port C for a switch input and port A for a status lamp. How do you describe a GPIO port's registers once in C and reach both ports through it, and why does every member need volatile?

Write one struct whose members follow the register map in order, each a `uint32_t` at its offset (`MODER` at 0x00, `OTYPER` 0x04, `OSPEEDR` 0x08, `PUPDR` 0x0C, `IDR` 0x10, `ODR` 0x14, `BSRR` 0x18 and on), then cast each port's base address to a pointer to it: `#define GPIOA ((gpio_t *)0x40020000u)` and `#define GPIOC ((gpio_t *)0x40020800u)` on the STM32F4. `volatile` tells the compiler that every read and write is a real bus access: without it, a loop polling `IDR` can be compiled to read the pin once and never again, and of two writes in a row to the same register the compiler can keep only the last. Check the layout against the reference manual, since a missing member shifts every register after it.

Practice it: [Floor Plan](https://ohmwork.io/challenge/109-floor-plan)

### Your firmware must fit beside an RTOS in a part with little RAM. Where does the RAM go, and how do you find out how much stack each task really uses?

Initialised globals go in `.data` (copied from flash at reset) and zeroed globals in `.bss`. The main stack, used by main before the scheduler starts and by every interrupt handler, is sized in the linker script. Each task made with `xTaskCreate()` takes its stack and its control block from the RTOS heap: in the heap_1, heap_2 and heap_4 schemes that is one array of `configTOTAL_HEAP_SIZE` bytes, heap_3 wraps the C library's malloc instead, and a task made with `xTaskCreateStatic()` uses an array you declare, which lands in `.bss`. Measure rather than guess: with `configCHECK_FOR_STACK_OVERFLOW` set to 2 or `INCLUDE_uxTaskGetStackHighWaterMark` set to 1, FreeRTOS fills each new task's stack with a known byte, and `uxTaskGetStackHighWaterMark()` reports the least free stack the task has had so far, in words. Run the worst case paths, then size each stack from that figure with a margin. Set `configCHECK_FOR_STACK_OVERFLOW` to 2 in development: at each context switch the kernel checks the last bytes of the outgoing task's stack and calls `vApplicationStackOverflowHook()` if they were overwritten, so an overflow is caught soon after it happens instead of showing up later as corrupted data.

## RTOS tasks and scheduling

17 of 22 jobs

### A FreeRTOS task must sample a sensor every 100 ms, and each sample takes 5 to 35 ms. Why does a loop ending in vTaskDelay(100), with a 1 ms tick, drift, and what do you use instead?

`vTaskDelay()` blocks for a number of ticks counted from the moment it is called, so each period is the work time plus 100 ms, and the error grows every cycle. `vTaskDelayUntil()` (`xTaskDelayUntil()` in newer kernels) takes the address of a last wake time the task keeps, set once from `xTaskGetTickCount()`, and wakes at that time plus the period, then advances it by exactly one period. The calls then start 100 ticks apart whatever the work takes, as long as the work stays shorter than the period. Write the period as `pdMS_TO_TICKS(100)` so it stays right if the tick rate changes.

Practice it: [Clockwork](https://ohmwork.io/challenge/34-rtos-timer)

### A slow report task and an urgent safety task share one core under FreeRTOS. How do you set their priorities so the urgent task never waits, and what must it do between events?

In FreeRTOS a larger number is a higher priority, and the preemptive scheduler always runs the highest priority task that is ready. Give the urgent task the higher priority: when its event arrives it preempts the report at once, and the report resumes where it stopped. Between events the urgent task must block, on a semaphore, a queue or a task notification, never poll in a loop: a high priority task that never blocks keeps every lower priority task from running at all. The report task deletes itself or blocks when its work is done.

Practice it: [Right of Way](https://ohmwork.io/challenge/117-right-of-way)

### Two FreeRTOS tasks print lines to one UART and the console shows a line broken into the middle of another. Why does it happen, and why is a mutex better than a binary semaphore for the fix?

The higher priority task preempted the other in the middle of its line, so their characters interleaved. Make the UART one shared resource: each task takes a lock before its first character and gives it back after its last, so a whole line goes out at a time. Use a mutex (`xSemaphoreCreateMutex()`) rather than a binary semaphore: a mutex has priority inheritance, so while a low priority task holds it and a high priority task waits, the holder runs at the waiter's priority and a middle priority task cannot keep it from finishing. A binary semaphore has no owner and does not do this, which is why it suits signalling between tasks or from an interrupt, not guarding a resource.

Practice it: [Handshake](https://ohmwork.io/challenge/26-handshake)

### A pin interrupt must hand each event to a waiting FreeRTOS task. Which kernel calls may the handler make, and how does the task run as soon as the handler returns?

Only the calls that end in `FromISR`, such as `xSemaphoreGiveFromISR()`, `vTaskNotifyGiveFromISR()` or `xQueueSendFromISR()`: the ordinary calls may block, and a handler must never block. Each takes the address of a `BaseType_t` flag that you set to `pdFALSE` first, and the kernel sets it to `pdTRUE` when the call woke a task of higher priority than the one interrupted. End the handler with `portYIELD_FROM_ISR(woken)`, so the scheduler switches to the woken task as the handler exits instead of at the next tick. On Cortex-M the interrupt's priority must also be no more urgent than `configMAX_SYSCALL_INTERRUPT_PRIORITY`, that is numerically equal or greater, or the kernel's own data can be corrupted.

## Interrupts and real time

9 of 22 jobs

### On bare metal, a sensor pulse on PA0 raises EXTI line 0. What must the handler do before it returns, and what happens if it does not?

Clear the line's pending bit by writing 1 to bit 0 of `EXTI_PR` with a plain write, `EXTI->PR = 1u << 0;`: writing 0 to the other bits does nothing, while a read, modify, write would write 1 back to any other line that is pending and clear it too. If the bit stays set, the NVIC sees the request still pending when the handler returns and enters it again at once, over and over, so main never runs again. Clear it early in the handler, then do the work. For the handler to run at all, the line must be unmasked in `EXTI_IMR` with an edge chosen in `EXTI_RTSR` or `EXTI_FTSR`, PA0 routed to line 0 in `SYSCFG_EXTICR1` (port A is its reset value; any other port needs `SYSCFGEN` set in `RCC_APB2ENR` first), and the interrupt enabled in the NVIC: on the STM32F4, `EXTI0_IRQn` is 6.

Practice it: [Doorbell](https://ohmwork.io/challenge/04-button-interrupt)

### Events arrive from an interrupt in bursts faster than a slow link can send them, and none may be lost. How do you split the work between the handler and the main loop?

Keep the handler short: it records the event, for example by bumping a counter or writing the event into a ring buffer, and returns. The main loop does the slow part, formatting and sending one line per event, until it has caught up. With one writer (the handler) and one reader (main), each side moves only its own index of the ring buffer, so on a single core no lock is needed, as long as both indexes are `volatile`, each is a single aligned word, and the writer stores the event in its slot before it moves its index; make the buffer `volatile` too, so the compiler keeps that order. Size the buffer for the worst burst you can expect while main is busy. If main must update a variable the handler also writes, mask the interrupt around that update, since a read, modify, write is not atomic.

Practice it: [Tally](https://ohmwork.io/challenge/121-tally)

### A node must report its neighbour lost when no heartbeat has come for 4 ms. Why time this with a hardware timer instead of a loop counter, and how do you handle the counter wrapping?

A loop counter's time per pass changes with the compiler's optimisation level, the clock and every interrupt that runs meanwhile, so the same code can time 4 ms at -O0 and far less at -O2. A timer counts at a fixed rate set by its clock and prescaler. Read its counter at each heartbeat, and later compute the elapsed count as `(uint16_t)(now - last)` for a 16 bit timer: unsigned subtraction gives the right answer across one wrap, as long as the interval is shorter than one full turn of the counter. Compare that with the 4 ms limit in timer counts, which is 16,000 counts at 4 MHz.

Practice it: [Vigil](https://ohmwork.io/challenge/115-vigil)

## Serial buses and drivers

14 of 22 jobs

### Walk through writing one configuration register of an I2C sensor at address 0x48 on the STM32F4. What goes on the wire, and how does the firmware know the sensor heard each byte?

On the wire: START, the address byte `0x48 << 1` with the write bit 0 (so 0x90), the register's pointer byte, the data byte, then STOP; the sensor pulls SDA low to ACK each byte. In firmware: set `START` in `I2C_CR1` and wait for `SB` in `I2C_SR1`; write the address byte to `I2C_DR` and wait for `ADDR`, then clear it by reading `SR1` and then `SR2`; write each byte to `DR` after `TXE` sets; after the last, wait for `BTF` and set `STOP`. A missing ACK sets `AF` in `SR1`: check it while waiting, so an absent sensor gives an error instead of a hang, and send STOP to free the bus.

Practice it: [Thermometer](https://ohmwork.io/challenge/10-i2c-temp-sensor)

### You send a SPI flash its read ID command, 0x9F, and every byte comes back 0xFF. What do you check, cheapest first?

0xFF usually means nothing drove MISO and the line idled high. Check that chip select goes low before the command and stays low until the last ID byte, since many devices drop the command when CS rises. Check that the code sends a dummy byte for each byte it reads: SPI is full duplex, so the master's clock for each received byte comes from a byte it transmits. Check the pins: SCK, MISO and MOSI in alternate function mode with the right AF number. Check `SPI_CR1`: `MSTR` and `SPE` set, and with software chip select both `SSM` and `SSI` set, or the peripheral sees a mode fault and drops out of master mode. Then check the clock mode, `CPOL` and `CPHA`, against the device's datasheet, and the clock rate against its maximum.

Practice it: [Roll Call](https://ohmwork.io/challenge/09-spi-whoami)

### On an RS-485 link, the last byte of every reply arrives corrupted. The firmware turns the line driver off as soon as the UART's TXE flag sets. What is wrong?

`TXE` means the data register is empty: the byte has moved into the shift register and is still being sent, so switching the driver off then cuts off its last bits. RS-485 is half duplex, and the transmitter must stay on until the stop bit of the last byte has left the pin. Wait for `TC`, transmission complete (bit 6 of `USART_SR` on the STM32F4), before turning the driver enable off, or use a transmission complete interrupt to do it. Turn the driver on before writing the first byte, and leave the receiver off while transmitting if your own echo is not wanted.

## CAN bus

7 of 22 jobs

### Take an STM32F4 CAN controller from reset to sending one frame with a standard ID. Which mode changes do you make, and how do you know each one took effect?

Request initialisation mode by setting `INRQ` in `CAN_MCR` and wait for `INAK` in `CAN_MSR`; clear `SLEEP` too, since the controller leaves reset asleep, and wait for `SLAK` to clear. In initialisation mode, write the bit timing to `CAN_BTR`. Clear `INRQ` and wait for `INAK` to clear: the controller enters normal mode only after it has seen 11 recessive bits in a row on the bus, so this wait never ends if the RX pin never sees an idle bus, from a bus stuck dominant or a wrong pin setting. Then pick an empty mailbox (`TME` in `CAN_TSR`), write the ID into bits 31 to 21 of `CAN_TIxR`, the length into `CAN_TDTxR`, the data into `CAN_TDLxR` and `CAN_TDHxR`, and set `TXRQ`. Poll each acknowledge bit with a timeout, never forever.

Practice it: [Calling Card](https://ohmwork.io/challenge/112-calling-card)

### A node on a busy CAN bus needs one ID among dozens. Why filter in the controller instead of in the receive code, and what happens if frames are not read in time?

The controller's filter banks compare each frame's ID in hardware, in list mode for exact IDs or mask mode for a group of IDs that agree on the bits the mask selects, and only frames that match are stored in a receive FIFO. Every other frame is dropped without waking the core or costing a cycle, which matters at high bus load. Set the banks with `FINIT` set in `CAN_FMR`, assign them to a FIFO, activate them, then clear `FINIT`. Each FIFO on the STM32F4 holds 3 frames: read and release each one (`RFOM` in `CAN_RFxR`) promptly, or frames are lost and `FOVR` is set: by default a new frame overwrites the last one stored, and with `RFLM` set in `CAN_MCR` the new frame is dropped instead.

Practice it: [Cocktail Party](https://ohmwork.io/challenge/113-cocktail-party)

## Bring-up and hardware debug

19 of 22 jobs

### On a new board, initialised globals all read 0 when main starts, though zeroed globals are fine. What does the startup code do before main, and what mistake causes this?

The reset handler sets up memory before calling main: it copies `.data`, the initial values of initialised globals, from their load address in flash to their place in RAM, and fills `.bss` with zeros. The linker script supplies the bounds as symbols, such as the load address and the start and end of `.data` in RAM. A linker symbol has an address and no storage of its own, so the code must use its address: declare `extern uint32_t _sdata;` and use `&_sdata`, or declare it as an array and use its name. Reading the symbol's value reads whatever word happens to sit at that address, so the copy starts from, or stops at, the wrong address and the globals in RAM never receive their initial values.

Practice it: [Cold Start](https://ohmwork.io/challenge/20-boot-hang)

### A new board's only UART is wired to a radio, so a debug line sent there would garble the link. How can firmware still print text through the debug probe?

Use the Cortex-M4's trace unit: the ITM sends text out on the SWO pin, and the probe shows it. Set `TRCENA` (bit 24) in `CoreDebug->DEMCR`; the debugger normally sets up the trace clock and the pin, and ITM port 0 must be enabled in `ITM_TER` with `ITMENA` set in `ITM_TCR`. Firmware that sets these itself first writes 0xC5ACCE55 to `ITM_LAR`, since the ITM comes out of reset locked against software writes. To send a character, wait until the port reads non zero, which means it can take one, then write the character to `ITM->PORT[0]`. Route printf there by writing your own `_write()`, which newlib's printf calls with each buffer it formats. Check that the port is enabled before waiting on it, or the wait never ends when no debugger is attached.

Practice it: [Back Channel](https://ohmwork.io/challenge/127-back-channel)

### On a new board, a test LED lights while nobody touches the button and goes out while it is held. What do you check first?

The button's wiring on the schematic: most buttons pull the pin to ground when pressed, with a pull up holding it high at rest, so the pin reads 1 when released and 0 when pressed. Code that treats 1 as pressed then works backwards. Read the bit from `GPIOx_IDR` and invert it for an active low button, and check that `PUPDR` turns on the pull up if the board has no external one, or the pin floats. Confirm with a meter or a logic analyzer on the pin before changing the code, so you fix the real cause and not a symptom.

Practice it: [Upside Down](https://ohmwork.io/challenge/104-upside-down)

## Motor control and control loops

8 of 22 jobs

### A speed loop sets a motor's duty from the speed error every millisecond. Why does a proportional loop alone leave the shaft short of its set speed under load, and why does adding an integral term make it overshoot after a stall?

A proportional loop sets the duty to a base value plus a gain times the error, set speed minus measured speed, so it needs some error to push the extra duty a heavier load calls for: the heavier the load, the further below the set speed it settles. A larger gain shrinks that error but makes the speed swing, and so does running the loop too slowly. An integral term adds up the error over time and keeps raising the duty until the error is gone. That is also its trap: while the motor is stalled the error stays large, the integral keeps growing and the output sits at its limit, so when the load lets go the stored integral drives the shaft far past the set speed until the error has run the other way long enough to unwind it. That is integral windup. Stop the integral from growing while the output is saturated: clamp it to the range the output can use, or skip its update whenever the output is at a limit and the error would push it further. Compute the error in signed arithmetic and clamp the duty to the range the driver accepts.

Practice it: [Cruise](https://ohmwork.io/challenge/124-cruise)

### Motor firmware often runs a current loop inside a speed loop. Why nest the loops this way, and how fast does each one run?

The motor's current, and so its torque, changes far faster than its speed, which the mass of the rotor and load slows down. The inner loop controls current directly and fast, often every PWM period at several kilohertz or more, and handles disturbances such as supply changes before they reach the speed. The outer loop runs several times slower, usually 5 to 10 times, and its output is the current set point for the inner loop. Tune the inner loop first, then the outer one; if the speed loop responded nearly as fast as the current loop, the two would interact and could oscillate. Limiting the current set point also gives a simple torque limit for safety.

## Safety, testing and fault handling

20 of 22 jobs

### A robot controller runs several tasks. Where should the watchdog be fed, and where must it never be fed?

Feed it only when every task that matters has shown it is still making progress: each task sets its own flag or count after each pass of its work, and one monitor feeds the watchdog only when all of them have checked in since the last feed, then clears them. Never feed it from a timer interrupt alone: interrupts keep running while a task is stuck, so the watchdog would never fire. On the STM32F4 the independent watchdog runs from its own low speed clock, so it still works if the main clock fails; its timeout registers `IWDG_PR` and `IWDG_RLR` take a write only after 0x5555 is written to `IWDG_KR`; it starts when 0xCCCC is written there, takes a feed of 0xAAAA, and once started cannot be stopped except by a reset.

Practice it: [Dead Man's Switch](https://ohmwork.io/challenge/24-watchdog-setup)

### A temperature sensor on the bus sometimes returns readings that cannot be real. How should the firmware treat them?

Check every reading against the range the sensor and the machine can produce, and never act on one outside it: discard it and keep the last good value, and count the failure. Decide in advance what happens when no good reading arrives: after a set number of failures or a set time, go to a defined safe state, such as a reduced mode or a stop, and report it, instead of acting on a stale or invented value. Log each glitch with its time, since a rate of glitches that grows is often the first sign of a wiring or bus fault.

Practice it: [Fallback](https://ohmwork.io/challenge/17-sensor-degraded-mode)

### A unit in the field restarted overnight. How can its firmware tell the team why it reset?

Read the reset flags early in startup, before anything clears them. On the STM32F4 they sit in `RCC_CSR`: low power reset is bit 31, window watchdog 30, independent watchdog 29, software reset 28, power on reset 27, the reset pin 26 and brown out 25. Save them in a log or a counter that survives the reset, then clear them by setting `RMVF` (bit 24), so the next reset shows only its own cause. A watchdog flag points to a hang. Read the supply flags as a pair: a power on reset sets both the power on and the brown out flags, so only a brown out flag without the power on flag points to a dip in the supply. Read the pin flag last and with care: on this part a power on reset and every internal reset also drive the reset pin low, so the pin flag appears beside the real cause.
