TI中文支持网
TI专业的中文技术问题搜集分享网站

evmAM572x开发板的i2c问题

最近,我在学习RTOS processor sdk 中i2c的例子——temperature sensor,我以该例子为基础,想读取camera module的chipid,但测试发现函数I2C_transfer()无法返回。进一步的测试发现processor board上的i2c从机都可以正常通信,但LCD module和camera module的i2c无法通信,即函数I2C_transfer()无法正常返回,下面是我的代码:

/*
* ======== Board_initI2C ========
*/
static void Board_initI2C(void)
{
Board_initCfg boardCfg;

boardCfg = BOARD_INIT_PINMUX_CONFIG |
BOARD_INIT_MODULE_CLOCK |
BOARD_INIT_UART_STDIO;
Board_init(boardCfg);
}

/*
* ======== test function ========
*/
void i2c_test(UArg arg0, UArg arg1)
{
I2C_Params i2cParams;
I2C_Handle handle = NULL;
I2C_Transaction i2cTransaction;
uint8_t txBuf[2] = {0x00, 0x00};
uint8_t rxBuf[2] = {0x00, 0x00};
int16_t status;
uint16_t val;
uint16_t temp;

I2C_log("\n I2C Temperature Sensor Application \n");

I2C_init();

I2C_Params_init(&i2cParams);

handle = I2C_open(2, &i2cParams);

i2cTransaction.slaveAddress = 0x3C;//唯独camera和LCD module的i2c通信有问题
i2cTransaction.writeBuf = (uint8_t *)&txBuf[0];
i2cTransaction.writeCount = 2;
i2cTransaction.readBuf = (uint8_t *)&rxBuf[0];
i2cTransaction.readCount = 0;
i2cTransaction.timeout = 2000;
status = I2C_transfer(handle, &i2cTransaction);//该函数无法返回,手动暂停会进入Idle_loop()

请问我是不是遗漏了某些关键的地方

Denny%20Yang99373:

是不是SLAVE的地址有问题?

赞(0)
未经允许不得转载:TI中文支持网 » evmAM572x开发板的i2c问题
分享到: 更多 (0)