AnsweredAssumed Answered

STM32F429-Disco - TP - I2C

Question asked by Lukas on Apr 6, 2015
Latest reply on Apr 21, 2015 by blaha.fernando
I try to find some topick with same problem. But every topick is without the solution of problem.

I have problem with I2C in 95% (yep, sometimes it works, after restart, it not work). I try to comunicate with STMPE811 via I2C. I setup GPIOs for I2C3 (PA8 and PC3) and I2C3 timing.

// Configure I2C3 (100kHz standard)
I2C3->CCR    = 0xD9;               // Clock control - Th&Tl = CCR*PCLK => 5us
I2C3->CR2   |= (APB1clk / 1000000);     // Freq of APB1 in MHz
I2C3->CR1   |= I2C_CR1_ACK;          // Acknowledge returned after
I2C3->OAR1  |= 0x4000;               // Bit 14 Should always be kept at 1 by software. ?????? WTF!? OK, But why?
I2C3->TRISE  = (APB1clk / 1000000) + 1;     // Rise time = 1000ns

// Enable peripheral
I2C3->CR1   |= I2C_CR1_PE;          // Enable peripheral

Next I tryed to read an ID from STMPE811. I set bit START in CR1 and wait for SB bit.

// Generate start condiction
I2C3->CR1 |= I2C_CR1_START;
while(!(I2C3->SR1 & I2C_SR1_SB))     // Wait to SB

Voltages on lines are:
     SDA     0.1V
     SCL          3.05V

But SB bit is not set, never. It always is stuck in cycle.

Can someone help with it?
Thanks for any response.