cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 CAN ERRI bit always set

SPLabs
Associate II
Posted on February 28, 2016 at 17:43

Hello,

I have a problem with CAN bus on STM32F103TB.

I have CAN_ESR register = 0 but still I get bit ERRI in CAN_MSR = 1.

If i try clearing it either via code or via debugger it will be set again by hardware.

I've searched on lastest datasheet, reference manual and erratas but there is nothing.

Any advice? 

Thanks

#can #canbus #stm32f1
5 REPLIES 5
Posted on February 28, 2016 at 18:31

Ok, but what is happening externally on the bus, and in your system design and how does that reflect on the status and settings internally?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SPLabs
Associate II
Posted on February 28, 2016 at 19:01

I'm trying to simulate bus faults and handle recovery.

I have only one other device on the bus, and i have ABOM enabled.

This is what i'm doing:

- i have a loop to send a message every 50ms. on reset everything works fine.

- i remove the termination to simulate a fault. The code enters in CAN1_SCE_IRQHandler as expected.

- when i restore the termination the transmission does not restart. If i clear ERRIE flag it restarts but ERRI stays true even if TEC reaches zero. That means if i enable again ERRIE bit i get stuck in the interrupt handler even all the fields in CAN_ESR are zero...
Posted on February 28, 2016 at 19:38

What's in all the other CAN registers and FIFOs, and what is the EC set too?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
aravasio9
Associate
Posted on March 30, 2016 at 10:08

Hi,

the manual is not clear, I had same problem. You shoud clear ERRI flag by writing 1 to it (not writing 0).

CAN1.MSR|=(1<<2);

Bye
SPLabs
Associate II
Posted on April 10, 2016 at 23:40

Thank you Andrea, this solved the issue! I still encounter some HAL_LOCK issues but nothing impossible to fix.

Thank you very much!