The CAN Bus
The CAN bus is an 2-wire, 2 way differential communication bus. It will enable very fast communication without distortion.
AutoQuad has introduced it since Firmware 6.8 r270+ and in ESC32 r44+.
At this stage it will only communicate between the flight controller and the ESC32 but in future ideas it can be used for communication with additional devices. It also will enable 2 way communication, so the flight controller will now the status of the ESC32 (currently being implemented).
For AutoQuad and ESC32 to work with the CAN bus you need a DIMU with CAN transceiver onboard or a DIY CAN daughter-board.
The CAN bus will replace or used side to side to the PWM controller. It will enable very clean and simple wiring because the all ESC32 devices will plug into the CAN bus using the same 2 wires. Only 2 wires go to the DIMU CAN bus connector.
To enable the use of the CAN bus, every ESC32 needs to have a CAN transceiver and 0.1uF capacitor mounted. (as in the illustration below). The transceiver part is SN65HVD232D
CAN Bus Termination
The CAN bus is a differential bus which need to be terminated with resistors on both ends. The total bus impedance must be between 50 and 70 ohm. That can be accomplished by placing a 120 ohm resistor between the CAN_L and CAN_H connection points on both sides. For AutoQuad and its short wires (30 cm to a motor is short for the CAN bus), you can use a simple 60 ohm or 2 x 120 ohm parallel resistor on a DIY DIMU board (so only on one side of the bus). The AQ DIMU board already has 1 x 120Ohm onboard. You only need another 120Ohm resistor to terminate the bus.
Simple DIY CAN Bus Wire Harness
Software Settings
- Every CAN device needs a device ID. You can use any number you like but lets call ESC32 1, number 1 and so on. The param in the ESC32 for setting the device ID is ESC_ID. Open a terminal session to the ESC32 and enter ESC_ID 1 and CONFIG WRITE. Do this for every ESC32 on the bus with a unique device number.
You can also use the QGCS, use the ESC32 config tab to set the ESC_ID with the pull down menu.
The ESC32’s are now ready for participating on the CAN bus. - On the AutoQuad flight controller side a new param is introduced: MOT_CAN. This MOT_CAN is a 16 bit binary field for setting the motor controller to use CAN (1) or PWM (0). Yes you can mix CAN and PWM, for example on a hex motor 1-4 CAN and motor 5 & 6 PWM output.
Example MOT_CAN: Motor 1 – 4 is CAN, that will give a binary number of 1111 = decimal 15. MOT_CAN will thus be 15
Example MOT_CAN: Motor 8 CAN, motor 7 PWM, motor 6-4 CAN, motor 2 PWM: 10111000 = decimal 184
After a reboot you should now see CAN ESC32 discovery and version numbers in the communication console.
DIY CAN Daughter Board
At the moment of writing only a DIMU will be available with onboard CAN transceiver, but it for the experienced DIY builder it is not that hard to make your own CAN daughterboard if you are only interested in CAN and not in new IMU sensors.
DIYers can download or produce their own PCBs at Menno´s OSHpark page for misc. AQ boards. Eagle files available.
There are also boards for CAN distribution, Current sensor, LED signalling and more…
A BOM for the needed parts can be downloaded here.
If you would like to
etch your own board here´s the info:
Here is a link to the eagle (6) file to create your own board