From b652e8a601cdec4e5a6c212a1661114bc6b9b4ef Mon Sep 17 00:00:00 2001 From: yi chen <94xhn1@gmail.com> Date: Fri, 10 Jul 2026 06:48:53 +0800 Subject: [PATCH] fix(LPBAM): initialize Request in LPBAM_LPTIM_FillStructInfo For the LPBAM_LPTIM_CONFIG_ID node, LPBAM_LPTIM_FillStructInfo() only sets pDescInfo->Request when Config.State == ENABLE, or when Config.State != ENABLE and Config.Mode == LPBAM_LPTIM_UE_MODE. The remaining case (State != ENABLE, Mode != LPBAM_LPTIM_UE_MODE, i.e. LPBAM_LPTIM_NO_UE_MODE) leaves pDescInfo->Request untouched. The caller, LPBAM_LPTIM_FillNodeConfig() in stm32_lpbam_lptim.c, declares its LPBAM_InfoDesc_t on the stack without initializing it, so in this case pDMANodeConfig->Init.Request ends up with whatever garbage was already on the stack. That value also decides pDMANodeConfig->Init.Direction (set to DMA_MEMORY_TO_PERIPH whenever Request != DMA_REQUEST_SW), so two otherwise-identical LPTIM stop nodes can end up with different DMA node configurations depending on unrelated stack contents - reported independently by two users, one of whom confirmed setting Request explicitly fixed their queue. Set Request to DMA_REQUEST_SW for this case, matching the same choice already made in the State == ENABLE branch above (also a case with no specific hardware DMA request tied to it). Fixes #65 Signed-off-by: yi chen <94xhn1@gmail.com> --- Utilities/lpbam/STM32U5/stm32_ll_lpbam.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Utilities/lpbam/STM32U5/stm32_ll_lpbam.c b/Utilities/lpbam/STM32U5/stm32_ll_lpbam.c index 8abf3be0f..116f4a432 100644 --- a/Utilities/lpbam/STM32U5/stm32_ll_lpbam.c +++ b/Utilities/lpbam/STM32U5/stm32_ll_lpbam.c @@ -1498,6 +1498,11 @@ LPBAM_Status_t LPBAM_LPTIM_FillStructInfo(LPBAM_LPTIM_ConfNode_t const *const pC pDescInfo->Request = LPDMA1_REQUEST_LPTIM3_UE; } } + else + { + /* Set LPTIM update event request */ + pDescInfo->Request = DMA_REQUEST_SW; + } } /* Set value to be written */