I need to control a LIN slave device via CAN.
The LIN slave device to control sends data on 2 ID's (1F and 21) and I need to send a signal on ID 1E to set a speed of the LIN device. I need to recieve the LIN data via CAN and send the required speed via CAN to LIN.
It is almost working fine, but I can only recieve data from the LIN device or set speed. It is not working if I try to do both. If I turn off the master functionality in PCAN-LIN CT I am able to set speed via CAN, but I don't recieve any data from the LIN slave. If I turn it on again, I recieve data, but I am not able to set speed via CAN.
Attached you can find my configuration. In the Sceduler there are only the 2 ID's (1F and 21) defined. In the frame configuration there are 3 ID's configured. (1F and 21 as subscribers and 1E as publisher)
I would be very glad to hear from you.
- (45.66 KiB) Downloaded 186 times
to control a LIN slave with PCAN-LIN through CAN you have two options:
1. use the PCAN-LIN as LIN master with active scheduler
2. use the PCAN-LIN as CAN-LIN gateway and send all subscriber and publisher frames by CAN
To use the PCAN-LIN as a LIN master, you have to set the termination to master, this was not done in your attached config!
here the details for solution 1:
- you have set the publisher frames in the frame config and set some default data for them. You need to setup a scheduler for all messages (subscriber and publisher frames) with the timing as defined in your ldf (you forgot 0x1E in your scheduler list). You also have to take care for the correct length code and checksum type. As long as the scheduler is active, PCAN-LIN will send out the defined default data for the publisher frames and will get the LIN slave data for the subscriber frames. If you want to change the default publisher data by CAN, you have to send a CAN frame with the following ID: LIN-ID +0x40 + CAN-ID Offset. In you case you have to send CAN ID 0x5E with 8 data bytes, to change the publisher frame 0x1E while the scheduler is active. Please see also the online help of PCAN-LIN CT, where you will find examples for this use case.
here the details for solution 2:
- you have to setup all frames to subscriber, but set the length code and checksum type to the needed values of your LIN system (see ldf). Now, while no scheduler is active, you can generate publisher frames on the LIN with a normal CAN message (e.g. 0x1E with 8 databytes) and generate subscriber frames with a CAN RTR message (e.g 0x21 dlc 8 RTR and 0x1F dlc 8 RTR).