Repository navigation
arch/arm/stm32: Add getedges support to timer capture drivers - #21052
Conversation
Implement the getedges callback and edge counting in the timer capture lower-half drivers for STM32H7, STM32H5, and STM32 M3/M4. This enables users to query pulse edge counts via CAPIOC_EDGES and CAPIOC_ALL ioctls, and resolves issue apache#16828. Signed-off-by: Swatantra Yadav <[email protected]>
|
jerpelea
left a comment
There was a problem hiding this comment.
please provide tests on a real HW
|
the testing listed in the description was build/compile verification (nucleo-h743zi:capture and nucleo-h563zi:capture built cleanly on WSL2), as I do not have physical STM32H7/H5 boards with a pulse generator setup The change implements the missing .getedges callback (which previously was NULL, returning -ENOTTY and hitting DEBUGASSERT(lower[i]->ops->getedges != NULL) in capture.c as reported in #16828) |
Summary
This PR implements pulse edge counting and the
getedgescallback in the timer capture lower-half drivers for STM32H7, STM32H5, and common STM32 (M3/M4).Previously, these drivers did not implement the
.getedgesoperation. Consequently:ioctl(fd, CAPIOC_EDGES, &edges)failed with-ENOTTY.examples/captureaborted execution upon querying edge counts.drivers/timers/capture.c:344(DEBUGASSERT(lower[i]->ops->getedges != NULL)).Changes made across STM32 capture lower-half drivers:
uint32_t edges;tostruct stm32_lowerhalf_s.lower->edges++on each captured edge in the timer interrupt handler (stm32_cap_handler).priv->edges = 0upon capture initialization instm32_start().stm32_getedges()to returnpriv->edgesatomically inside a critical section..getedges = stm32_getedgesing_cap_ops.Fixes #16828
Impact
CAPIOC_EDGESandCAPIOC_ALL.Testing
nucleo-h743zi:capture,nucleo-h563zi:capturedrivers/timers/capture.candinclude/nuttx/timers/capture.h.