Robust and easy to implement serial bus (automotive application) [closed]
What serial communication bus would you use in a automotive embedded system if your main selection criteria were:
- Electrically robust
- Slow speed (32 kb/s)
- Easy to program
- Easy to interface with microcontrollers
It won't be transferring much data, but it will need to be transferred periodically at high speed (100 - 500 Hz). I find that RS-232 is just not reliable enough if you have noise in your ground line. CAN-bus seems interesting, but I have no experience with it.
We are currently interested in a combination of AVR AT90CAN128 microcontrollers.
You've already chosen the AT90CAN128, whose standout feature compared to other AVR processors is support for the CAN bus. There really is not a better choice than CAN for an automotive application with your data rate and noise immunity requirements. If you march in to an automotive customer with anything other than CAN, you'll end up spending all your time defending the decision not to use it.
With that said, for noise immunity in a hostile environment like a car you'll need a bus using differential signaling. That rules out i2c or SPI, which is unfortunate because they meet your other requirements. RS-485 would be workable as @Andrew Edgecombe points out.
If you're not building a commercial product but instead building something for your own use to put in the engine compartment, you can probably get by with USB. USB will make it easy to interface with a laptop in the passenger compartment, and though it isn't designed for high-noise environments it is differentially signaled at a reasonably high voltage.
For all out reliability you can't go past CANbus (but then that was sort of implied by your choice of processor?)
Depending on what you want to interface to, this can be very simple - the base level protocol is quite straight forward. But if you want to talk to any other non-proprietary devices you'll have to implement the higher protocols (eg. CANopen).
But if CANbus isn't appropriate, then I would recommend RS485 or RS422 (depending on your topology). If all you're trying to achieve is point to point communications it's identical to RS232. (you'll have to put your own protocol layer on top if you're trying to support multidrop comms though.)
I would always suggest that CAN is the best in automotive communication.
- It has got differential line which can withstand even if there is a electrical glitch in the data transfer in physical layer
- it can provide reliable speed, it serves 500KBaud rate speed in most of the automotive software applications.
- interfacing is also easy if you know CAN controller mailbox and register structure.
As others said, CAN is standard, robust, more robust with slow speed etc.
And there's even support in Linux kernel for it from version 2.6.15 if you ever need bigger system.