Enabling the CAN BUS causes the system to crash

Hello everyone,

I’m porting a PX4 to a flight controller board I designed myself. The system works fine until I activate the CAN BUS. After adding the following statements to my default.px4board file:

CONFIG_DRIVERS_UAVCAN=y
CONFIG_BOARD_UAVCAN_INTERFACES=1

and activating the CAN BUS and uploading it to the board, the board boots for the first few seconds but doesn’t work. It doesn’t even show up in Device Manager. Only when I remove the above CAN-related statements does the system work stably, but without CAN support.

Does anyone have any information on how to solve this problem, or what should my approach to this issue be?
Thanks.

Hi, I am facing a similar issue on my custom board. Whenever I enable the UAVCAN_ENABLE parameter, the system does not boot. However, if I run pwm_out stop from the console and then start it again using pwm_out start, the system boots successfully.

Also, no CAN node ID is being assigned/reflected because I am using NAND memory for internal storage and do not have an external SD card. I am currently working with version 1.18.0 (beta).

Hi, I solved this problem. CAN is uses TIM5 by default. But my FC is using TIM5 for motor control. When I changed the CAN timer TIM6(FC was not using TIM6) my FC started working.

You can look at this: default.px4board
CONFIG_BOARD_UAVCAN_TIMER_OVERRIDE=6