2011-04-15 04:48 AM
STM32 I2C problem!
2011-05-17 05:31 AM
> SPI_InitTypeDef SPI_InitStructure;
Why SPI and not I2C?
> I2C_Cmd(I2C_EEPROM, ENABLE); > I2C_Init(I2C_EEPROM, &I2C_InitStructure); First, another order (Init, then Cmd), but it's enough to call Init only - look at the source code, PE bit is set by Init :). I've tested, it works.
>
I2C_GenerateSTART(I2C_EEPROM, ENABLE); > while (!I2C_CheckEvent(I2C_EEPROM,>
I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) I think, after START has been sent, you should wait for I2C_EVENT_MASTER_MODE_SELECT and there send the Address and wait for I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED2011-05-17 05:31 AM
Have a look these threads:
When it didn't work in my case, I initially forced clock pulses on the SCK line as one of the answers say and it worked. Check if both the SDA and SCK lines are high or not.
-Walid
2011-05-17 05:31 AM
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
change this line above to :
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
2011-05-17 05:31 AM
Thanks i will try to see if it will fix my problem!