FrameID received wrong

The free LIN software API (Application Programming Interface) for Windows® (only for usage with the PCAN-USB Pro CAN/LIN interface)
Post Reply
etixier
Posts: 1
Joined: Mon 20. May 2019, 14:47

FrameID received wrong

Post by etixier » Mon 20. May 2019, 15:25

Hello,

I am currently working with the PLIN api, in order to send and receive predefined messages through A PEAK. I have created an application that communicate with the peak. The peak is used as master and I have only one slave.
The communication works well, and I can send message and receive the response from my slave, and the datas contained the response are correct.
However, the frameID of the received message is wrong.
Here is my reception loop :

Code: Select all

void linObject::readMessages()
{
    TLINRcvMsg RcvMessage;
    TLINError error = 1;
    do{
        error = LIN_Read(handlerClient, &RcvMessage);
        if (RcvMessage.Type != mstStandard)
        {
//            qDebug() << "message type wrong, Type = " <<RcvMessage.Type;
            continue;
        }
        if (error == 0)
        {
            qDebug() << "frame_id " << RcvMessage.FrameId;
            LinProcessMsg(&RcvMessage);
        }
    }while (!(error & errRcvQueueEmpty));
}

Have I missed something ?

Thank you for your help,

Best regards,

Elisabeth

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

Re: FrameID received wrong

Post by M.Maidhof » Mon 20. May 2019, 16:11

Hi,

please note that LIN_Read() will return the protected frame identifier, and not the LIN frame ID. See LIN spec. for more details on how to convert protected ID to LIN frame ID (Example: LIN_frame_id = RcvMessage.FrameId & 0x3F)

regards

Michael

Post Reply