stm32i2cgyroscopestm32f3

Can STM32F303 on-chip I2C be used, to connect to STM32F3DISCOVERY on-board gyroscope (I3G4250D or L3GD20)?


The STM32F3DISCOVERY board has an STM32F303VC microcontroller, which has built-in SPI and I2C support, and a gyroscope which supports both SPI and I2C.

Per the board's user manual and schematic, the gyroscope is connected to the microcontroller's PA5/6/7/PE3, which (under 'alternate function 5') are connected to its SPI1 bus (per the STM32F303VC datasheet).

So that makes it possible to use the on-chip SPI support to connect to this gyroscope.

But by keeping PE3 = CS_I2C/SPI high, the device (I3G4250D or L3GD20) runs in I2C mode, and the same PA5/7 pins can be used for I2C SCL+SDA.

My question: Is it possible to use the STM32's on-chip I2C support, to drive these PA5/7 pins and connect to this on-board gyroscope via I2C?

(I cannot find anything in the microcontroller's datasheet or reference manual, that would enable this. So the only alternatives seem to use SPI, or to do I2C by 'bitbanging' on PA5/7.)


Solution

  • There is no I2C on pins PA5 or PA7.

    What you can do is put PA5 and PA7 into high impedance mode (input or analog mode) and then connect jumper wires from them to PB6 and PB7 respectively where the I2C function is available and pull-up resistors are already fitted.