2015-07-23 02:27 AM
I have a problem with the CAN Interrupt.
My application is only listening, then I disconnect the CAN plug and get sometimes a CAN Stuff Error, this is ok, because it happens really.I read out the error and acknowlege in the HAL_CAN_IRQHandler.after reading the LEC bits are 0x00only the Error Interrupt is not cleared -> ERRI is always 1. Therefore the CAN Interface generates always new interrupts and never comes back.The only solution for the moment is to shut down the whole system by: HAL_NVIC_SystemReset(); inside the ErrorHandler function.Is there really no better solution?I tried with HAL_CAN_DeInit() but this does not clear the ERRI bit. #stm32 #can2015-07-23 05:03 AM
A disconnected but enabled CAN interface is in a permanent error condition. The error interrupt is what it's supposed to do while waiting for a remote node to connect. You have to disable the interrupt and sleep the CAN interface to suppress the errors.
What I do when a CAN bus is disconnected is to disable the CAN interface for a period of time, enable it to see if another node is connected, and repeat until I see a remote node responding. Jack Peacock2015-07-23 08:06 AM
Thank's to everybody who helps in this forum.
Issue is solved!In the error handling at the end of the HAL_CAN_IRQ routine there is missing to clear the ERRI bit.The ERRI bit has to be cleared by writing 1 into that bit (not 0).After this modification the CAN Interface can be disconnected and connected as you like!2015-07-24 04:06 AM
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2016-02-29 04:22 AM
Hello Mayla,
this means it is a bit strange to write a ''1'' if you want a ''0'' :-)But it is written correctly in the manual, those who can read are in front :-)2016-03-25 09:41 AM
2016-03-25 09:46 AM
BTW, could one show the place in manual?
I found only:ERRI: Error interruptThis bit is set by hardware when a bit of the CAN_ESR has been set on error detection andthe corresponding interrupt in the CAN_IER is enabled. Setting this bit generates a statuschange interrupt if the ERRIE bit in the CAN_IER register is set.This bit is cleared by software.