Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

LIN API with C++ in MFC Application

Hi,

I am trying to use the LIN as slave device. LIN will send response frame based on the ID and Header get from the MASTER which is one type of controller.Once master Frame will come LIN(Slave) will fill the data in the frame and will reply back as response frame.I am using the MFC to generate the GUI and talk to the LIN ( using the LIN API in lower layer to talk LIN hardware). Now when I am Writing using "ncWrite" command using my GUI to send the response frame it is generating the STATUS error message eventhough the data that get sent is correct. I can disable the STATUS check and get rid of the problem but I want to know the reason for it.

Let me know if I clear my self by describing what am I doing?

Thanks

Chirayu

0 Kudos
Message 11 of 14
(2,536 Views)

On your picture with the GUI and the error message, your data has 9 bytes. Why are you using more then 8 bytes? You wrote the error happens on your slave write execution, but the Frame received by the master is correct? I guess you know, that you have to publish the slave data first, before you can write the header Frame from your master?

Could you enable Bus error logging to receive an error frame and could you send me a screenshot of this error frame?

DirkW

0 Kudos
Message 12 of 14
(2,525 Views)

Hi,

Good catch...But actually  first one is for the length. just to pass the length which is default 8.probably not required if I hardcode 8.But I don't know that you have to publish the slave data first before you write from the master.Here in my case Master is generating Header and Id first and than based on that I am publishing the data.But You know this "ncWrite" command is working without any problem if i run in normal C code (just like the example that give for LIN protocoal), which makes me confuse. I think on the last screeshot that you show has error logging enable and the message was like that. Do you think the error message would be more longer and come at different place if you have error log is enable.

Thanks

Chirayu

0 Kudos
Message 13 of 14
(2,520 Views)

Hi,

The error message would deliver a more specific error information, so we could see when and where it happens.

My guess is that somehow the timing is not correct in your system of writing the response and writing the header. It stioll works but it seems the driver detects a violation.

I would recommend to post the slave response first and write the header then, at least if the response is releated to the header. (same ID)

DirkW

0 Kudos
Message 14 of 14
(2,512 Views)