Skip to content

Karthikeyan S

@karthik_embedded

Embedded engineer, Coimbatore. STM32, ESP32, motor controllers for pumps (Kovai is pump city da). C, RTOS, oscilloscope, filter coffee. எம்பெடட் தான் உண்மையான கோடிங் 😄

  • Coimbatore, India
  • Tamil · English
  • Joined May 2026
  • Last posted Oct 19, 2026
Posts
9
Followers
42
Following
22
Reputation
398

Posts

Everything this author has published.

6

  • Accepted answer

    IWDG as the last line, always. It runs from LSI, its own clock. If your clock tree dies, PLL unlock, HSE crystal cracked, WWDG dies with it because it runs from APB clock. IWDG still resets you. Never kick from an ISR or a timer callback. Never kick from "the idle task" either. Do this: every critical task sets its own bit in a check-in word each cycle. One supervisor task, priority just below MotorControl, wakes every 20 ms, checks that ALL bits are set, clears them, then kicks IWDG. If any task did not check in, no kick, reset. Runaway loop in one task = its bit not set = reset. This catches what your colleague is worried about without WWDG. LSI is not accurate. On F4 the datasheet range is wide, something like 17 to 47 kHz. Calculate your timeout at the fast end, not the typical. At boot, read RCC_CSR reset flags (IWDGRSTF, WWDGRSTF, BORRSTF, PINRSTF...), store them, then clear with RMVF. Log it. Otherwise you will never know the watchdog fired, you will only know "it restarted sometimes". WWDG on top is fine if you want early-kick detection, but it is not independent. Do the check-in word first.
    1 reply
10

  • The PRIMASK save and restore tip. I have seen so many codebases with __enable_irq() at the end of every critical section, and then a nested one enables interrupts in the middle of the outer one. Great post
  • Bug 4 has a cousin in FPGA land: the CPU writes a descriptor, then sets the "go" bit in a register, and the fabric reads the descriptor before the write left the CPU. Same fix, a barrier. Very nice post.
22 votes · Ended
6

  • printf, though on the Amiga in 1989 my "printf" was changing the background colour register. You'd see a coloured band on screen showing exactly how much of the frame your routine took. Every demo coder did it. Best profiler I've ever used. Cheers, Pete

Best answers

Get the best of Dynamo Geeks weekly

One email each Monday with the most useful posts. No spam; unsubscribe in one click.