FSAE CAN Bus Implementation - Page 1
Forum section: electronics / projects

author: CalebMcNevin
author_rank: Newbie
timestamp: November 08, 2013, 05:07:17 pm
content: Hey guys,So, I'm designing the data-acquisition system for my university's FSAE team (we build a small formula style car mostly from scratch). I'm planning on implementing something called the CAN bus. My question is this: How do I actually implement a bus system with wire? Do I make a single terminal with multiple 3-way connections, or do I use multiple 3-way splice terminals along a main bus wires? I thought about just cutting the bus and twisting the wires together at any junctions, but then you get a big node sticking out of your wire and I'm pretty sure that's not good for data transmission. BTW, the CAN bus transmits at a maximum speed of 1Mbit/s, and the voltage level is usually 3.3V or 5V. I'm using an AT90CAN128 micro from Atmel but I couldn't find the CAN bus voltage level in the datasheet. Maybe it's just Vcc? (I hear that you usually use an opto-isolator anyway, so it probably doesn't matter). Any ideas on how I can practically do this? It always looks so simple on the schematic . . . :pThanks,Caleb

author: tszaboo
author_rank: Super Contributor
timestamp: November 08, 2013, 06:05:40 pm
content: You should not make "big" Y connections on CAN. It should be as reasonably small. One of the de facto connectors is DSUB-9. I'm sure, that you cannot connect any microcontroller directly to CAN. It has a separate physical layer chip, sometimes SO8 package. If you look carefully, you will see, that the MCU pins are named CAN_TX and CAN_RX (or similar) while the bus is CAN_H and CAN_L. Designing with CAN is simple, and you only need 3 wires. Softwer implementation is somewhat more complicated than serial port. The real problem is usually the architecture of the communication.Read this:http://www.ti.com/general/docs/lit/getliterature.tsp?baseLiteratureNumber=slla270And CAN debugging 101: Check termination resistors, check termination resistors, check termination resistors...

author: xolott
author_rank: Contributor
timestamp: November 08, 2013, 06:58:31 pm
content: Quote from: NANDBlog on November 08, 2013, 06:05:40 pmThat's true!I did a implementation in my university of a custom bus protocol between 10 MCU. In some nodes group I used a PCB with just conectors to make the distribution in the next branch. This is much better that make wire splice, which look awful and is impractical.

author: Baliszoft
author_rank: Frequent Contributor
timestamp: November 08, 2013, 10:24:04 pm
content: As mentioned previously: use a dedicated CAN transceiver before/after each MCU (f.eg MCP2551), optionally a CAN choke before each transceiver (+extra ESD protection if needed). Then, use a pair of twised wire with both ends of this "chain" terminated and just simply attach your devices (to any point in between terminations). If there will be only two devices interconnected you may put the termination in these devices. This short appnote basically tells you everything you need to know about the can physical layer:http://ww1.microchip.com/downloads/en/appnotes/00228a.pdf

author: Baliszoft
author_rank: Frequent Contributor
timestamp: November 08, 2013, 10:34:13 pm
content: Quote from: NANDBlog on November 08, 2013, 06:05:40 pm2 wires only. In a car, these wires are also twisted together. Some transceivers can even work with a single wire only (with the other one open or short to ground/battery).

author: kaz911
author_rank: Super Contributor
timestamp: November 09, 2013, 02:42:38 am
content: I use the TI ISO1050 opto isolated can transceiver - One side isolated CAN signals - the other side RX/TX that interfaces directly with MCU's with RX/TX on 3.3-5V - dependent on what VCC1 you feed it.You would normally use a twisted pair cable for the CAN signals to keep external noise impact equal on both channels.TI will send you a free sample kit of the ISO 1050.http://www.ti.com/product/iso1050.There is also a banana plug demo board available.And since I'm using it for marine CAN (NMEA2000) I have an opto isolated power regulator in there as well - taking 12v from the NMEA 2000 and converting it to 5v isolated to the MCU side.

author: tszaboo
author_rank: Super Contributor
timestamp: November 09, 2013, 09:11:49 am
content: Quote from: kaz911 on November 09, 2013, 02:42:38 amFYI TI is using capacitive isolation in their stuff.Quote from: Baliszoft on November 08, 2013, 10:34:13 pmThe grounds needs to be connected together somehow. In a car sure, you can ground them with the chassis. And if something CAN work that way, it doesn't mean it should be used that way. Even the lack of termination resistors could mean your system doesn't go through EMI/RFI regulations.

author: Baliszoft
author_rank: Frequent Contributor
timestamp: November 09, 2013, 10:09:31 am
content: QuoteWell, erm, yes. You are right.BUT,1.: We are talking about a car in this case.2.: As far as i know CAN has been developed by Bosch especially for automotive use. Why would you want to use it for something else if that needs an additional wire? (BTW: how about the fourth +ve then)3.: Floating grounds are allowed (to some extent), just read the app note i linked above.4.: Who said that termination may be omitted?5.: Who cares about EMI/RFI regulations in a one piece school project?

author: kaz911
author_rank: Super Contributor
timestamp: November 09, 2013, 05:21:29 pm
content: Quote from: NANDBlog on November 09, 2013, 09:11:49 amold habits die hardYes I know it is capacitance isolation - sorry for the "opto" reference - but its is more than adequate for NMEA 2000- and I like it much more than some of the other CAN transceivers.

author: JonnyBoats
author_rank: Regular Contributor
timestamp: November 09, 2013, 05:59:27 pm
content: Quote from: kaz911 on November 09, 2013, 02:42:38 amSlightly off topic, but can you tell me if you are using the NMEA approved connectors and if so where do you source them?

author: matkar
author_rank: Regular Contributor
timestamp: November 09, 2013, 09:51:51 pm
content: Look athttps://www.phoenixcontact.com/assets/downloads_ed/global/web_dwl_technical_info/CANopen.pdffor different CAN connection solutions. I've seen most of them being used by many different producers/installers. I've used many of them in my designs as well. Whatever connection you choose respect CAN physical recommendations (trunk length, drop down length, termination, twisted pair...) and you'll be fine. The cheapest and quickest way is to use UTP cables. You can use the remaining twisted pairs to transfer power to the nodes.I'm also interested in cheap source of NMEA 2000 (M12 aka Micro-C) connectors, terminators and Tee-s.

author: LukeW
author_rank: Frequent Contributor
timestamp: November 13, 2013, 10:37:45 am
content: CAN transceivers expect to see the balanced pair to have a characteristic impedance of 120 ohms, don't they?Good old ubiquitous UTP Cat. 5 has a characteristic impedance of 100 ohms. Close enough or good enough for fast CAN?I don't know, I've never tried it. But it would be a good choice if it works since it will cost nothing compared to proper 120 ohm cable marketed for CAN/RS485 etc. automation buses.Regarding the grounding question... given that CAN is a balanced pair, if a proper transceiver chip is used it will tolerate a common-mode offset between the grounds of different nodes, within a certain limit, check the datasheet for that limit. So the integrity of low-resistance chassis ground between the network of different nodes isn't critical.

author: kaz911
author_rank: Super Contributor
timestamp: November 13, 2013, 10:41:57 am
content: Quote from: JonnyBoats on November 09, 2013, 05:59:27 pmThey are not hard to source - they are just expensive. Molex makes them. They are also used on other devices like my SnakeEye "bore-scope" camera. I don't remember the part numbers on top of my head - but Maretron sells connectors at more or less the same price as molex (same connector)

author: ju1ce
author_rank: Regular Contributor
timestamp: November 13, 2013, 11:09:40 am
content: Quote from: NANDBlog on November 08, 2013, 06:05:40 pmHow about LPC11C22?

author: kaz911
author_rank: Super Contributor
timestamp: November 13, 2013, 11:21:43 am
content: Quote from: ju1ce on November 13, 2013, 11:09:40 amyes that has can transceiver built in. Give-Away - is CAN RX/TX pins = Need transceiver -/ CANH/CANL = Has built in transceiver. But that is not so relevant for applications where you need isolation like marine or automotive.

author: jerry507
author_rank: Regular Contributor
timestamp: November 14, 2013, 03:27:28 am
content: Neat, never seen a micro with a can transceiver integrated.Cat5 will work fine for CAN. Given that the overwhelming majority of RS485 use trash cable and a lot of off highway stuff doesn't use any particularly special cable at all, you'll see absolutely no problems.Just don't forget that ground... Yea it may tolerate it but the best practice is having it. Every standard that uses CAN specifies a ground pin. It's not just for common mode, it helps with ground bounce and other integrity issues at higher baud rates. It's one extra wire, so the benefits don't exactly need to be large.