Hot answers tagged

27

You need to be familiar with Transmission Line Theory to understand the deeper physics in play here. That said, here's the high-level overview: How important termination is to your system is almost exclusively determined by how long the bus wires are. Here length is determined in terms of wavelengths. If your bus is shorter than one wavelength over 10, the ...


21

Per Olin Lathrop's suggestion, I'll expand on bit-stuffing. CAN uses NRZ coding, and is therefor not happy with long runs of ones or zeroes (It loses track of where the clock edges ought to be). It solves this potential problem by bit-stuffing. When transmitting, if it encounters a run of 5 successive ones or zeros it inserts a bit of the other polarity, ...


20

From Controller Area Network Physical Layer Requirements CAN is an open collector technology – the protocol could not work otherwise. This means that the recessive state of a CAN transceiver is not actively driven. The termination resistors together with transceiver input capacitance and cable capacitance create an RC time-constant discharge when an ...


19

The CAN pins do not have fixed pin assignments. Instead you are able to select which of the "Remappable Pins" you wish to use (RP0 through RP15). If you refer to page 180 of the datasheet, specifically the table titled "REGISTER 11-16" (RPINR26: Peripheral Pin Select Input Register 26), it details the register used to select the CAN RX pin location (C1RXR). ...


18

That type of CAN bus is intended to implemented by a twisted pair of wires. The transmission line impedance of unspecified twisted pair isn't exact, but 120 Ω is going to be close most of the time for the relatively large wires commonly used for CAN. The resistors also have another function in CAN. You can think of CAN as a open collector bus ...


17

If there is no ISR defined, the location for the jump instruction in the interrupt vector will either be null, it may be a jump to an exception routine, it may jump to the beginning of the program, or it may contain a "return from interrupt" (e.g. RTI) instruction. Here is a disassembly of an interrupt table for an ATMega 16 processor showing three unused ...


16

No. The differential signalling is performing as intended. No. As long as the "common mode voltage" does not exceed the ratings of the transceiver. And the maximum DC ratings, which for a CAN transceiver like the MCP2551 is -42 V to +42 V. The twisted pair cable and the differential signalling mode make the single-end signals look like gibberish ...


16

Clearing up some misunderstandings will probably help. First, your data is a 16-bit value. There's no "overflows" and "actual data" -- the 16 bits are just divided into two 8-bit pieces (bytes). To get the right binary value, you need to concatenate the bytes. In C, you can do it by starting with unsigned values and using bitwise operators, like this: ...


15

It's included in the cost of the parts. It's a lot easier to collect money from a few IC makers than from every person who makes a product using those parts.


15

The shortest CAN frame is 55 bit times, so in the very worst case situation with a completely saturated bus consisting of one data byte frames (which is not really realistic for a CAN bus with any sort of useful performance) you will be receiving a frame every 220 µS (55 / 250000). The cheapest ST microcontroller that has a CAN controller is the ...


14

You can do that, but what you'll get on your CAN bus will be UART using CAN voltage levels. You have to supply the MCP2551 with CAN protocol messages if you want to communicate with CAN devices on your bus. Same for listening: CAN messages are so different from the UART format that the UART won't know what to do with them. You'll have at least frame errors ...


13

Section 6.1 of the CAN spec: BIT ERROR: A unit that is sending a bit on the bus also monitors the bus. A BIT ERROR has to be detected at that bit time, when the bit value that is monitored is different from the bit value that is sent. An exception is the sending of a ’recessive’ bit during the stuffed bit stream of the ARBITRATION FIELD or ...


13

Dominant is 0. Recessive is 1. Dominant applies to 0 because if two arbitration ID's are being transmitted at the same time and the first 4 bits are the same and the fifth is 0 for one of them and 1 for the other, the ID with the 0 will end up being transmitted. Transmission of the message with the larger arbitration ID will be tried again after the other ...


13

Do some time domain reflectometry, a useful video to this process is probably one from w2aew. He shows it with a coax, but it should work with anything that has a somewhat consistent impedance. In short: Inject a pulse with a short risetime into the cable terminate the cable with a potentiometer that has the range of suspected impedance (like 200Ω) Watch ...


12

