2020-04-14 01:40 PM
Hi all, I'm using STM32L476 and I am using its BxCAN with a transceiver TJA1042. I have the transceiver's RXD to STM32's CAN_RD1, and TXD to CAN_TX1. Both pins on STM32 are set to be pulled up. And the transceiver does have a 3.3V reference. There's only one master node STM32 and a sensor node that keeps broadcasting, so 2 nodes in total on the CAN bus. Also BxCAN is set to be in normal mode.I found only when TXD and RXD pins are connected the CAN initialization function doesn't fail. It always fails in the following lines in HAL_CAN_Init function,
while((hcan->Instance->MSR & CAN_MSR_INAK) == CAN_MSR_INAK)
{
if((HAL_GetTick()-tickstart) > CAN_TIMEOUT_VALUE)
{
hcan->State= HAL_CAN_STATE_TIMEOUT;
/* Process unlocked */
__HAL_UNLOCK(hcan);
return HAL_TIMEOUT;
}
}
This problem is also asked and discussed online in several places such as https://electronics.stackexchange.com/questions/353005/can-initialization-timeout-error-in-stm32f4 and https://community.st.com/s/question/0D50X00009hnkYESAY/halcaninit-returns-haltimeout-on-stm32f042
Does anyone know why this is the case?