使用CC1350launchpad和TMP103A,用的IAR下的tmp007示例nortos\CC1350_LAUNCHXL\drivers\i2ctmp007
SDK版本simplelink_cc13x0_sdk_2_20_00_38
----------------------------------------------------------------------------------------------------
对比tmp007与tmp103的说明
更改了从机地址slaveAddress为103A的0b1110000(0x70)以及txBuffer[0] = 0x00;temperatrue register地址(只读
接线按照示例设置,SCL接在DIO4,SDA在DIO5
TMP103A 的 SCL与SDA分别带有10K上拉电阻,VCC是launchpad上3.3V,GND也是launchpad上的
电路连接如TMP103说明中的典型应用图相似
----------------------------------------------------------------------------------------------------
void *mainThread(void *arg0) { unsigned int i; uint8_t txBuffer[1]; uint8_t rxBuffer[2]; I2C_Handle i2c; I2C_Params i2cParams; I2C_Transaction i2cTransaction; /* Call driver init functions */ GPIO_init(); I2C_init(); /* Configure the LED pin */ GPIO_setConfig(Board_GPIO_LED0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW); GPIO_setConfig(Board_GPIO_LED1, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW); /* Create I2C for usage */ I2C_Params_init(&i2cParams); i2cParams.bitRate = I2C_400kHz; i2c = I2C_open(Board_I2C_TMP, &i2cParams); if (i2c == NULL) {while (1);} GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON); txBuffer[0] = 0x00; i2cTransaction.slaveAddress = 0x70; i2cTransaction.writeBuf = txBuffer; i2cTransaction.writeCount = 1; i2cTransaction.readBuf = rxBuffer; i2cTransaction.readCount = 1; for (i = 0; i < 20; i++) { if (I2C_transfer(i2c, &i2cTransaction)) { GPIO_write(Board_GPIO_LED1, Board_GPIO_LED_ON); } sleep(1); } I2C_close(i2c); return (NULL); }
-----------------------------------------------------------------------------------------
示例其他部分代码没有改动,现象是LED0(红)会亮,LED1(绿)一直不亮(I2C_transfer返回失败false
SCL波形是1秒间隔有一个“V”下降上升,其他时间保持3.3V不变
请问我的电路连接上或软件上需要如何修改?