I couldn't find any reference that gave a definitive answer. But looking at a few datasheets, I don't think so. USB is looking at the presence or absence of a change in voltage. Whereas CANBus is looking at the voltage itself. Here is an example of a USB transmission: The ones and zeros are coded depending on whether or not there is a transition. As ...


12

Each beginning has its end. This can't be answered, because the question is not correct. What you have is the transmission line - a twisted pair that has two ends, and that's the place where the termination has to be done. You can't choose the end of the bus, since there are only two of them.


11

A CAN bus is multi-master and automatically arbitration free. The whole point is that you don't need a single master or main controller to take care of everything. Each message that is sent has a priority, and higher priority messages trump lower priority ones (a lower priority message will wait until there isn't a high priority message being sent). So there ...


11

In addition to the perfectly accurate answer given elsewhere, it may also be useful to consider the lower level meanings of the phrases dominant and recessive. In both CAN and LIN at the physical layer the bus "floats" to a particular state when no nodes are communicating. This is the recessive state. Any node which drives a dominant bit will override this ...


11

If you are using a third-party CAN controller chip, then they will have paid the licensing fee. The original patents related to the way the controller worked, so the vendor requires a license in order to sell a controller chip without infringing the patents. However, the original CAN 2.0 specification was published in 1991, so the patents (sorry I can't ...


11

It doesn't matter which nodes are at the ends, but it does matter that the terminators are at each end. The bus is a transmission line. To keep edges from reflecting at the ends of the cable, the cable has to be terminated with its characteristic impedance. The common standard for CAN is twisted pair with 120 Ω impedance. You therefore need 120 &...


10

From a professional point of view, this is a critical problem. Missing termination will cause energy bouncing back at the end which isn't terminated. This could lead to strange random noise on the line, such as for example transients or random pulses that seem like ok binary pulses, but with wrong voltage levels etc. CAN Hi and Lo don't necessarily behave ...


9

All CAN hardware error checks are performed by hardware - the CAN controllers. A CAN node cannot ack itself, by design. It will not receive its own messages. CAN is meant to have at least two nodes to work - a CAN bus with just one node is considered faulty, it is common sense. Therefore it doesn't make sense to have an "independent check". (With one ...


9

You are getting confused about the impedance. The type of CAN you are apparently using is implemented as twisted pair with roughly 120 Ω impedance. That is why there is a 120 Ω resistor on each end. That means the bus looks like 60 Ω to a driver, but the transmission line itself is still 120 Ω. Since drivers drive in the middle of ...


9

When comparing the physical layer only, CAN and RS-485 are similar in that they both use differential signaling. This gives them both good common mode noise immunity. The main difference is that RS-485 uses symmetric signaling. One line is 5 V and the other 0 V to signal one state, then flipped to 0 V and 5 V for the other state. This makes detecting the ...


9

CAN does not have a formalized physical-layer specification for conductor colors, or things like connector type or pin-out. There are common practices (like using a 9-pin D-sub connector) but no official standard. Vehicles these days also tend to have multiple CAN buses, so colors will, of course, vary to keep the different buses straight. I have seen ...


8

We currently have a system with 10 microcontrollers on a CAN bus, and you can update the firmware on any of them over it. It works like this: The firmware on each MCU is made of two parts, the Bootloader and the Application. On power up, the Bootloader runs first. It checks a byte in the EEPROM which says whether or not a valid Application is loaded into ...


8

1-wire is not a good idea for distances like accross a house. It is inherently single-ended and relatively high impedacne, so quite susceptible to noise. Everything might work fine until the water pump in your furnace kicks in, or you run a particular blender with a failed line filter, etc, etc. I think CAN makes the most sense. The normal electrical ...


8

CAN modules will retransmit until they see an acknowledgement, so you need at least one other CAN device on the same bus with the same baud rate settings in receive mode. In CAN, the acknowledgement is done inside the ACK bit towards the end of the frame, rather than as a separate message. More details are in the paper Introduction to the Controller Area ...


8

CAN Bus is a differential bus. Each differential pair of wire is a transmission line.Basically, the terminating resistor should match with the Characteristic Impedance of the transmission line to avoid reflection. CAN bus have a nominal characteristic line impedance of 120Ω. Due to that we are using typical terminating resistor value of 120Ω at each end of ...


Only top voted, non community-wiki answers of a minimum length are eligible