cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Problem with STM32F103ze and Sensor

sam239955
Associate II
Posted on February 20, 2012 at 21:28

Hi,

according to my thread in my native language (german): http://www.mikrocontroller.net/topic/249457&sharp2558731

I wanted to find a solution for my problem.

I have Keil + STM32F103ZE + ITG3200 (http://invensense.com/mems/gyro/documents/PS-ITG-3200-00-01.4.pdf Gyroscope Sensor. Connected on I2C1 and a second ITG3200 sensor on I2C2.

At the moment I'm trying to read out the sensor on I2C1. But I get stucked in the line:

/* Test on EV5 and clear it */

while

(!I2C_CheckEvent(ITG_I2C, I2C_EVENT_MASTER_MODE_SELECT)); and Line: ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx, uint32_t I2C_EVENT) in the STM32f10x_i2c.c I directly connected SCL (PB6) to the Sensor SCL and the SDA (PB7) to SDA.

My Board uses a 16mhz HSE and the Std.Lib is configured for that.

At the Screenshots in the first links you will see the Clock's and I2C Registers

I attached my code.

Maybe some one has a solution.

Thanks for help

with regards

Sven

//Links:

Link to sensor manual: http://invensense.com/mems/gyro/documents/PS-ITG-3200-00-01.4.pdf

#i2c-stm32
3 REPLIES 3
sam239955
Associate II
Posted on February 20, 2012 at 23:29

I have no Pullups on the sensor SCL SDA Wire ... is that maybe the problem?

Its the only sensor at the Port and the distance is 1cm to the mcu.
emalund
Associate III
Posted on February 20, 2012 at 23:35

very likely.

you MAY be limping along with internal pullups, but a reasonably low pullup resistance is essential for a well performing I²C bus.

ALSO read the errata, the  I²C in the f1xx requires a lot of TLC

Erik

sam239955
Associate II
Posted on February 20, 2012 at 23:52

yes its horrible !

Thats why i used the working code from the ST -INEMO Board.