
Allwinner A40i / T3 Support for CAN
There is no CAN controller in the CPU of the A40i or T3, and CAN is used in the actual use process, usually using the SPI-to-CAN method.
On the OKA40i-C substrate, there is an SPI, but since the voltage does not match the voltage of mcp2515, this set of multiplexes of serial port 2 is used as the SPI external mcp2515 module.
According to chapter III of the CPU manual, the PI17-19 can be reused as SPI1, with PH08 as the interrupt.
The A40i/T3 features pin reuse in sys_config.fex or dts configuration, and we configure it with dts below.
01- Turn on SPI1
Modify the sys_config.fex, remove the configuration of uart2, and turn on the configuration of SPI1.
Also comment out PH08:
Modify the device tree at the same time:
02-Modify defconfig
Using a drive mcp251x .c verified by other platforms and adapted to the device tree,
Modify the defconfig profile:
Networking support ---> CAN bus subsystem support ---> CAN Device Drivers ---> Selected for Microchip MCP251x SPI CAN Controllers.
Also check the SPI configuration, which is supported by default and is no longer described here.
03-Configure iprote
file system:
buildroot-201611/configs/sun8iw11p1_hf_defconfig
Need to configure the BR2_PACKAGE_IPROUTE2 sy.
Recompile, package the image, burn.
04-Test can0 node
After starting, ifconfig looks at the can0 nodes that appear. Test with the following command:
ifconfig can0 down
ip link set can0 up type can bitrate 125000 triple-sampling on
ifconfig can0 up
cansend can0 123#12345678
candump can0
If necessary, contact Forlinx Technical Services to provide the patch file.
Precautions
In the device tree, when used as an interrupt, because A40i/T3 can only use the pins of the PH group as an interrupt, the interrupt is set in the device tree as follows:
interrupt-parent = <&pio>;
interrupts =;
In addition, you need to pay attention to the interrupt trigger mode in the drive.