Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

CAN Protocol

Status
Not open for further replies.

beenuseren

New Member
hello everybody,

Does anyone the implementation of CAN protocol. The controller I am using is LPC 2129 (32 bit controller).

Any book which I can refer to the protocol.

Thanks.
 
Look for the Bosch CAN specification. They were the original developers for automotive ABS systems.

Go to the Philips website and look for the datasheet on the SJA-1000 which is a stand alone controller. Look for App Notes on the application of the controller. Also look at the spec for the 82C251 CAN Transceiver and any application notes associated with part

Go to the ODVA website for CAN and DeviceNet references

Check out the Yahoo group for DeviceNet.

Check out the CANOpen resources on the web.

I think Dr. W. Lorenz, an early CAN researcher, wrote a book some years back. Cant remember the title.
 
Atmel has a whole series of AVR CAN chips, even if you don't chose to use on, the usually have a lot of apnotes you might find useful...
 
Currently learning the ECAN module of the Microchip's 18F4585.

My suggestion (up to now it worked for me):

Read the CAN bus including revision 2.0B (get it from Bosch site).

Later, choose one micro / stand alone IC doing CAN handling and stick to it until getting a node sending/receiving basic messages.

I am about to enter a working network with my node. For the moment, a step by step approach worked OK. Loopback mode is the best help for testing during learning.

Before posting ANY question I spent my time (a lot) reading all posts in the CAN forum (forum.microchip.com) minimizing my newcomer questions.
 
Last edited:
Well...

Well...

CAN is a bit time consuming to learn...

for easy learning of CAN - please follow the following steps...

start with introduction:

Read this article after getting it printed.

http://www.electrosofts.com/can/index.html

Next step:

Start from page number 30 i.e. Part B of this tutorial...

**broken link removed**

Part A of this tutorial is out of date and not is in use for new designs.

Next step:

After getting the overview of CAN ...

if want to continue in hardware then buy a cheap simple CAN Board.

Or

Download any simple CAN Project from Internet.

Regards,

Simran..
 
Sample CAN program

hi all,

Thanks for all the replies.

Actually I am trying to program the CAN portof LPC2129 controller, which has ARM7TDMI controller.

I am trying to understand the CAN protocol from the internet literature. I could understand some part of it.

But I am clueless about writing the program for CAN. Like the programming steps or the algorithm.

Does anyone have a sample program for CAN on LPC2129?

Regards
beenuseren
 
Well...

Hi,

This is the question that can be answered well by members of lpc2000 yahoo group.

Joining that group can be helpful for you...

Regards,

Simran..:)
 
beenuseren said:
hi all,

Thanks for all the replies.

Actually I am trying to program the CAN portof LPC2129 controller, which has ARM7TDMI controller.

I am trying to understand the CAN protocol from the internet literature. I could understand some part of it.

But I am clueless about writing the program for CAN. Like the programming steps or the algorithm.

Does anyone have a sample program for CAN on LPC2129?

Regards
beenuseren
Just think of a CAN controller as if it was a UART with 64 bit characters.

What exactly is the mental block you are suffering from?
 
Ques abt Can protocol

some ques abt the CAN plz reply

1) If there are only two nodes on the bus, and both are transmitting same identifier,who will win the arbitration or what happens?

2) what is the vtg difference for dominant 0 and for recessive 1 bit?

3) If there is only one node on the bus and it is transmitting messages on the bus continuously, what will happen? Is node will go into the bus-off state or what happens?

4) Is CAN full duplex? what is the significance of Extended frames other than that it can be used for generating more identifiers?

PLZ reply
 
some ques abt the CAN plz reply

1) If there are only two nodes on the bus, and both are transmitting same identifier,who will win the arbitration or what happens?

2) what is the vtg difference for dominant 0 and for recessive 1 bit?

3) If there is only one node on the bus and it is transmitting messages on the bus continuously, what will happen? Is node will go into the bus-off state or what happens?

4) Is CAN full duplex? what is the significance of Extended frames other than that it can be used for generating more identifiers?

PLZ reply

