Ok then: Here are the sketches, the fritzing & the schematic with the debugger.
I know that in the fritzing & schematic the debugger is not the Arduino USB Serial but in reality it is, I just could not find this component within fritzing.
It's been a while since my last post here. The project was on hold for a bit since I had a big project at work and no time to spare. Today I've hooked up a 3th arduino to the LIN bus and made him send 4,5,6 instead of 1,2,3.
This means I have 2 "masters" and 1 slave, but it works just fine. Both of the masters are sending their messages when I press the button and the slave receives the messages perfectly. I've been trying to "break" the LIN bus for 30 minutes now by trying to press the buttons simultaneously and have only managed to "break" the connection once. A restart with the power supply and this was fixed.
I think this means that the LIN bus network can be expanded for further testing.
I've attached a new fritzing so you can see the connections I've made. There isn't a real schematic, but if you want I can make it.
The fritzing will show that I've moved the "master" resistor to the slave end. This resistor doesn't seem to make any difference to the function of this setup. I've tried to place the resistor at each Arduino and even multiple resistors but there is no change.
The resistor doesn't make any particular node a master as such. All it does is pull the bus line up to 12v. Having more resistors won't change this, it will only serve to reduce the effective value of the pull up resistor (resistors in parallel), so you don't want to go adding any extra resistors really. If you don't pull the bus line high, it will float around and you will not get reliable communication.
I think a true LIN bus has one master that requests data from all its slaves. This is how it avoids data collisions on the bus. Any given slave won't transmit on the bus unless it's asked to. Because we're using collision avoidance on all nodes, they're effectively all equal, so there isn't really a master node. They can all send at any time, as long as the bus is clear before they start.
I don't know what the practical limit is for nodes on this type of bus, but the BMW I-bus probably has about 30 or so.
I wanted to re-create your project for educational purposes. Simple question: what resistor values are you using? The resistors in your fritzing have some odd values, judging from the color bands.
tomhab:
Simple question: what resistor values are you using? The resistors in your fritzing have some odd values, judging from the color bands.
Hi,
Please excuse me for the delayed reaction. I've had a busy weekend and did not have the time to open my Fritzing. The resistor for the LIN master is 1k, the LED ones are 150 ohm.
has anyone got experience with running arduino with TJA1020 or TJA1021 LIn transcievers?
my code is handling the data layter just fine on UART so far, and i need to incorporate a LIN interface to perform the same tasks on a LIN bus.
any help in proper connections / tips would be great.
thanks.