cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_CAN_Init returning an error

GEsch.1
Associate

I'm getting started with the CAN controller on the STM32F105. One of the first issues I'm running into is that the HAL_CAN_Init() function returns an error. It seems to time out while waiting for CAN_MSR_SLAK to be cleared. Where can I find more information about this?

Note:

  • I have connected a CAN transceiver to the corresponding ports but there is no traffic on the bus yet. CAN RX is pulled high at 3.3 V.
  • Putting the CAN controller into loopback mode makes no difference
1 ACCEPTED SOLUTION

Accepted Solutions

Thanks Bouraoui. It turns out that the CAN RX and TX ports were mapped to the wrong GPIOs.

Regards,

Guy.

View solution in original post

3 REPLIES 3
Bouraoui Chemli
ST Employee

Hi @GEsch.1​ 

To be sure regarding GPIO configuration, peripherals clock gating... You can refer to CAN example available on STM32CubeF1 firmware package via this path STM32Cube_FW_F1_V1.8.0\Projects\STM3210E_EVAL\Examples\CAN\CAN_Networking

Bouraoui

Uwe Bonnes
Principal II

To my knowledge, Can init needs an ack from another device on the bus to succeed.

Thanks Bouraoui. It turns out that the CAN RX and TX ports were mapped to the wrong GPIOs.

Regards,

Guy.