2017-12-19 03:24 AM
Hi,
I'm using one STM32F2 board and two STM32F3 boards. The F2 is the CAN master and the F3 are slaves. Everything works fine if I use only one F3 board. If I add the other one, then after 30sec - 5min one of the F3 boards is going to always return HAL_TIMEOUT from HAL_CAN_Transmit.
This is the code from HAL_CAN_Transmit that always returns HAL_TIMEOUT.
/* Check End of transmission flag */
while(!(__HAL_CAN_TRANSMIT_STATUS(hcan, transmitmailbox)))
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((Timeout == 0U) || ((HAL_GetTick()-tickstart) > Timeout))
{
hcan->State = HAL_CAN_STATE_TIMEOUT;
/* Cancel transmission */
__HAL_CAN_CANCEL_TRANSMIT(hcan, transmitmailbox);
/* Process unlocked */
__HAL_UNLOCK(hcan);
return HAL_TIMEOUT;
}
}
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
I'm using STM32CubeF3 V1.9.0
Here is a snapshot of my CAN registers right before the return HAL_TIMEOUT;
#can-bus #stm32-f3 #hal #can2017-12-19 11:52 PM
The bug gets triggert if there is a collision on the CAN bus. eg. if two devices send a frame with the same CAN priority at the same time. This will permanently lockup the TX of one of the devices.
2017-12-27 07:32 AM
Hello
alexander.siebert
,The issue related to
HAL_CAN_Transmitis
already raised internally to our development team and we would inform you that there is a plan for 2018 to reworkHAL CAN driver.Thank you for your understanding.
Kind Regards,
Imen
2017-12-27 04:21 PM
How did you configure the CAN on the STM32F3s? I've been trying to port the CAN networking sample code from the F3 eval board to the STM32F303re Nucleo board and have been having nothing but troubles. I'm routing the CAN pins to PA11 and PA12. It appears I can generate a packet on the bus but I've been unable to receive. Also, the interrupts don't seem to be firing.
Any setup suggestions appreciated. Also, what CAN bus analyzer are you using? I have the Ginkgo USB-CAN Interface adapter and its software is very obtuse.
Thanks
2017-12-28 12:57 PM
its the same message ID issue.
different boards should use different message IDs
after a bus error like that, you have to power cycle all the boards.
2018-01-23 04:09 AM
I have a similar problem too, CAN-TX-TIMEOUT always occurs on the client. I've replaced the Cube-HAL (2.7.0) with the Keil-HAL (2.7.0) problem solved.
2024-10-17 04:47 AM
Is there a work around for this? Is it possible to detect if the CAN module is in a locked state and then free it?