cancel
Showing results for 
Search instead for 
Did you mean: 

I2C and CAN-Bus conflict, Gyro freezes

arman1371
Associate
Posted on July 04, 2016 at 15:52

Hi,

I'm using MPU-6050 (3-axis gyro and 3-axis accelerometer) and CAN-Bus on a STM32F105 chip.

I'm pulling data from gyro every 100ms, it works fine until I enable Receive Interrupt of CAN1 (In which is connected to car ecu can bus)

I have configured filters for CAN1 to receive only 4-5 can frames, so I don't think the micro is being flooded with CAN frames.

The weird issue is that after a while of working (10 - 20 minutes), the program will freeze on I2C_WaitOnFlagUntilTimeout, seems that the I2C transfer is interrupted or something.

Are CAN1 and I2C1 have conflicts when it comes to receive interrupts of CAN1?

I2C1 is mapped to PB6 (SCL pin) and PB7 (SDA pin) and CAN1 is mapped to PB8 (TX pin) and PB9 (RX pin).

I should mention that if I don't enable the receive interrupt of CAN1, the Gyro works fluently for days!

What can be the cause of this?

If it's necessary to provide some code, please tell me.

#hal #can #canbus #i2c #stm32
3 REPLIES 3
Walid FTITI_O
Senior II
Posted on July 05, 2016 at 15:58

Hi safikhani.arman,

Would you mention the device you are using , and I2C transfer type you have done ( polling, interruption or DMA) ?

-Hannibal-

Itamar Eliakim
Associate III
Posted on July 02, 2017 at 11:22

     any luck?

     i have the same issue with USB CDC & MPU 6050, using I2C 

polling.

S.Ma
Principal
Posted on July 02, 2017 at 16:17

Try to put I2C interrupt priority higher than can interrupt. = lower level. This to check if it is a timing issue. Otherwise, check for signal crosstalk on pcb generating glitches.