SAML11 (XplainedPro evaluation board) I2C with LIS2DH fails

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I am currently using a STEVAL-MKI135V1 with a LIS2DH mounted on.

According to the datasheet, the adress is supposed to be 0x31 or 0x33 (depending on the SD0 pin pulled down or low).

I use an ATSAML11 mounted on the board SAML11 XplainedPro. I use the I2C bus declared in the Atmel Start Project to do so with the HAL driver SYNC.

The thing is that my I2C bus recognizes the LIS2DH at the address 0x18 or 0x19 instead of 0x31 or 0x33 as it is supposed to be. Why?

Also, I can read in all the register (the WHO_AM_I register shows me 0x33 as it is supposed to be) but it seems I can not write inside the registers to put the LIS2DH in "power-up mode".

I am using both HAL_driver functions that remain untouched by me :
i2c_m_sync_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t reg, uint8_t *buffer, uint8_t length)
i2c_m_sync_cmd_write(struct i2c_m_sync_desc *i2c, uint8_t reg, uint8_t *buffer, uint8_t length)

According to the datasheet, the value in the CTRL_REG1 is supposed to be by default at 0x07 shows that it stays in power-down mode wherever I try to write in the registers.( And by the way, the readings and writing functions return the value '0' as they should.)

 

The adress issue is not that important. I don't mind the slave address but it seems that it has an incidence on the principal issue : I can not write in any register.

 

Someone already has this issue?

 

Thanks.

 

Attachment(s): 

Last Edited: Thu. Apr 4, 2019 - 04:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The address confusion is the usual 7-bit vs. 8 bit (7-bit address + R/W bit). This seems reasonably well explained in the datasheet Table 14. "SAD+read/write patterns".

What are you trying to write? Did you compare with existing code, maybe the Arduino library here https://github.com/DFRobot/DFRobot_LIS2DH12 ?

/Lars