possible error in stm32_ll_lpbam.c
评估
这个 Issue 还没有评估数据。
描述
LPBAM_Status_t LPBAM_LPTIM_FillNodeConfig(LPBAM_LPTIM_ConfNode_t const *const pConfNode,
DMA_NodeConfTypeDef *const pDMANodeConfig)
{
LPBAM_Status_t status;
LPBAM_InfoDesc_t desc_info;
...
in stm32_lpbam_lptim.c leaves desc_info uninitialized and calls
LPBAM_Status_t LPBAM_LPTIM_FillStructInfo(LPBAM_LPTIM_ConfNode_t const *const pConfNode,
LPBAM_InfoDesc_t *const pDescInfo)
in stm32_ll_lpbam.c with reference to desc_info.
While LPBAM_LPTIM_FillStructInfo does not set pDescInfo->Request in case of LPBAM_LPTIM_CONFIG_ID with pConfNode->Config.State != ENABLE and pConfNode->Config.Mode != LPBAM_LPTIM_UE_MODE as it can be seen in the following code snippet.
...
/* Check node ID */
switch (pConfNode->NodeDesc.NodeInfo.NodeID)
{
/* LPBAM LPTIM Update Period node ID */
case LPBAM_LPTIM_CONFIG_ID:
{
/* Get control register value */
dummy = pConfNode->pInstance->CR;
/* Check LPTIM state */
if (pConfNode->Config.State == ENABLE)
{
/* Set LPTIM update event request */
pDescInfo->Request = DMA_REQUEST_SW;
/* Set LPTIM state */
dummy |= LPTIM_CR_ENABLE;
/* Check LPTIM start mode update */
if (pConfNode->Config.UpdateStartMode == ENABLE)
{
if (pConfNode->Config.StartMode == LPBAM_LPTIM_START_SINGLE)
{
/* Configure LPTIM to start in single mode */
dummy |= LPTIM_CR_SNGSTRT;
}
else
{
/* Configure LPTIM to start in continuous mode */
dummy |= LPTIM_CR_CNTSTRT;
}
}
}
else
{
/* Set LPTIM state */
dummy &= ~(LPTIM_CR_ENABLE);
/* Check LPTIM mode */
if (pConfNode->Config.Mode == LPBAM_LPTIM_UE_MODE)
{
/* Check LPTIM instance */
if (pConfNode->pInstance == LPTIM1)
{
/* Set LPTIM1 update event request */
pDescInfo->Request = LPDMA1_REQUEST_LPTIM1_UE;
}
else
{
/* Set LPTIM3 update event request */
pDescInfo->Request = LPDMA1_REQUEST_LPTIM3_UE;
}
}
}
/* Set value to be written */
*pConfNode->NodeDesc.pSrcVarReg = dummy;
/* Set DMA source address */
pDescInfo->SrcAddr = (uint32_t)pConfNode->NodeDesc.pSrcVarReg;
/* Set DMA destination address */
pDescInfo->DstAddr = lptim_descitem_tbl[pConfNode->NodeDesc.NodeInfo.NodeID].RegOffset +
(uint32_t)pConfNode->pInstance;
/* Set DMA data size */
pDescInfo->DataSize = lptim_descitem_tbl[pConfNode->NodeDesc.NodeInfo.NodeID].RegDataSize;
break;
}
....
Later code uses Request leading to undefined behavior. The fix that worked for me was adding
...
else
{
pDescInfo->Request = DMA_REQUEST_SW;
/* Set LPTIM state */
dummy &= ~(LPTIM_CR_ENABLE);
...
essentially this problem occurred when adding a lptim stop node with "not from update event detection" in cubemx lpbam scenario.
- 主要语言
- C
- 星标
- 184
- 派生
- 94
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
STMicroelectronics/STM32CubeU5 的其他 Issue
-
LPBAM I2C MasterTx silently writes wrong SADD on bus (STM32CubeU5)可能重新可做 @MKISTM 于 169 天前认领,目前没有进行中的 PR。 未关闭bug cube mx internal bug tracker lpbam
STMicroelectronics/STM32CubeU5#68 · 3 条评论 · 已指派 1 人 ·
查看 STMicroelectronics/STM32CubeU5 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
area:buffer good first issue type:documentation
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
sudo-project/sudo#586 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
Abort (SIGABRT) when stderr is a closed pipe: uncaught fmt::system_error in ccache_main's catch可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 3 天内回复