Question
I2C problem: random error when I2C1 communicates
Posted on July 30, 2014 at 17:17
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 forCS43L22 (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.