Skip to main content
Visitor II
June 4, 2019
Question

Integrate IIS2MDC to STM32F103c

  • June 4, 2019
  • 2 replies
  • 1007 views

Hi,

I am trying to read data from the IIS2MDC placed on a STEVAL-MKI185V1 on a STM32F103C board programmed via Arduino IDE.

I tried following the steps mentioned in the document in the link:

https://community.st.com/s/question/0D50X00009yDgrUSAS/is-there-any-description-initialisation-sequence-to-get-the-master-i2c-of-the-ism330dlc-running-mode2

However when I read the WHOIAM register it gave a value of 0 instead of 0x40. Subsequently I am unable to read the magnetometer register values.

PFA the code that I am working on.

Any help for this is much appreciated.

Thank You

    This topic has been closed for replies.

    2 replies

    ST Employee
    June 12, 2019

    Hi, the fact you are reading 00h on the WHO_AM_I make me suspect the issue is on the communication. Could you check the integrity of the I2C transmission and share the oscilloscope or pattern analyzer screen? Which frequency / Vdd or VddIO / pull-up value are you working at? To check the issue is related to the communication and not to the sensor, you could try interface to it to through the SPI. I think you already did it, but please note that the 8bit I2C slave address is 3D or 3C and not 1E.

    0690X000008iYgUQAU.png

    Regards

    SBansAuthor
    Visitor II
    June 13, 2019

    Hi Eleon,

    Thank you for your response. But I have got it working now. Turns out I had missed out on the pull up resistors. Once I added them it worked like a charm.

    Thank You