Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send header frame + 1 byte of data in LIN network ?

Solved!
Go to solution

Hi,

 

I am using USB 8476 to communicate to a slave unit in LIN network. Can anyone tell me how i can send a header file plus 1 byte of data to the slave in a LIN network.

 

I need to send a sync + break +  id 00X34 followed by one byte of data. I am not sure how a master can send this additional 1 byte of data. I need to send this command to light up the LED's and the 1 byte to control the level of illumination of the LED.

 

If anyone has any examples for this, can you share it here ?

 

Thank you

 

0 Kudos
Message 1 of 5
(7,658 Views)

Hi TBSCV,

 

did you already try the LIN example

C:\Program Files\National Instruments\LabVIEW x\examples\nican\LIN - Basic.llb\LIN Master Send Full Frame and Receive.vi

 

You can find the LIN examples in your example finder if you browse by Task to "Hardware Input and Output > LIN > Basic"

 

The used command ncWriteNet allows you to specify a data length.

 

LIN.png

 

Best Regards,

 

Andreas Stark
Senior Transportation Systems Engineer
0 Kudos
Message 2 of 5
(7,612 Views)

Hi Andreas,

 

Thank you for the reply. Yes I have used this example and now it is working. The problem was that the data length was not correct and so the Slave unit was not responding.

 

Can you help me with an error I am gettin 10 40 01 02. I found out that this error means that the sync byte was not recieved correctly. But am not sure how to fix the problem. At first I thought it was a problem witht he slave. But the slave unit is functioning correclty. Can you tell me how i can correct this error ?

 

Thank you.

0 Kudos
Message 3 of 5
(7,603 Views)

Hi TBSCV,

 

I'm not sure if you found the right error. You can find all documented error codes in your NI-CAN help for ncSetAttrib. 10 40 01 02 isn't one of them. Please double check your error code.

Did you check if your LIN device uses LIN 2.0 or above? If so you have to change to enhanced checksum by using ncGetAttrib. 

 

You can find a good introduction to LIN here: Introduction to the Local Interconnect Network (LIN) Bus

 

If you are sure the error is the sync, you can try modifying the Bit timing register on the USB LIN in MAX.

 

Best Regards,

Andreas Stark
Senior Transportation Systems Engineer
0 Kudos
Message 4 of 5
(7,600 Views)
Solution
Accepted by topic author TBSCV

Hi Andreas,

 

This error has not been documented yet, but I got the information from the other forums.

 

Error Name                            Error Code (hex)    Description

LinBusErrorTxSyncTimeout         1040                  The LIN interface master task attempted to send a

                                                                           sync byte and did not self not receive the sync byte

                                                                           within the timeout period.

 

This is the description. The problem is solved, the baud rate i was giving was higher than the slave units baud rate. Now it seems to be functioning correctly.

 

Thank you.

 

0 Kudos
Message 5 of 5
(7,594 Views)