CH32V203F6P6中CAN过滤器异常
//官方代码如下,为了方便ID改成1
    CAN_FilterInitSturcture.CAN_FilterNumber = 0;
    CAN_FilterInitSturcture.CAN_FilterMode = CAN_FilterMode_IdMask;
    CAN_FilterInitSturcture.CAN_FilterScale = CAN_FilterScale_32bit;
    CAN_FilterInitSturcture.CAN_FilterIdHigh = 0x0020;
    CAN_FilterInitSturcture.CAN_FilterIdLow = 0;
    CAN_FilterInitSturcture.CAN_FilterMaskIdHigh = 0xFFE0;
    CAN_FilterInitSturcture.CAN_FilterMaskIdLow = 0x0006;
    CAN_FilterInitSturcture.CAN_FilterFIFOAssignment = CAN_Filter_FIFO0;
    CAN_FilterInitSturcture.CAN_FilterActivation = ENABLE;
    CAN_FilterInit(&CAN_FilterInitSturcture);
    
//在官方代码中加另一组过滤器
    CAN_FilterInitSturcture.CAN_FilterNumber = 1;
    CAN_FilterInitSturcture.CAN_FilterMode = CAN_FilterMode_IdMask;
    CAN_FilterInitSturcture.CAN_FilterScale = CAN_FilterScale_32bit;
    CAN_FilterInitSturcture.CAN_FilterIdHigh = 0x0040;
    CAN_FilterInitSturcture.CAN_FilterIdLow = 0x0000;
    CAN_FilterInitSturcture.CAN_FilterMaskIdHigh = 0xFFE0;
    CAN_FilterInitSturcture.CAN_FilterMaskIdLow = 0x0;
        CAN_FilterInitSturcture.CAN_FilterFIFOAssignment = CAN_Filter_FIFO0;
        CAN_FilterInitSturcture.CAN_FilterActivation = ENABLE;
        CAN_FilterInit(&CAN_FilterInitSturcture);

        在调试中,只开一组过滤器的时候,功能正常,当开一组以上过滤器时,最后打开的过滤器功能正常,前面打开的过滤器组的标识符寄存器和屏蔽位寄存器会置0(模式,位宽,关联,激活均正常),导致前一组过滤器在屏蔽模式下,因为屏蔽位置0,任何ID都可通过。前一组过滤器在标识模式下,只能通过ID为0的数据帧。

        望解决。

您好,你可以下载我们CH32V203最新EVT例程,最新EVT对库进行了更新,解决了开启两个过滤器组无法过滤的问题。后续若有问题或疑问,可通过邮箱和我沟通。CH32V203EVT下载链接如下:

CH32V203 EVT:/downloads/CH32V20xEVT_ZIP.html

 


谢谢,已解决。


只有登录才能回复,可以选择微信账号登录