Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIN transceiver #2

Open
slabiak opened this issue Mar 12, 2016 · 10 comments
Open

LIN transceiver #2

slabiak opened this issue Mar 12, 2016 · 10 comments

Comments

@slabiak
Copy link

slabiak commented Mar 12, 2016

Hello, do I need to use a LIN transceiver (for example this one http://www.atmel.com/images/atmel-4916-lin-networking-ata6662c_datasheet.pdf ) with your library? I want to generate LIN 2.0 master frame with 8 bytes of data. I used your library to do that, my code looks like this:
void loop() {
uint8_t cmd1[] = { 0x47, 0x20, 0xF8, 0x73, 0x00, 0x00, 0xCF, 0xFF};
uint8_t cmd2[] = { 0x44, 0x10, 0xF0, 0x73, 0x00, 0x00, 0xCF, 0xFF};
uint8_t cmd3[] = { 0x23, 0xF0, 0xF0, 0x73, 0x00, 0x00, 0xCF, 0xFF};
uint8_t cmd4[] = { 0x5d, 0x47, 0xF0, 0x73, 0x00, 0x00, 0xCF, 0xFF};
uint8_t cmd5[] = { 0xE4, 0xD0, 0xF0, 0x73, 0x00, 0x00, 0xCF, 0xFF};
uint8_t cmd6[] = { 0x42, 0xE1, 0xF2, 0x73, 0x00, 0x00, 0xCF, 0xFF};

lin.send(0x30, cmd1,8,2);
delay(70);
lin.send(0x32, cmd2,8,2);
delay(70);
lin.send(0x33, cmd3,8,2);
delay(70);
lin.send(0x35, cmd4,8,2);
delay(70);
lin.send(0x36, cmd5,8,2);
delay(70);
lin.send(0x37, cmd6,8,2);
delay(70);
}
when i look at the TX through my saleae analyzer i see that data bytes are okay but there is something wrong with the checksum, i don't know what's the reason.

lin

@gandrewstone
Copy link
Owner

Yes, I used the ATA6663: http://www.atmel.com/images/atmel-9146-lin-networking-ata6663-ata6664_datasheet.pdf

You absolutely need a transceiver to communicate with LIN devices (unless of course your uP has an integrated transceiver)... I do not think that the transceiver chip would affect the checksum though (or any other bits). AFAIK it just handles the electrical issues

@tlewiscpp
Copy link

Thank you for the information. Follow up question, my LIN device operates
at 12V. Does the transceiver step the voltages down so it can communicate
serially with the Arduino's 5V hardware serial port?
On Mar 14, 2016 2:27 PM, "gandrewstone" [email protected] wrote:

Yes, I used the ATA6663:
http://www.atmel.com/images/atmel-9146-lin-networking-ata6663-ata6664_datasheet.pdf

You absolutely need a transceiver to communicate with LIN devices... I do
not think that the transceiver chip would affect the checksum though (or
any other bits). AFAIK it just handles the electrical issues


Reply to this email directly or view it on GitHub
#2 (comment).

@gandrewstone
Copy link
Owner

yes look as section 3 (Absolute Maximum Ratings) of
http://www.atmel.com/images/atmel-9146-lin-networking-ata6663-ata6664_datasheet.pdf
.
the LIN pin ranges from -27 to 40 v, the logic pins (including TX) from
-0.3 to 5.5v.

On Mon, Mar 14, 2016 at 3:19 PM, Pinguinsan [email protected]
wrote:

Thank you for the information. Follow up question, my LIN device operates
at 12V. Does the transceiver step the voltages down so it can communicate
serially with the Arduino's 5V hardware serial port?
On Mar 14, 2016 2:27 PM, "gandrewstone" [email protected] wrote:

Yes, I used the ATA6663:

http://www.atmel.com/images/atmel-9146-lin-networking-ata6663-ata6664_datasheet.pdf

You absolutely need a transceiver to communicate with LIN devices... I do
not think that the transceiver chip would affect the checksum though (or
any other bits). AFAIK it just handles the electrical issues


Reply to this email directly or view it on GitHub
#2 (comment).


Reply to this email directly or view it on GitHub
#2 (comment).

@tlewiscpp
Copy link

tlewiscpp commented Jan 28, 2017

Sorry to revive this old thread, but the ATTiny167 appears to be a rare AVR 8-bit chip that supports a LIN controller on the UART pins. Since there exists a port of the Arduino libraries for the ATTiny line, this would eliminate then need for an external LIN transceiver, right? I apologize for the basic questions.

EDIT: Nevermind, I have found the answers to my questions. The answer is NO, the ATTiny does not have a built in LIN transceiver. This software repository is a software implementation of a LIN master MCU, that MUST communicate via TTL serial levels (pins 0 and 1 on the Arduino UNO, or any other UART - The Arduino Mega has 4 of them) to a dedicated LIN transceiver. The one I've found that is the easiest to "breadboard" is the MCP2003/4-A series (http://www.microchip.com/wwwproducts/en/MCP2004A). So, you will communicate with a LIN transceiver IC using the software gandrewstone has written over a dedicated TTL serial port (as I mentioned, pins 0 and 1 for the Uno, or any other UART), and you will attach your LIN bus (LIN only uses 1 pin for data, and 1 pin for GND) to the LIN transceiver.

@t3rral33t
Copy link

I'm trying to make this LIN communication work and I could really use some guidance. I want to use an ATmega2560 as a master and have multiple Atmega328p for slaves. I could really use some help understanding how to implement this code and what to change for the master and slave devices. Any help would be very much appreciated, Thanks in advance.

@ghislaingautier
Copy link

I'm trying to use this project with this Lin board and an arduino UNO.
http://skpang.co.uk/catalog/linbus-breakout-board-p-1417.html
have someone experienced it?
i cant make it work till now. are they "compatible"?

@trainman419
Copy link

@ghislaingautier that should be compatible; I have a similar project using the MCP2003B and an Arduino Uno that was originally based on this library: https://github.com/trainman419/bekant

@ghost
Copy link

ghost commented Oct 21, 2018

@trainman419 do you know how i must use your libary to connect two of these boards https://copperhilltech.com/lin-bus-breakout-board/ with an Arduino Mega2560 one as slave and the other as master and then the master should say "hello" to the slave so that i can read it from the Arduino

@trainman419
Copy link

@philipk25 sorry; this project and my project only implements the LIN master.

@ghost
Copy link

ghost commented Oct 21, 2018

@trainman419 do you know a libary for a lin slave to use on this breakout board?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants