主题中讨论的其他器件:TMP1075
您好、专家!
I2C ACK/NACK 面临一些问题。我们在 i2c 线路中发送3个字节、但仅发送两个字节:
缺少第二个字节。
MAP_I2CMasterDataPut(I2C2_BASE, 0x00); //0x10 MAP_I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START); while(MAP_I2CMasterBusy(I2C2_BASE)); // while(!(MAP_I2CSlaveStatus(I2C2_BASE) & I2C_SLAVE_ACT_RREQ_FBR)) { } MAP_I2CMasterDataPut(I2C2_BASE, Dpot_Resistance_Todecimal); // value N MAP_I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH); //I2C_MASTER_CMD_BURST_SEND_CONT while(MAP_I2CMasterBusy(I2C2_BASE)); void init_i2c_init(void) { MAP_SysCtlPeripheralDisable(SYSCTL_PERIPH_I2C2); MAP_SysCtlPeripheralReset(SYSCTL_PERIPH_I2C2); MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C2); MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); //system enable gpio port L MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C2); // I2C2 system enable MAP_GPIOPinConfigure(GPIO_PL1_I2C2SCL); //I2C2 clk gpio config port PL1 MAP_GPIOPinConfigure(GPIO_PL0_I2C2SDA); //I2C2 data PORT PL0 MAP_GPIOPinTypeI2C(GPIO_PORTL_BASE, GPIO_PIN_0); // PL0 is data MAP_GPIOPinTypeI2CSCL(GPIO_PORTL_BASE,GPIO_PIN_1); // PL1 is clock while(!MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_I2C2)) // I2C2 peripheral ready { } MAP_I2CMasterInitExpClk(I2C2_BASE, ui32SysClock, true); // I2C2 clock setup //false = 100KHZ ,true = 400khz // MAP_I2CMasterSlaveAddrSet(I2C2_BASE, 0x29, false); / MAP_I2CMasterSlaveAddrSet(I2C2_BASE, 0x29, false); // I2C2 address setup for write to slave MAP_I2CMasterEnable(I2C2_BASE); } { }
I2C 字节:82、0253
82 (0x29)是从器件的地址、它没有发送0 (零)。
只是发送82和253,为什么?
我是不是在犯一些错误?
***
谢谢你。
此致、
阿奇·A·阿奇