cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F412VG - CAN SCE Interrupt problem

RCLER.1
Associate

Hi,

I have a problem in my program with the CAN SCE Interrupt.

I work with a STM32F412VG but I have the same problem with a STM32F413VG, STM32F103C8 and STM32F042K6. And I work with MikroPascal Pro IDE from MikroElektronika.

I try to get an interrupt when there is an error in the CAN bus, and to achieve that I try to use the CAN SCE Interrupt.

The problem is that the register (CAN_IER) is configured in accordance with the reference manual for the STM32F412VG but the interrupt is never triggered by the CAN1_MSR.ERRI flag. The flag CAN1_MSR.WKUI triggers correctly the interrupt.

I monitored the CAN1_MSR register to verify that the bit is really set when there is an error and it is set correctly (tested with an ACK error), the only thing that doesn't work is the trigger of the interrupt.

In the configuration procedure, I configure the CAN_IER like that :

CAN1_IER.LECIE := 1; //LEC Code

CAN1_IER.BOFIE := 1; //Bus OFF

CAN1_IER.EPVIE := 1; //Error passive

CAN1_IER.EWGIE := 1; //Error warning

CAN1_IER.ERRIE := 1; //Error interrupt -> don't trigger SCE

CAN1_IER.WKUIE := 1; //Wake up interrupt -> trigger SCE

NVIC_IntEnable(IVT_INT_CAN1_SCE); //Enable SCE Interrupt

and in the interrupt (wich is not triggered by CAN1_MSR.ERRI), I clear the CAN1_MSR.ERRI bit.

Thanks in advance for your help.

Regards.

1 REPLY 1
Ruthvik-Ramesh
Associate II

hi @RCLER.1 ,

did you get a solution for this , i too am facing a similar problem.Also can you tell me how you conducted the test for ACK error. i am using a STM32F103C8T6 and i am learning about can error handling and have not been able to simulate them.