Receiving LIN data from device

RS-232 to CAN/LIN Interface
Post Reply
plewandowski
Posts: 4
Joined: Wed 18. Nov 2020, 11:09

Receiving LIN data from device

Post by plewandowski » Tue 22. Feb 2022, 10:13

Hello Good Sirs,
I've got question regarding receiving status of LIN - device through RS232 communication.

My system looks like this
CarSeat -> PCAN-LIN -> rs232 MOXA ethernet -> PLC

Each time I'm sending any frames to the car-seat, in my receive buffor I get only "02 01 00 01" message - which is, according to Lin protocol definition RS232 return code (Byte 1 - STX, Byte 2 - Seq Code, Byte 3 - Error Code, Byte 4 - Checksum XOR error code)

My question is - what should I do to receive response from LIN device (in my case car seat) - I'd like to check status of frame 0x0B of the device (which consists of 8 data-bytes).
Additional question - in my PCAN-LIN device configuration Filter Mask should be set 0xFF or 0x00?

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

Re: Receiving LIN data from device

Post by M.Maidhof » Tue 22. Feb 2022, 11:14

Hi,

to get a response from a LIN device, you have to send a subscriber frame. Unfortunately you don't write which kind of frame you send (any frame?), so I assume you send a publisher frame, on which a LIN slave will not respond in any way, and you will only get a response from the PCAN-LIN itself, that it has received a valid serial command. To send a subscriber frame you have to OR the LIN ID with 0x80.

regards

Michael

plewandowski
Posts: 4
Joined: Wed 18. Nov 2020, 11:09

Re: Receiving LIN data from device

Post by plewandowski » Tue 22. Feb 2022, 11:20

M.Maidhof wrote:
Tue 22. Feb 2022, 11:14
To send a subscriber frame you have to OR the LIN ID with 0x80.

regards

Michael
Yes that was correct, i was sending publisher frame. Could you describe a little bit more what should I do when I'm expecting frame with ID 0x0B?

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

Re: Receiving LIN data from device

Post by M.Maidhof » Tue 22. Feb 2022, 11:43

Hi,

have a look here: viewtopic.php?f=22&t=6457

see page 9ff for more details how to send subscriber frames by serial, or have a look in the protocol definition pdf which will be installed along with PCAN-LIN CT.

A good solution will be to use PCAN-LIN CT to send those frames for testing, and copy the serial commands from there.

regards

Michael

plewandowski
Posts: 4
Joined: Wed 18. Nov 2020, 11:09

Re: Receiving LIN data from device

Post by plewandowski » Tue 22. Feb 2022, 11:54

Ok, so if I need status of frame 0x0B then i should send 0x02 0x21 0x81 0x8B 0x2B frame configured as subscriber in pcan-lin device?

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

Re: Receiving LIN data from device

Post by M.Maidhof » Tue 22. Feb 2022, 12:38

yes, correct. Please also set the checksum and length code of 0x0B in the frame configuration according to your LIN system.

plewandowski
Posts: 4
Joined: Wed 18. Nov 2020, 11:09

Re: Receiving LIN data from device

Post by plewandowski » Tue 22. Feb 2022, 13:02

Okay, one last question and I think I'll be ready to test it - in PCAN-LIN CT, profiles managment tab
Do I have to set filter mask for 0x00, or default 0xFF should do the work?

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

Re: Receiving LIN data from device

Post by M.Maidhof » Tue 22. Feb 2022, 13:53

keep the filter on default values, so that no filter is used and all messages could be received.

Marco
Posts: 4
Joined: Tue 15. Mar 2022, 10:38

Re: Receiving LIN data from device

Post by Marco » Wed 23. Mar 2022, 11:46

Hello everybody,
I would like to control the interface via PLC, as regards the code to be implemented, which command logic did you follow?
is it enough to send publisher frame in hex code, as if you were to control a normal serial device?
And how can i read the slave response?
thanks

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

Re: Receiving LIN data from device

Post by M.Maidhof » Wed 23. Mar 2022, 14:47

Hi,

please have a look on the protocol definition pdf file of PCAN-LIN, or have a look o the following post to see how you could send out publisher and subsciber frames by serial commands:

viewtopic.php?f=22&t=6457

regards

Michael

Post Reply