View Single Post
Old 01-30-2011, 09:34 PM   #4261 (permalink)
EcoModding Apprentice
Join Date: Nov 2010
Location: Annapolis
Posts: 159
Thanks: 0
Thanked 29 Times in 24 Posts
Would removing the CAN make the hardware much simpler? A MCP2515 controller and transceiver are inexpensive, and make the controller far more expandable.

I would also bump the priority of a tachometer input. I use a ICP pin to trigger an input capture register freeze on a free-running 62.5KHz 16 bit timer, but a GPIO pin triggering an interrupt or just read in the 16KHz timer loop would give enough resolution to be useful.

Once you have CAN and a tachometer input, it's only a little more software to implement redline limits and fixed-RPM operation commanded over CAN. That gives you both cruise control and PTO/idle-speed option when paired with a instrument cluster ECU that has switch inputs. The instrument ECU can deduce the gear from speed vs RPM calculations, making per-gear redlines and shift control possible.

I also recently added a remote throttle CAN message. It was mostly for testing, but would also allow the body/instrument ECU to handle the pedal input. Combined with an isolated CAN transceiver ($3-$4 for a TI ISO1050 transceiver instead of $1 for a non-isolated, albeit the isolated part is only available in an 8SOIC package), that would make a traction voltage referenced motor controller a little safer to implement. (Although there isn't much of a problem leaving an engine compartment TPS referenced to traction voltage.)

Both command-operation messages (fixed-RPM and throttle messages) have a one second timeout as a fail-safe mechanism. The controller needs to send frequent updates or the cruise control / throttle drops to zero. The set-redline command setting persists, although a watchdog reset could unexpectedly clear it.

The point is that having CAN bus opens up opportunity for many advanced features. They can often be implemented without even changing the motor controller firmware. Putting a cap on motor current or speed when in reverse, motor speed matching for shifts, tweaking the current limits and P-I parameters for dropping traction voltage and S-O-C, and dozens of other features.

Last edited by DJBecker; 01-31-2011 at 12:24 AM..
  Reply With Quote