CAN FD message rejected by PCAN-router FD

Universal Programmable Converter for CAN FD and CAN
Post Reply
ouma.a
Posts: 2
Joined: Thu 9. Nov 2023, 08:57

CAN FD message rejected by PCAN-router FD

Post by ouma.a » Thu 9. Nov 2023, 09:12

Hello,

I'm using PCAN Router FD to recieve CAN FD Msg and send CAN 2.0 Msg

When a message received on CAN2, I added a condition to test if it is a CAN FD msg or not.

this is my main fucntion :

Code: Select all

int  main ( void)
{
    HW_Init();
	
    // init CAN
    CAN_UserInit();

    // set green LEDs for CAN1 and CAN2
    HW_SetLED ( HW_LED_CAN1, HW_LED_ORANGE);
    HW_SetLED ( HW_LED_CAN2, HW_LED_ORANGE);

    // main loop
    while (1)
    {
        CANRxMsg_t  RxMsgCan2;
        // process messages from CAN2   Convert CAN FD -> CAN STANDARD
        if (CAN_UserRead (CAN_BUS2, &RxMsgCan2) == CAN_ERR_OK)
        {
            if  (RxMsgCan2.msgtype == CAN_MSGTYPE_FDF) {
                readCanFDRecieved(RxMsgCan2);
                sendNewMessage();
            }
        }
    }
}
I tested the soft sending a CAN FD Msg using "PCAN explorer", it works. I didn't have an issue with the condition "if (RxMsgCan2.msgtype == CAN_MSGTYPE_FDF)"

but, when i did a test on stellantis vehicule to validate the soft.
I had an issue, all CAN FD Msg rejected by the soft, the condition "if (RxMsgCan2.msgtype == CAN_MSGTYPE_FDF)" isn't satistfied.
It considere all Msg received ara not CAN FD msg.

I commented the condition and tested the soft again, It works OK. I received all message CAN FD.

Can you tell me how you know if it was an FD msg or not ? because i didn't have acces to the function setting RxMsgCan2.msgtype
Can you help me the resolve the problem please ?

!!!!! : I did an acquisation directly without using PCAN Router FD on vehicule and I have received all the CAN FD Msg OK)
Last edited by K.Wagner on Thu 9. Nov 2023, 09:17, edited 1 time in total.

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: CAN FD message rejected by PCAN-router FD

Post by M.Maidhof » Thu 9. Nov 2023, 10:00

Hi,

can you please trace the CAN FD data of the vehicle with PCAN-Explorer 6, to see what kind of FD messages are used on that system. Maybe it is just a bitrate setting problem of your PCAN-Router FD (use the same settings on the PCAN-Router FD as used with PCAN-Explorer 6). As a test, use the trace and replay it with PCAN-Explorer to test your PCAN-Router FD software.

regards

Michael

ouma.a
Posts: 2
Joined: Thu 9. Nov 2023, 08:57

Re: CAN FD message rejected by PCAN-router FD

Post by ouma.a » Mon 13. Nov 2023, 12:08

Hi,

Please find below the trace of CAN FD acquisition on the vehicle with PCAN-Explorer 6.

I tested also the condition : if ((RxMsgCan2.msgtype == CAN_MSGTYPE_FDF) || (RxMsgCan2.msgtype == CAN_MSGTYPE_BRS)) and it does'nt work all my message are rejected.

I hope the trace can help !
Attachments
RcvMsgsPcanRouterFD.txt
(5.91 KiB) Downloaded 4144 times

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: CAN FD message rejected by PCAN-router FD

Post by M.Maidhof » Mon 13. Nov 2023, 15:33

Hi,

the trace shows CAN FD message where FD and BRS are set. And those message types are bit coded. So your if statement will not work correctly when several messagetype bits are set.

Please try the following if statement:

if (( RxMsgCan2.msgtype & ( CAN_MSGTYPE_FDF | CAN_MSGTYPE_BRS)) == ( CAN_MSGTYPE_FDF | CAN_MSGTYPE_BRS))

regards

Michael

Post Reply