1931 views|1 replies

1700

Posts

4

Resources
The OP
 

Based on PSOC6 development board simulation I2C solution X-NUCLEO-IKS01A3 LSM6DSO [Copy link]

 
This post was last edited by DavidZH on 2019-8-10 23:09

Today I analyzed LSM6DSO, interface I simulated IIC, the driver was still the same as before, and verified the read ID:

 uint8_t LSM6DSO_Read_Date(uint8_t SlaveAddress, uint8_t RegAddress)
{
    uint8_t recvDate;
    uint8_t succ, stime=0;
    
    I2C_Start();
    succ = I2C_Send_Byte(SlaveAddress & 0xfe);
    while((succ !=1)&&(stime<3))
    {
        I2C_Stop();
        I2C_Start();
        succ = I2C_Send_Byte(SlaveAddress & 0xfe);  //写
        stime++;
    }
    I2C_Send_Byte(RegAddress);
    
    I2C_Start();
    I2C_Send_Byte(SlaveAddress | 0x01);  //读
    recvDate = I2C_Read_Byte(1);   //NACK
    I2C_Stop();
    return recvDate;
}

printf("PID_LSM = %X\r\n",LPS22HH_Read_Date(LSM6DSO_ADD, 0x0F));

Register file:


LSM6DSO-master.zip (49.84 KB, downloads: 10)



This content is originally created by DavidZH , a netizen of EEWORLD forum . If you want to reprint or use it for commercial purposes, you need to obtain the author’s consent and indicate the source

image.png (4.23 KB, downloads: 0)

image.png
This post is from MEMS sensors
 
 

1700

Posts

4

Resources
2
 

The project is attached for reference only; PSOC6_IKS01A3_Code.zip (3.81 MB, downloads: 12)

This post is from MEMS sensors
 
 
 

Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list