AnsweredAssumed Answered

I2C problem: random error when I2C1 communicates

Question asked by prieur.jean on Jul 30, 2014
Latest reply on Jul 31, 2014 by prieur.jean
Hello everybody,

I have a problem when I try to communicate with I2C1 (on STM32F4DISCOVERY) and a touch panel controller (Azoteq IQS550).

First I have to say that I use I2C1 on the demoboard DISCOVERY which is reserved for CS43L22 (it uses the pins PB6 and PB9). But I think there is no problem to do that.

So my problem appears after an I2C START, I communicate with the controller by using WRITE, READ, REPEATED_START and STOP functions:

I2C1_Start(I2C_Direction_Transmitter); // Communication started
I2C1_Wr(0x11); // Send data address
I2C1_Wr(0x64); // Send data for Prox Threshold
I2C1_Wr(0x05); // Send data for Touch Threshold
I2C1_Stop();   // Close communication window
I2C1_Start(I2C_Direction_Transmitter); // Communication started
I2C1_Wr(0x11);  // Send data address
I2C1_Repeated_Start(I2C_Direction_Receiver);  // Issue repeated start signal
info_tt = I2C1_Read_Ack(); // Read first byte (Prox threshold)
info_tt =  I2C1_Read(); // Read second byte (Touch Threshold)
I2C1_Stop();            // Close communication windows

The START function works, but after the program get lost in the function "I2C_CheckEvent" with the status = error. This error happens not after a particular function above, it's quite random. But the error always happens.