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 Bus- Differential?

Status
Not open for further replies.

dknguyen

Well-Known Member
Most Helpful Member
I am thinking of using the CAN bus as the main protocal for some things I'll be building and I've looked into a bit more. It just occured to me that I had always assumed CAN was differential (I'm not sure why, maybe I saw it mentioned somewhere a long time ago). But there is only one transmit pin and one receive pin on the dsPIC. Other places say CAN uses 2-twisted wires. I might have assumed that it was 4 wires total, with differential pairs being twisted but not I'm thinking it's not differential and that the transmit and receive wires are supposed to be twisted together.

So is CAN differential or is it single-ended? And what makes it allegedly able to work better in noisy environments if it is single-ended and not differential compared to other single-ended protocals?
 
Most CAN is differential, though there is a single-wire physical layer than has a significantly lower speed.

Neither differential nor single wire operates straight off those PIC/dsPIC pins! Those pins go to a CAN tranceiver. The CAN transceiver is a bit more advanced than a level shifter like the MAX232 does for serial comm.

The transceiver uses the CANRX and CANTX from the uC and controls the CANH and CANL differential pins of the bus.

Look at the MCP2551, a Microchip CAN transceiver. Comes in DIP pkgs, 3.3v compliant (good for the 33F), and cheap.
 
Last edited:
Ohhhhhhhhh. Then I need an actual transceiver/driver to use with the CAN pins that come off of the PIC? I can't just have two long bus wires and splice every CTX and CRX pin of all the PICs into this wire, unlike SPI or I2C? That clears stuff up. So there is a difference between a "CAN controller" and a "CAN transceiver" then? Why is a CAN bus this way while I2C or SPI are not? All differential protocals require some extra driving hardware or something?

PS. It doesnt seem like the 2551 can run at 3.3V?
 
Last edited:
dknguyen said:
Ohhhhhhhhh. Then I need an actual transceiver/driver to use with the CAN pins that come off of the PIC? I can't just have two long bus wires and splice every CTX and CRX pin of all the PICs into this wire, unlike SPI or I2C? That clears stuff up. So there is a difference between a "CAN controller" and a "CAN transceiver" then? Why is a CAN bus this way while I2C or SPI are not? All differential protocals require some extra driving hardware or something?

PS. It doesnt seem like the 2551 can run at 3.3V?
Yep. Unlike serial, I2C, or SPI, here is NO way to use this without a CAN transceiver.

A CAN controller such as the MCP2515 is a transceiver which handles additional levels of the protocol. The MCP2515 can allow a PIC16 to work as a CAN node because the PIC16 can configure the node and send and receive data packets through a SPI connection. The MCP2515 will understand the protocol, see packets, pick out packets which agree with the configured filter mask, acknowledge them, and buffer them. The PIC16 cannot possibly bit-bang this job by itself. The 2515 is not particularly expensive either.

There are even some cheap Microchip CAN controllers that can operate as a CAN node all by themselves without a microcontroller. They have an ADC input, PWM output, and/or some switch input/outputs so it can do useful things.

Damn, you're right. I thought the 2551 could go to 3.3v due to the note on Table 1-2 of the spec. I thought they didn't advertise it as such because it wouldn't technically meet the voltage levels on the bus. But Vpor IS greater than 3.3v so it can't come out of reset at all.

Need to go revisit a project I'm working on at this very moment, which needs that 2551 to work with the 33f! Damn you!

Another notable feature- CAN tranceivers allow a node to be unpowered without affecting the bus. With say I2C, putting 5v on an I2C pin will turn on the pin's protection diode, which will forward bias and conduct to Vdd. It can pull Vdd up to 4.3v and half turn on the device.

What microcontroller are you looking at? There are some bugs in some of the CAN modules.
 
Last edited:
Maxim has a bunch. With one of the ones labelled industry standard capable of being powered by 3.3V. BUt it still needs a 5V supply as well. Even the ones that only run off of 5V supplies seem to have compatible logic levels, as long as the uC has 5V tolerant inputs.

AMI Semiconductor has some that I like though too...again they all seem compatible with 3.3V logic. They are powered off of 5V except for one which needs a 3.3V supply and a 5V supply. Kind of pointless though.

I'm looking at the dsPIC 33Fs for the primary processing with the 30Fs controlling periphreal nodes like motors and things like that. But that's a bit away, I gotta build a reflow oven first, and then get the nitro truck suspension parts to turn into a robot, then build the H-bridges for it, then the 33Fs and 30Fs for the control board and servo boards.

This transceiver bit through could throw a wrench into my plans for a custom servo board. It's already really right on space, let alone for an SO-8 CAN transceiver package so the servo can be CAN enabled rather than I2C.
 
Last edited:
dknguyen said:
I am thinking of using the CAN bus as the main protocal for some things I'll be building and I've looked into a bit more. It just occured to me that I had always assumed CAN was differential (I'm not sure why, maybe I saw it mentioned somewhere a long time ago). But there is only one transmit pin and one receive pin on the dsPIC. Other places say CAN uses 2-twisted wires. I might have assumed that it was 4 wires total, with differential pairs being twisted but not I'm thinking it's not differential and that the transmit and receive wires are supposed to be twisted together.

So is CAN differential or is it single-ended? And what makes it allegedly able to work better in noisy environments if it is single-ended and not differential compared to other single-ended protocals?
WARNING
A CAN bus is actually quasi differential WITH RESPECT TO A COMMON GROUND. Read the Philips documentation on the PCA82C251 for a description of how common mode ground differences are handled over fairly large distances like 500 M. In an industrial CAN network like DeviceNet a typical common ground wire is 15ga. to minimize the IR loss which would contribute to common mode ground differneces.

Also. Chips like the Philips SJA1000 and the now obsolete PCA82C200 have output stages that can be configured and used without a transceiver. The more modern chips like the AT89C51CC01/CC02/CC03 do not support this seldom used technique. It would be possible with these controllers to do a CAN network on a single board without transceivers.

Lastly. You are no doubt aware that the datarate/cable length tradeoff is absolutely essential for proper operation. When a CAN node begins transmission each and every node must establish and stay in syncronization with the transmitter. This means that for a given datarate there is a maximum safe cable distance which can be used.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top