CAN Rx dedicated Buffer Interrupt issue on TC366DP

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Olsch001
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hi there,

I use the Evaluation Board KIT_A2G_TC366_5V_TRB_S and want to use 14 CAN dedicated Rx Buffers with interrupt.
My problem is that only buffers 0-7 get an interrupt.
For the buffers 0 -13 the data is written into the CAN message RAM and the flags for new data ND0 - ND13 are also set, but as I said, an interrupt is only triggered for buffers 0-7.

I hope someone has an idea and can help me with this problem.

0 Likes
1 Solution
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

Hi Olsch,

It looks like you hit the root cause! Could you please try to use below instead

if(node->NDAT1.U&mask) 
    return True;

 Expect to receive your good news.

dw

View solution in original post

0 Likes
4 Replies
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

dw_0-1646113862464.png

dw_1-1646113872063.png

 

dw_2-1646113880470.png

Hi Olsch,

M_CAN supports 64 dedicated Rx Buffers. IRi.DRX is set when a msg is stored into the Rx Buffer.

NDAT1i NDAT2i is set after last word of a matching received msg written.

Please check if filter masked data? or buffer full?  Attached related register for your reference.

dw

 

0 Likes
Olsch001
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hi dw,

thanks for your reply.

I found my issue in the iLLD library ifxCan.c in function boolean IfxCan_Node_isRxBufferNewDataUpdated(Ifx_CAN_N *node, IfxCan_RxBufferId rxBufferId).

If a buffer greater than 7 is used, tempVar never evaluates to TRUE. For example if buffer number 8 is used node->NDAT1.U & mask evaluates to 0b 0001 0000 0000  and after the boolean (unsigned char) cast it evaluates to 0b 0000 0000.

 

boolean IfxCan_Node_isRxBufferNewDataUpdated(Ifx_CAN_N *node, IfxCan_RxBufferId rxBufferId)
{
    uint32  mask;
    boolean tempVar;

    if (rxBufferId < IfxCan_RxBufferId_32)
    {
        mask    = (1U << rxBufferId);
        tempVar = (boolean)(node->NDAT1.U & mask);
        return tempVar;
    }
    else
    {
        mask    = (1U << (rxBufferId - 32));
        tempVar = (boolean)(node->NDAT2.U & mask);
        return tempVar;
    }
})

 

0 Likes
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

Hi Olsch,

It looks like you hit the root cause! Could you please try to use below instead

if(node->NDAT1.U&mask) 
    return True;

 Expect to receive your good news.

dw

0 Likes
Olsch001
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hi dw,

Yes, this works as well as the following.

 

        tempVar = (boolean)((node->NDAT1.U >> rxBufferId) & 0x01);
        return tempVar;

 

 

0 Likes