CAN protocol??

I would like to read data from a CAN device using a MCP2551 chip from MicroChip. Does anyone have any experience with this?

Can anyone also tell me in a couple of sentences how a CAN message looks like(data bits, control bits,...)?
I have already read the BOSCH CAN Specification 2.0, but can someone give me a short version in a couple of sentences please?

If anyone has any other pointers, I would be glad to hear them!

Thanks
Matic
 
Thanks for the replies guys!

I found a few thing from reading the microchip specification.

The chip transforms the diferencial voltage between CANH and CANL and transmits it to the RXD pin of the chip. That probably means that you get a stream of bits depending on what CAN Transmiting Device you connect the chip to.

Now I need to know which bits of this stream carry the information about the device and the transmited data from the device. I looked at the bit stream specification and it only says "Data Lenght Code", "Identifier", "Data Field",...

Can anyone tell me in simple terms which bits identify the device and how to decode the data that the device is transmitting?

Thanks
 
From what I can tell here, Data Length Code is the length of the data contained in that message, the Identifier is likely a code identifying what kind of data it is, and the Data Field is the data itself. This describes the format that the devices sends data in, but not what data the device actually sends. You need to know what self-identifying data a device will send, and then you need to make that chip read the data coming in, look for the self-identifying data, and translate that into something it finds useful.
 
Thanks Bobbias!

OK, lets say we have a analog temperature sensor that continuously transmits the temperature that is 1-byte(0-255) long. Lets say the temperature value is 10.
How would the "data field" and "identifier" look like?

Thanks
 
Can anyone tell me in simple terms which bits identify the device and how to decode the data that the device is transmitting?

Each message is comprised of:

Start of Frame: 1 bit
Message Identifier: 11 bits (In CANopen this is the COB-id)
Control bits: 3 bits (generally reserved in CANopen entworks)
Data Length Code: 4 bits
Data Field: 0-64 bits
CRC: 15 bits
Delimiter & ACK: 3 bits
End of Frame: 7 bits

If your devices uses the extended frame format then the message identifier is 29 bits.

If the encoding of the message results in 5 consecutive bits of the same level (0 or 1) a "dummy" stuffing bit of the opposite level is added to provide enough edges in the message for proper timing. Either your receiving chip has to pull this back out in hardware or you have to do it in software.

Have fun!
 
Also,

The maker of this temperature sensor needs to define what data it is sending. We cannot guess as there are an infinite number of possible encodings that they could have chosen for what number they will send.
 
Yes, finding that data may be rather difficult. If you knew what data it was going to send (maybe had a sensor sending data that was VERY close) you might be able to figure out how it's encoding the data (being able to see the encoded data from the sensor, and the decoded data coming from the sensor hooked up to something that can decode it), but even that is very difficult, because you'd have to get a clue of what type of encoding it uses, try to decode it, and see if it matches fairly closely with what you are seeing form the known sensor.

That's not a fun way of doing things.
 
OK, but lets say there is no encoding and we get raw data
(temp = 10(dec) or 1010(bin)), will I get Data Lenght Code = 1 and Data Field = 1010?

Also, what does the "Message Identifier" tell me?

thanks
 
If there is no encoding, than yes, the Data Field should contain 0b1010. As for the Message Identifier, that's one of the things we're talking about when we say we don't know what the specific hardware would send.

Interfacing on such a low level with the CAN protocol is not exactly a common thing. It's like learning a whole new language (spoken, not computer language, lol). Usually, if a company is developing something to interface on such a low level with the CAN protocol, they're likely going to be working with one of the other bg companies, not just making something in-house as it seems you are doing.
 
EDIT: I think I was slightly wrong.

And I was being lazy and not rewriting what was in the links, lol.

I actually took my information from the book I referenced earlier.

OK, but lets say there is no encoding and we get raw data
(temp = 10(dec) or 1010(bin)), will I get Data Lenght Code = 1 and Data Field = 1010?

Also, what does the "Message Identifier" tell me?

thanks

Let me save everyone a lot of time and me more gray hair. Do you have a specific device you are trying to communicate with? If so, please post information from that device. If this is hypothetical then the encoding can be whatever you want, it can be in degrees F or Degrees C or each number represents 10 deg C or 10 deg F or whatever? The process valve gets turned into a number. Both sides agree on what the number means and go on their merry ways.

The fact that you are asking what the "Message Identifier" tells you means that you need more information than we can provide in the 2 sentence answers you a asking for. Even that depends on the device you are communicating with. Right now, this is a mystery to everyone but you. How can we help without this information?

There is CAN which is a low level protocol and gives the developers of communications systems a way to identify messages. Again, all parties agree on how to interpret this field and go on their merry ways. There are at least three higher level protocols based on CAN (CANopen, Devicenet, J1939) which have very specific rules about what the message identifier field contains as well as how the data in the message field is encoded. Does your device use one of these protocols?
 

Similar Topics

Has anyone integrated a Hobart HTi retail label scale with a host application? This is a product/price database interface question, rather than a...
0
Replies
97
Views
Hi, I am Pandian. Looking for Omron PLC , PMCR protocol program troubleshooting Online support. If anyone willing to support, please message me...
0
Replies
82
Views
BMS person looking to integrate some data from an old IDEC FC3A PLC that is monitoring a fuel tank in the basement of a site in NYC. There is a...
4
Replies
411
Views
Hey guys, I’m having an issue with a Red Lion protocol converter. I’m unable to connect to it remotely even though I can successfully ping the...
8
Replies
756
Views
Hello PLCtalk community, My team at Softing Inc. is looking for a Staff Firmware Engineer to work on development of industrial communication...
0
Replies
335
Views
Top