Custom CAN Hub

Define Application

A Quick Overview of CAN

  • The Controller Area Network is a robust vehicle bus standard on data communication between multiple devices on the same group of wires

  • It is a multi-master, message broadcast system, the message sent from one device can be received by all the devices connected

  • Resilient to noise due to the differential voltage message delivery, 1 Mbit/sec on CAN, 5 Mbit/sec on CAN-FD

image-20240208-010558.png
An example of CAN encoding logic
image-20240208-010722.png
Figure of a CAN bus

The initiative to use CAN

  • CAN simplifies the wiring of the system a lot since we just need to attach each device to the same line, therefore also reduce a little bit of weight

  • CAN has a robust message format and robust resistance to electrical interference over long transmission

 

What about a CAN hub

  • CAN hub or CAN node for UAV application is a device that sources a few sensors that use different ways for communication, and the CAN hub can convert them into CAN messages, enabling non-CAN peripherals on the CAN bus.

  • DroneCAN is a common communication protocol for CAN in UAV, it is also supported by Ardupilot. The eventual CAN output from the CAN hub will also be under the DroneCAN protocol.

Plan for Implementation

 

  • The CAN Hub enables peripherals with non-CAN protocol to hop on a CAN bus with the MCU working as a protocol conversion unit

  • Multiple non-CAN peripherals can talk to the MCU. MCU will convert the message into DroneCAN messages that can be recognized by ardupilot

  • The output signal from the MCU will be more of a TTL signal, it will be converted into a differential signal through the CAN transceiver which will make the signal robust

  • Two CAN connectors allow the CAN hub to daisy chain with other CAN nodes. Both CAN connectors share the same CAN bus.

 

MCU Selection

  • UAVCAN has a low memory footprint.

    • Compatible with extremely resource-constrained bare-metal environments starting from 32K ROM, 8K RAM

    • There had been products using the following MCU to play the CAN controller role

    • NXP LPC11C24: ARM Cortex M0, 50 MHz, 8K RAM, 32K ROM, no RTOS

    • STM32F302: ARM CortexM4F, 72MHz, 16K RAM, 64K ROM, no RTOS

  • Decision Matrix

    • We are going to stick with ST MCU since the team has a good familiarity with it, and we can work with other types of MCU while prototyping

    • Not gonna constrain ourself on memory to the limit, we might need RTOS in this project so we need more memory than the minimum requirement

    • From the matrix, L431KC might be the best choice if we only want our can hub to be able to connect to single I2C, single SPI, and single UART, keeping the hub a small size/capacity

    • If we want more than two peripherals with the same protocol connected to the hub, then might start to consider L431CB as it has more pins to make it compatible

MCU
Price if buy one

Flash / RAM (bytes)
Clock Frequency

# of Pins &

# of CAN supported

Total Connectivities

MCU
Price if buy one

Flash / RAM (bytes)
Clock Frequency

# of Pins &

# of CAN supported

Total Connectivities

STM32F303CB

10.11$

128K / 40K

72MHz

48 pins
1 * CAN 2.0

4*SPI, 3*I2C, 5*UART, 4*ADC

STM32F412CGU6

17.78$

1M / 256K

100MHz

48 pins

2 * CAN 2.0

5*SPI, 5*I2C, 4*UART, 1*16 ch ADC

STM32L431CB

8.09$

128K / 64K
80MHz

48 pins

1 * CAN 2.0

3*SPI, 3*I2C, 4*UART, 8*Timer

STM32L431KC

8.84$

256K / 64K

80MHz

32 pins

1 * CAN 2.0

3*SPI, 3*I2C, 4*UART, 8*Timer

References:

https://www.ti.com/lit/an/sloa101b/sloa101b.pdf

https://www.anyleaf.org/blog/can-bus-on-uavs

https://ardupilot.org/copter/docs/common-uavcan-peripherals.html

https://ardupilot.org/copter/docs/common-uavcan-adapter-node.html

https://docs.px4.io/main/en/dronecan/ark_cannode.html?_ga=2.235567490.285784550.1709424335-781902902.1709424335#ark-cannode

https://docs.px4.io/main/en/dronecan/px4_cannode_fw.html

https://www.nxp.com/design/design-center/development-boards/automotive-development-platforms/s32k-mcu-platforms/s32k146-uavcan-v1-and-mavcan-development-system:UCANS32K146?tid=vanUCANS32K146

https://www.youtube.com/watch?v=MwdHwjaXYKs

https://www.mouser.com/pdfDocs/NXP_UCANS32K1SIC_UM.pdf