应用文档网页有bug没人管的吗
V
vcobvjk 发布的帖子
-
IIC通信问题
关于iic通信,iic读函数,读出来的数就是从机地址,大家帮忙解答一下,谢谢
system_set_port_mux(GPIO_PORT_A, GPIO_BIT_6, PORTA6_FUNC_I2C1_CLK);//PA6 IIC时钟->SCL/SI system_set_port_mux(GPIO_PORT_A, GPIO_BIT_7, PORTA7_FUNC_I2C1_DAT);//PA7 IIC数据->SDA/CS system_set_port_pull( (GPIO_PA6|GPIO_PA7),false); //PA6,PA7设为上拉
// gpio_set_dir(GPIO_PORT_A, GPIO_BIT_7,GPIO_DIR_OUT); //输出模式
iic_init(IIC_CHANNEL_0,1000,TMP102_DEV_ADDR); //通道0 速率400k,3011地址0
co_printf("ARRIVE1\r\n");
uint8_t chipID = 0x00;
// icc_write_byte(IIC_CHANNEL_0,TMP102_DEV_ADDR,0x40,&chipID);
if (iic_read_byte(IIC_CHANNEL_0,TMP102_DEV_ADDR,0x01,&chipID)) // CHIP_ID = 0xE7
co_printf("CHIP ID:0x%2x\r\n",chipID);
else
co_printf("I2C Error\r\n");