AnsweredAssumed Answered

Can't communicate between STM32L and LSM303DLHC

Question asked by tondato.stefano on Jan 23, 2012

Hi all,
I created a simple circuit connecting a STM32L151C6T6 to a LSM303DLHC accelerometer. They communicate using I2C interface. I made the first simple test program modifying I2C EEPROM example included in STM32Lxx Peripheral libraries (version 1.0.0): the only difference from my project to ST example is that I didn't use DMA to access to sensor.
My problem is that even though the STM32L generates the clock and the correct sequence StartBit/7bitAddress, LSM303DLHC doesn't ACK on nineth clock cycle.
I don't know the origin of the problem, but it seems that STM32L works fine, while sensor seems in a I2C locked-state. I noticed the same problem using a M24LR64 memory instead of sensor.
Sniffing SDA and SCL signal with a oscilloscope, I noticed that after power on reset, both lines went down for about 100 us (when STM32 configure I2C pins as alternate function) and after 960 us microcontroller started his I2C sequence. Can this situation be considered a false signal for I2C slave component (sensor or EEPROM)?

Notes:

       
  • On my board there aren't electrical errors (I2C lines pull-ups are correct, all components are correctly mounted and powered);
  •    
  • Addresses are correct;
  •    
  • Toolchain used: KEIL uVision 4.21;
  •    
  • I2C settings: 7 bit addressing, fclk = 100kHz;

Outcomes