Please try not to hijack threads. THere is a "POst New THread Button". Use it. And we appreciate you using mostly real english, but "vtg" is terrible, even for text speak. It's practically gibberish.

(1) First one to send the dominant bit anywhere in the message wins, exactly the same way the identifier works. It just takes more message to be sent before the one that loses arbitration knows it. Once it detects a bit other than what it sent it will stop transmitting it's own message and listen.
(2) Look at a few CAN transceiver datasheets for answer 2.
(3) I don't think there is a problem there as long as the message is a real one and doesn't break any rules to make it seem like the transceiver is faulty.
(4) CAN is half-duplex. One differential pair means one message at a time.

https://www.softing.com/home/en/ind...-bus/more-can-bus/index.php?navanchor=3010320
It's far more detailed and visual and much easier to understand than any PDF application note I have seen. GOod read for the OP and Aafaq would be better off learning how the CAN bus works instead of coming up with scenarios to ask about by also reading it. It's a very interesting read and very ingenius the way the CAN bus works.[/B]
 
Last edited:
Friend u didnt get my ques 1 and 3. I know the bitwise arbitration process which u written and q is if both transmit at the same time with exactly the same identifier.
and for q 3 ,only one node transmitting and there is no other node on the bus. so every time an ack errror will be generated .Finally what will happen to to the bus.
I had studied CAN in detail.These are the ques which I had faced in the interview.
 
I did answer your question 1. You might have read the bitwise arbitration process but you didn;t think about how it works in all cases as you were reading.

Think about this:
Suppose two devices transmitted the same message. Who wins arbitration? Does it even matter? No it doesn't matter because the message on the bus is what each device is trying to send. Each device will think it has won arbitration but it doesn't matter because they are sending the same message.

So now think about what happens when the identifier is the same, but the data is different. Think about what happens when the identifier is the same, the first half of the data is the same, but the second half of the data is different. In all these cases, all transmitting devices will assume they have won arbitration and continue to send their message. They will continue to send their message and continue to think they have control of the bus until they try to place a recessive bit on the bus but have it read back as a dominant bit. When this is happens, the device knows that another device was transmitting a message that was identical up until this point and has won arbitration of the bus. The device then stops transmitting so it doesn't corrupt the other device's transmission and listens to the bus instead. The device that won arbitration doesn't know that there were other devices also contending for the bus- it just keeps sending as normal until it's message is done.

You can think of both data frame as operating the same way as the identifier does for bus arbitration. The identifier exists to assign message priority without without interring with the data. But if two messages have the same identifier then the data becomes part of what decides who gains control of the bus during arbitration. The first device to send a dominant bit while the other devices send a recessive bit wins control of the bus NO MATTER WHERE THIS BIT IS. It could be a bit in the identifier or the data. It doesn't matter.

CAN Bus Arbitration Method

TO my understanding, this works because a bit error only happens when a dominant bit is placed on the bus but a recessive bit is readback from the bus. If a recessive bit is placed on the bus but a dominant bit is read back, this is not considered a bit error (because it can mean another device with higher priority is transmitting).
--------
Oh I see. I misunderstood your question 3. You say there's only one node constantly transmitting with no other nodes on the bus to acknowledge. If the transmitting node gets no acknowledge then it will start an error frame after which it will try again to transmit the message.
CAN bus Error Handling - Acknowledgement Error

If there continues to be failures, the transmit error counter keeps increasing until it passes the threshold. When this happens the node goes into shutdown because it thinks it might have failed and would rather not inadvertently interferre with other communications that might be happening on the bus.
CAN bus Error Handling - Transmit Error Counter
CAN bus Error Handling - Fault Confinement Rules 1-4
CAN bus Error Handling - Fault Confinement Rules 8-12

Try running through that website. Because I only knew the general basics for the your questions. I had to go through the website myself to refresh and verify everything before answering your questions.
 
Last edited:
How can the below fault analysis system implemented?
The docs shared is not available now
 

Attachments

  • CAN Fault analysis.pdf
    325.5 KB · Views: 311
How can the below fault analysis system implemented?
The docs shared is not available now
Try a new thread, this one has been dead 6 years!!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top