nuttx/arch
Daniel P. Carvalho 09423194bf arch/arm/stm32: fix compare-match race and zero-period hang in tickless
This patch addresses two issues in the single-timer capture/compare
tickless OS drivers for STM32 families (common m3m4 v1 for F1/F2/F3/F4/G4,
F7, H7, and WB):

1. Zero-period handling: when up_timer_start() is called with a zero or
   negative duration (or period converts to 0 ticks), the driver now
   enables the compare match interrupt and immediately fires an event
   via EGR (CCxG), avoiding missed events or unexpected counter behavior.

2. Compare-match race condition: after programming CCR and enabling the
   compare interrupt, a post-check validates whether the free-running
   counter already reached or passed count + period during register
   configuration. If elapsed, the interrupt is forced immediately via EGR,
   preventing the counter from missing the match and hanging until a full
   32-bit rollover (approx. 71 minutes at 1 MHz).

Verified on real hardware:
- STM32H743ZI (IED R550): validated with ping, sleep, and usleep.
- STM32G431KB (Nucleo-G431KB): validated with uptime, sleep, and usleep.

Signed-off-by: Daniel P. Carvalho <danieloak@gmail.com>
2026-09-18 09:30:22 +08:00
..
arm arch/arm/stm32: fix compare-match race and zero-period hang in tickless 2026-09-18 09:30:22 +08:00
arm64 arch/arm/imx9, arch/arm64/imx9: Release eDMA lock before callbacks 2026-09-15 08:41:58 -03:00
avr arch, boards, cmake: Build C++ ELF modules without __cxa_atexit. 2026-09-04 15:44:24 -03:00
ceva arch/atomic: remove up_testset in spinlock 2026-09-08 08:58:54 +08:00
dummy
hc tools: fix stale archive members surviving a Kconfig-driven CSRCS change 2026-07-28 21:26:03 -03:00
mips arch, boards, cmake: Build C++ ELF modules without __cxa_atexit. 2026-09-04 15:44:24 -03:00
misoc arch, boards, cmake: Build C++ ELF modules without __cxa_atexit. 2026-09-04 15:44:24 -03:00
or1k arch, boards, cmake: Build C++ ELF modules without __cxa_atexit. 2026-09-04 15:44:24 -03:00
renesas nuttx/libc: refine the atomic related Kconfig 2026-08-24 13:20:45 +08:00
risc-v xtensa/espressif+riscv: fix PM_NORMAL stay leak in idle loop 2026-09-18 09:19:27 +08:00
sim arch/sim: Add runtime HCI socket target option 2026-09-13 18:31:59 -03:00
sparc arch/atomic: remove up_testset in spinlock 2026-09-08 08:58:54 +08:00
tricore arch/atomic: remove up_testset in spinlock 2026-09-08 08:58:54 +08:00
x86 arch/x86: Add -P to CPP to suppress linemarkers. 2026-09-17 16:21:59 +08:00
x86_64 arch/intel64: don't touch the outgoing stack after releasing the csection 2026-09-15 11:39:05 -03:00
xtensa xtensa/espressif+riscv: fix PM_NORMAL stay leak in idle loop 2026-09-18 09:19:27 +08:00
z16 tools: fix stale archive members surviving a Kconfig-driven CSRCS change 2026-07-28 21:26:03 -03:00
z80
CMakeLists.txt cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
Kconfig binfmt, arch/arm: Add the CONFIG_FDPIC option and the ABI header. 2026-09-08 16:31:16 -03:00