Author Topic: How does one make a start in LIN bus?  (Read 3918 times)

0 Members and 1 Guest are viewing this topic.

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
How does one make a start in LIN bus?
« on: October 04, 2021, 08:03:47 am »
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?
 

Offline leeatljs

  • Contributor
  • Posts: 31
  • Country: gb
Re: How does one make a start in LIN bus?
« Reply #1 on: October 04, 2021, 09:20:59 am »
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).
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: How does one make a start in LIN bus?
« Reply #2 on: October 04, 2021, 11:06:22 am »
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?
 

Offline leeatljs

  • Contributor
  • Posts: 31
  • Country: gb
Re: How does one make a start in LIN bus?
« Reply #3 on: October 05, 2021, 08:12:37 am »
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.
 

Offline cgroen

  • Supporter
  • ****
  • Posts: 631
  • Country: dk
    • Carstens personal web
Re: How does one make a start in LIN bus?
« Reply #4 on: October 05, 2021, 10:25:04 am »
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
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: How does one make a start in LIN bus?
« Reply #5 on: October 05, 2021, 11:51:29 am »
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.


OK, 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.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: How does one make a start in LIN bus?
« Reply #6 on: October 06, 2021, 07:29:11 am »
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?
 

Offline leeatljs

  • Contributor
  • Posts: 31
  • Country: gb
Re: How does one make a start in LIN bus?
« Reply #7 on: October 06, 2021, 08:13:42 am »
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.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: How does one make a start in LIN bus?
« Reply #8 on: October 06, 2021, 09:01:15 am »
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.
 

Offline leeatljs

  • Contributor
  • Posts: 31
  • Country: gb
Re: How does one make a start in LIN bus?
« Reply #9 on: October 06, 2021, 09:06:50 am »
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 V11
Any 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.
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2299
  • Country: gb
Re: How does one make a start in LIN bus?
« Reply #10 on: October 06, 2021, 09:22:54 am »
I think Simon is working with AVR, in which case this might be useful.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: How does one make a start in LIN bus?
« Reply #11 on: October 06, 2021, 11:51:25 am »
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?
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: How does one make a start in LIN bus?
« Reply #12 on: October 06, 2021, 12:00:47 pm »
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.
 

Offline leeatljs

  • Contributor
  • Posts: 31
  • Country: gb
Re: How does one make a start in LIN bus?
« Reply #13 on: October 06, 2021, 12:21:32 pm »
Get the LIN spec, do the google search as above :)
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: How does one make a start in LIN bus?
« Reply #14 on: October 06, 2021, 08:00:44 pm »
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.pdf
i 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
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: How does one make a start in LIN bus?
« Reply #15 on: October 07, 2021, 07:33:48 am »
Get the LIN spec, do the google search as above :)

i have it, but how up to date is it?
 

Offline MadScientist

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: 00
Re: How does one make a start in LIN bus?
« Reply #16 on: October 07, 2021, 08:34:16 am »
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
EE's: We use silicon to make things  smaller!
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: How does one make a start in LIN bus?
« Reply #17 on: October 07, 2021, 11:51:46 am »
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.
 

Offline leeatljs

  • Contributor
  • Posts: 31
  • Country: gb
Re: How does one make a start in LIN bus?
« Reply #18 on: October 07, 2021, 03:12:06 pm »
Give us a clue, what do you want to interface to?
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: How does one make a start in LIN bus?
« Reply #19 on: October 07, 2021, 06:41:07 pm »
Give us a clue, what do you want to interface to?

As I have already said, whatever any device I find I have to work with wants.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf