How does one make a start in LIN bus? - Page 1
Forum section: electronics / general

author: Simon
author_rank: Unknown
timestamp: October 04, 2021, 08:03:47 am
content: If I want to communicate with another device via LIN bus where do I start? I understand the basics of the protocol at the hardware/software level but clearly this is nothing like CAN bus. There is a whole load of code that does things like map each device to one of the 60 bus addresses. The only way to find out how that works I expect is to buy the standard and then spend a long time trying to write code that is compliant with the standard. Surely the route is to get some off the shelf library?Where do I start?

author: leeatljs
author_rank: Contributor
timestamp: October 04, 2021, 09:20:59 am
content: Have you something in particular you want to communicate with?The LIN standard has a few documented features to get things done, but talking to a specific device is left to the developer.There are some software and hardware tools already available to get started quickly running on a PC (I use canalyzer from vector) although they are quite expensive.The signalling can be done with any microcontroller with a UART. The device addressing can be fixed, so each node on the network is programmed with its NAD during manufacture, or it can be dynamically addressed if 'auto addressing' is being used (this requires an extra wire).

author: Simon
author_rank: Unknown
timestamp: October 04, 2021, 11:06:22 am
content: so LIN has 60 addresses. I buy an off the shelf device. There cannot be 60 unique addresses world wide. So each device needs setting up with a system address. how this works will be down to some protocol that either I learn and implement or can you buy the software?

author: leeatljs
author_rank: Contributor
timestamp: October 05, 2021, 08:12:37 am
content: Each LIN bus will usually only have a few devices on it, say about 10. Additional devices go on their own bus. The addressing is kept simple. Unless auto addressing is used, the NAD (its address) can be set by sending configuration frames.

author: cgroen
author_rank: Unknown
timestamp: October 05, 2021, 10:25:04 am
content: When I did LIN, I got the PLIN-USB from Peak Systems. I would have pulled (more of) my hair out if I had not had it, highly recommended!https://www.peak-system.com/PLIN-USB.485.0.html?&L=1

author: Simon
author_rank: Unknown
timestamp: October 05, 2021, 11:51:29 am
content: Quote from: leeatljs on October 05, 2021, 08:12:37 amOK, so does that mean you have to connect to each device and set the NAD up individually before putting it into the system? You see CAN J1939 which I am familiar with has a whole standard of addresses that you just look up or you agree the address with your customer/supplier. LIN is quite different, you can only do that if you make a device for one person and agree the address up front.

author: Simon
author_rank: Unknown
timestamp: October 06, 2021, 07:29:11 am
content: Basically my main query is if I buy the LIN standards and get reading, does that tell me what I need to know to talk to devices or does that tell me what requirements software I write must satisfy to deal with the protocol. And therefore do I need to buy the standards, understand them and then write my own libraries or are there companies that sell the libraries?

author: leeatljs
author_rank: Contributor
timestamp: October 06, 2021, 08:13:42 am
content: Yes, devices we supply to end customers are usually programmed with the address the customer has requested. If you buy the LIN standard it documents all the frames you need to program the NAD and more.The device dependant stuff wont be documented as this is left to device manufacturers, for example, if I got some interior lights from an Audi, I could do simple comms to them but I wouldn't be able to switch the light on without knowing the additional frame formats specific to that device.You can buy LIN libraries but its not that hard to implement your own, the LIN standard looks like there's a lot of stuff to implement but you don't have to implement it all to get stuff working.

