我用CC2640的I2C操作寄存器读写值,示波器抓不到要写值的波形(可以抓到从机地址和寄存器地址),但是值可以写进去。这是什么原因呢,困扰了我好久了。求大神解答~I2C传输就用的官方的I2C_transfer函数
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我用CC2640的I2C操作寄存器读写值,示波器抓不到要写值的波形(可以抓到从机地址和寄存器地址),但是值可以写进去。这是什么原因呢,困扰了我好久了。求大神解答~I2C传输就用的官方的I2C_transfer函数
例如我直接用咱CC2650的I2C端口,给0x32从机地址上的0x17寄存器写个0xA8值,但是示波器上只抓到了0x32和0x17,下面是截图,抓的是SDA总线。
不清楚為何你示波器上一到数据时序那就没了、但是既然你可以對暫存器讀寫都沒有問題那也沒有必要糾結了
你opt3001的address pin接到GND、VDD、SDA、SCL?為什麼address byte用0x32?
你操作opt3001寫config register的程序可以貼上來看看嗎?
我用CC1310+opt3001去寫入0x54和0x10到 0x01寄存器是可以正確讀出寫入的0x54和0x10的
uint8_t writeBuffer[3] = {0x01, 0x54, 0x10}; //Opt3001 write i2cTransaction.writeBuf = writeBuffer; i2cTransaction.writeCount = 3; //i2cTransaction.readBuf = rxBuffer; i2cTransaction.readCount = 0; i2cTransaction.slaveAddress = 0x44; if (!I2C_transfer(i2c, &i2cTransaction)) { while(1); } //Opt3001 read rxBuffer[0]=0x00; rxBuffer[1]=0x00; i2cTransaction.writeBuf = writeBuffer; i2cTransaction.writeCount = 1; i2cTransaction.readBuf = rxBuffer; i2cTransaction.readCount = 2; i2cTransaction.slaveAddress = 0x44; if (!I2C_transfer(i2c, &i2cTransaction)) { while(1); } Display_printf(display, 0, 0, "rxBuffer0:%d rxBuffer1:%d", rxBuffer[0], rxBuffer[1]);