Skip to content

Conversation

@illustriousness
Copy link
Contributor

@illustriousness illustriousness commented Jul 29, 2025

Solution: 使用 can->status.sndchange 的bit位来表示某个发送邮箱超时 如果超时 底层驱动再通知tx_done或者tx_fail事件时不予处理
resolves #10550

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

你的解决方案是什么 (what is your solution)

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
  • .config:
  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/workflows/bsp_buildings.yml 详细请参考链接BSP自查

@github-actions
Copy link

github-actions bot commented Jul 29, 2025

📌 Code Review Assignment

🏷️ Tag: components

Reviewers: Maihuanyi

Changed Files (Click to expand)
  • components/drivers/can/Kconfig
  • components/drivers/can/dev_can.c
  • components/drivers/include/drivers/dev_can.h

🏷️ Tag: components_driver_can

Reviewers: wdfk-prog

Changed Files (Click to expand)
  • components/drivers/can/Kconfig
  • components/drivers/can/dev_can.c

📊 Current Review Status (Last Updated: 2025-07-29 15:04 CST)

  • Maihuanyi Pending Review
  • wdfk-prog Pending Review

📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

wdfk-prog

This comment was marked as outdated.

@wdfk-prog
Copy link
Contributor

  • 另外可以增加一个控制函数,用于配置tx的完成量超时时间设置

can->status.sndchange = 1;
rt_completion_wait(&(tx_tosnd->completion), RT_WAITING_FOREVER);
can->status.sndchange |= 1<<no;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请删除多余的换行,并对增加的代码进行格式化处理,谢谢

@illustriousness
Copy link
Contributor Author

  • 另外可以增加一个控制函数,用于配置tx的完成量超时时间设置

感觉目前不是不需要诶 默认值100ms应该够了 或者自己改一下宏定义 就不动态调整超时时间了^^

@wdfk-prog
Copy link
Contributor

  • 另外可以增加一个控制函数,用于配置tx的完成量超时时间设置

感觉目前不是不需要诶 默认值100ms应该够了 或者自己改一下宏定义 就不动态调整超时时间了^^

  • 那可以搞一个Konfig配置?

… 的线程一直挂起的问题

Solution: 使用 can->status.sndchange 的bit位来表示某个发送邮箱超时
如果超时 底层驱动再通知tx_done或者tx_fail事件时不予处理

Signed-off-by: Yucai Liu <1486344514@qq.com>
Copy link
Contributor

@wdfk-prog wdfk-prog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Rbb666 Rbb666 merged commit a1c642a into RT-Thread:master Jul 29, 2025
63 checks passed
@GPTKEY
Copy link
Contributor

GPTKEY commented Jul 29, 2025

我不明白为什么发送会超时?正常来说一旦开始发送 它会自动很快完成,有什么操作会阻值发送过程?

can->status.sndchange |= 1<<no;
if (rt_completion_wait(&(tx_tosnd->completion), RT_CANSND_MSG_TIMEOUT) != RT_EOK)
{
level = rt_hw_interrupt_disable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里开关全局中断是否会产生风险?

@illustriousness illustriousness deleted the fix_can branch August 6, 2025 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [CAN]tx发送函数中存在使用完成量进行永久阻塞情况,可能导致线程不会唤醒

4 participants