CAN Programming

Hi,

Does anybody have tested if Arduino could be used as simple CAN controller? Maybe somwhere is code to create all necessary data to message frame? It should comply ISO 11898, end resistors of bus are 120 Ohm.

I've simple protocol, there is just one message frame type with 11 fields and bitrate is 125Kb/s.

Something about CAN for people never heard of it:

Basic idea is that CAN is two wires, CAN_LO and CAN_HI. If message pretends to be 0 CAN_HI is about 3,5 volts and CAN_LO about 1,5 volts. When value is supposed to be 1 then both CAN_LO and CAN_HI are 2,5 volts both.

All modules got all of the messages. They know who they are and first field of messageframe contains id field so every module can catch their own message.

WBR. Severi

While in theory, this should be doable, I'm not sure this is the right approach. CAN bus is not that easy (for example NRZ coding, bus arbitration, bit timing). I think also the arduino performance might not be sufficient if you do it all in software. I've connected a MCP2515 chip to my arduino to retrieve data from my car using the OBD2 connection and getting it to work was already complex, without having to deal with the internals of the CAN bus. A complete CAN interface for the arduino is less than 15? to build (with a MCP2515 and MCP2551). Unless you're working on a project under high cost constraint, I would really not go that way. But if you make it work, I would be more than interested to know how you've done it! My suggestion would be maybe to start with a MCP chip (or equivalent) to get familiar with the protocol and then try your approach. Regards

Thank you for advices. Yes I know that there is much of difficulties on my way. :slight_smile:

I’ve small hydraulic vent, (walvoil DPC130) on my tractor. At now I put that work with very simple analog circuit and joystick. Tractor do not have CAN itself so I must build it also.

We are designing automatic controlling for depth of seeding machine and it would be easier to do if all of work is done with arduino and not with that analog system and the arduino.

Still, that hydraulic vent is quite nice because it can be configured accepting PWM, CAN, various regulated voltage and even unregulated voltage. We propable in first case start with PWM.

Severi