Main Site Documentation

Debugging I2C based on STM32F4


#1

Dear

I used I2C bus in STM32F429II for getting data from I2C sensors. As I can get data a few hours, suddenly, i2c bus communication is not success. The time is changed, not fixed period.

So I debugged native source with ST-Link. Target file (STM32F4_i2c_functions.cpp) is in
PK>DeviceCode>Targets>Native>STM32F4>DeviceCode>STM32F4_I2C>

There are two interrupts for getting event or error interrupt. And I could find the interrupt working like below:

CASE1) Success on I2C communication
-> Only STM32F4_I2C_ER_Interrupt is called when I send command

CASE2) Sensor is not connected or Sensor cannot get data from first data request command
-> STM32F4_I2C_ER_Interrupt and STM32F4_I2C_EV_Interrupt are called in turn

CASE3) While data communication works, suddenly it is not
-> Never called the interrupt

What I want to figure out is case3, and it is from which side in hw or sw. I guess it’s on sw and looking for error in related registers.

Is there anyone who find same issue?

Jiwon


#2

@ Jiwon,

Because you’re playing with the porting kit, it will be difficult to help you as most of us are using GHI Libraries, already ported to the related hard…

Also I don’t think the STM32F429 is in the scope of any board provided by GHI yet…


#3

CASE 3 will always be a problem. A missed IRQ or the slave having problems independant of the mpu hardware. I think you will need an I2C timeout scheme where you reset the interface and test for a locked / missing slave.