author: Simon
author_rank: Unknown
timestamp: October 06, 2021, 09:01:15 am
content: Yes you have the equivalent of dbc files for lin (I can't remember the name) The last one I looked baffled me but then I had not made any inroads into how I just talk to the device and give it a NAD or find out what NAD it has.The position I am in is that I am alone, with a stack of projects to work on. Heavy research and development is something that my employer will happily trade for buying something off the shelf that saves us work and time. But at the moment I don't even know what to ask for.

author: leeatljs
author_rank: Contributor
timestamp: October 06, 2021, 09:06:50 am
content: I searched google for 'Updated document according to LIN 2.1 Errata sheet 1.4', the first link was the LIN spec V2.2A as a pdf.The hardware I use for development is the Vector VN1611 and CANalyser V11Any embedded LIN stuff is custom for PIC's etc. The only LIN stack we have bought is from Melexis, but that ties you in to a Melexis processor.

author: voltsandjolts
author_rank: Unknown
timestamp: October 06, 2021, 09:22:54 am
content: I think Simon is working with AVR, in which casethismightbe useful.

author: Simon
author_rank: Unknown
timestamp: October 06, 2021, 11:51:25 am
content: I do use AVR but in the future will be using the SAMC or SAMD. At the moment my quandary is not the low level stuff just the high level of what tools / software / other prerequisites do I need. The entire LIN standard that has now been issued and supersedes the available lin 2.2 spec is about £1'500, but does having it help me? If there are predefined commands I must send where do I find these?

author: Simon
author_rank: Unknown
timestamp: October 06, 2021, 12:00:47 pm
content: I'll read the app note, thanks. If I use any AVR it's the new mega/ex xmega / 0 series, but really what I am initially after is the basic concepts.

author: leeatljs
author_rank: Contributor
timestamp: October 06, 2021, 12:21:32 pm
content: Get the LIN spec, do the google search as above

author: JPortici
author_rank: Super Contributor
timestamp: October 06, 2021, 08:00:44 pm
content: I haven't had to do much work with LIN, but we always interface with existing networks so we can more or less reverse engineer the meaning of the frames. If we were higher in the good chain we'd probably have access to a datasheet or a database file explaining the frames the master have to send / have to request.on how to implement a transaction, i just followed the freely available document:https://lin-cia.org/fileadmin/microsites/lin-cia.org/resources/documents/LIN_2.2A.pdfi don't know if and how ISO/SAE Lin diverges from this.I have not needed more yet, though ISO 14229-7 is on the to buy list as i'd like to implement a bootloader for our devices, or at least a way to reconfigure them over lin using esixting protocols

author: Simon
author_rank: Unknown
timestamp: October 07, 2021, 07:33:48 am
content: Quote from: leeatljs on October 06, 2021, 12:21:32 pmi have it, but how up to date is it?

author: MadScientist
author_rank: Frequent Contributor
timestamp: October 07, 2021, 08:34:16 am
content: I’ve done some LIN on SAMD series. The issue is you need to decide what proportion of the LIN standards you will apply. You could build Lin 1.0 and it will be functional. If you are designing a closed architecture you can cherry pick the spec. If however you are designing for the greatest compatibility with other commercial LIN systems , you will have to research how much of the implementation you need to do. The LIN spec will not provide all the answers either

author: Simon
author_rank: Unknown
timestamp: October 07, 2021, 11:51:46 am
content: If I was doing a closed system I would not have to worry about the standard at all, just write the code for all my devices my way using the hardware functionality of the micro-controller. I will probably err towards SAMC as they also do CAN and will run up to 5V.I need to be able to interface to anything that I can buy off the shelf. So many devices are now offered as LIN bus only. Also my MD has come up with a mad plan to design car EVSE, I believe they use LIN if so right up to the latest LIN standard I guess. I have told him he is nuts but the whole LIN thing is on my personal to do list anyway. Problem with stuff covered by standards is that it's impossible to get out of anyone what exactly you need.

author: leeatljs
author_rank: Contributor
timestamp: October 07, 2021, 03:12:06 pm
content: Give us a clue, what do you want to interface to?

author: Simon
author_rank: Unknown
timestamp: October 07, 2021, 06:41:07 pm
content: Quote from: leeatljs on October 07, 2021, 03:12:06 pmAs I have already said, whatever any device I find I have to work with wants.