2023-12-19 05:17 AM
Hi, I am trying to build 9 dof imu using LSM6DSO and LIS3MDL, using i2c to write and read lsm6dso and lis3mdl. I am testing the ICs in Raspberry Pi MCU. I am also using sensor hub on LSM6DSO to read/write LIS3MDL.
I have two questions that I need help with:
1. My first prototype, which combines the two ICs on one pcb in mode 2 (CS pins tied high to VDD_IO) and uses caps and res as illustrated in their datasheets, with no pull up resistors in between SDA and SCL lines connecting LSM6DSO's SDx and SCx pins to LIS3MDL's SDA and SCL pins, returned different LIS3MDL whoami value every time I ran script using lis3mdl_device_id_get() (ex. 0xBF, 0xB2, 0x89, 0x88, 0xF2, 0xB8, 0xC0 and more other random combinations that I don't see on LIS3MDL's datasheet nor any other hex I see on its .c or .h files on github). LSM6DSO always returned 0x6C, which is correct according to the driver on github, as its whoami, and read accel and gyro data properly. I am thinking either LIS3MDL soldering was faulty or the missing external pull up res on i2c traces between LIS3MDL and LSM6DSO caused problem. What would be the potential issues as to why I am getting random whoami returned for LIS3MDL in this case, assuming my C script is not the cause?
2. I found that lsm6dso_sh_pin_mode_set() enables internal pull up on MSCL (SCx) and MSDA (SDx) pins on LSM6DSO. It could be an option but is it recommended to add pull up res on traces on SCL and SDA between LSM6DSO and LIS3MDL when using mode 2? If so, what would be the recommended value of the two res?
If there's any misunderstanding, please let me know.
*Mode 2 here refers to the setup illustrated on LSM6DSO's datasheet for using external sensor through LSM6DSO's sensor hub feature.
Solved! Go to Solution.
2023-12-19 01:57 PM
Found the cause.
2023-12-19 01:57 PM
Found the cause.