Skip to content

[Bug] CAN总线发送(_can_int_tx)在链路波动时会阻塞 #10341

Open
@unnamed2

Description

@unnamed2

RT-Thread Version

5.1.0

Hardware Type/Architectures

STM32F407VET6

Develop Toolchain

RT-Thread Studio

Describe the bug

在CAN总线上设备掉电时发送CAN报文,STM32F407会产生SCE中断(错误码并非RT_CAN_BUS_ACK_ERR),drv_can中没有调用rt_hw_can_isr来执行

rt_completion_done(&(tx_fifo->buffer[no].completion));

这会导致 _can_int_tx 中

rt_completion_wait(&(tx_tosnd->completion), RT_WAITING_FOREVER)

永远不会返回。我尝试将他改成

if(RT_EOK != rt_completion_wait(&(tx_tosnd->completion), 100))
        {
            /* send timeout. */
            
            level = rt_hw_interrupt_disable();
            rt_list_insert_before(&tx_fifo->freelist, &tx_tosnd->list);
            rt_hw_interrupt_enable(level);
            rt_sem_release(&(tx_fifo->sem));

            // rt_kprintf("CAN send timeout, no %d\n", no);
            goto err_ret;
        }

来解决,不知道是否正确

Other additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions