- 論壇徽章:
- 1
|
最近在寫通過I2C實(shí)現(xiàn)主從控制相關(guān)的東西, 剛連線準(zhǔn)備測(cè)試I2C有沒有通,但是遇到了問題, 各位大神幫忙看看
我的程序:
ret = ioctl(fdI2c, I2C_SLAVE, (long)Register);
if (ret < 0)
{
printf("Set I2C SLAVE Failed, errno:%s!", strerror(errno));
return -1;
}
printf("nbyte: %d,Data: %p", nbyte, buf);
ret = write(fdI2c, buf, nbyte);
if (ret < 0)
{
printf("Write I2C Failed, errno:%s!", strerror(errno));
return -1;
}
程序運(yùn)行到write操作時(shí)出錯(cuò),打印:Write I2C Failed, errno:Remote I/O error!其中errno=22. buf[0]為寫入地址, buf[1],buf[2]為寫入數(shù)據(jù)的低8位和高8位,請(qǐng)問是什么原因?qū)е聦懗鲥e(cuò)呢?謝謝 |
|