|
最近用MINI210开发板调试一款摄像头的驱动,在I2C的读写上出现了问题。所做的驱动是WINCE下的,通过打印信息函数将错误原因打出,内容如下。
[31m[IIC_IST:E] SLAVE(0x20) DETECTION IS FAILED & RECOVERY STAGE
[0m[31m[XXX] IOCTL_I2C_GENERAL_WRITE ERROR: 31
[0m[31m[IIC_IST:E] SLAVE(0x20) DETECTION IS FAILED & RECOVERY STAGE
[0m[31m[XXX] IOCTL_I2C_GENERAL_WRITE ERROR: 31
[0m[31m[IIC_IST:E] SLAVE(0x20) DETECTION IS FAILED & RECOVERY STAGE
[0m[31m[XXX] IOCTL_I2C_GENERAL_WRITE ERROR: 31
[0mIMX179::Finished WriteRegisters************20140626
pBuff:0xd030e684, StartReg:80, nRegs:1
[31m[IIC_IST:E] SLAVE(0x20) DETECTION IS FAILED & RECOVERY STAGE
[0m[31m[XXX] IOCTL_I2C_GENERAL_READ ERROR: 31
[0m[31m[IIC_IST:E] SLAVE(0x20) DETECTION IS FAILED & RECOVERY STAGE
[0m[31m[XXX] IOCTL_I2C_GENERAL_READ ERROR: 31
[0m[31m[IIC_IST:E] SLAVE(0x20) DETECTION IS FAILED & RECOVERY STAGE
[0m[31m[XXX] IOCTL_I2C_GENERAL_READ ERROR: 31
[0mWriteData:0, ReadData:0
pid is :0x0000*************20140704
pBuff:0xd030e685, StartReg:80, nRegs:1
[31m[IIC_IST:E] SLAVE(0x20) DETECTION IS FAILED & RECOVERY STAGE
[0m[31m[XXX] IOCTL_I2C_GENERAL_READ ERROR: 31
[0m[31m[IIC_IST:E] SLAVE(0x20) DETECTION IS FAILED & RECOVERY STAGE
[0m[31m[XXX] IOCTL_I2C_GENERAL_READ ERROR: 31
[0m[31m[IIC_IST:E] SLAVE(0x20) DETEC[SDBUS] SD/SDHC supports the high-speed mode.
[SDMMCCh0] Setting for 4 bit mode , Clock Rate = 50000000 Hz
TION IS FAILED & RECOVERY STAGE
[0m[31m[XXX] IOCTL_I2C_GENERAL_READ ERROR: 31
[0mWriteData:0, ReadData:0
vid is :0x00
在网上找了找类似的问题的解决方法,只看到一篇文章提及到,说是可能是硬件连接的问题。但是硬件方面也不知道哪里出问题了,摄像头的连接电路测试了几个LDO输出的电压,都没问题。唯一可能有问题的是I2C的时钟线和数据线给的不对。所以想尝试在开发板内部找一个寄存器,用I2C进行一次读写来看看结果。读写还是想用自己定义的读写函数,WriteRegisters(0x3012,0x0080);此函数前面为地址,后面为数据。
本人所用的S5PV210处理器的用户手册中查到I2C的一个寄存器为GPD1DAT,是关于数据的,截图随后附上。这里想问一下,这个地址我怎么理解。GPD1DAT, R/W, Address = 0xE020_00C4。我用WriteRegisters函数时地址写0x00C4对吗?官方提供的代码中,对寄存器进行操作是用另一种方式,如下:
volatile GPIO_REG* pRegGpio = (volatile GPIO_REG *)pGpioBaseAddr;
if (pRegGpio == NULL)
{
RETAILMSG(TRUE, (TEXT("[I2CEMUL] GROUP1 INIT FAIL\n\r")));
}
//---SCL PARAMETER SETTING----------------------------------------------------------------------------
I2CEMULGpioList[I2CEMUL_G0].pSCLCON_REG = &pRegGpio->GPD1.GP_CON; // = (SCLCON & ~(MASK << INDEX)) | (X << INDEX)
I2CEMULGpioList[I2CEMUL_G0].dwSCLCONIndex = 20; // GPD1_5 ; SCL
I2CEMULGpioList[I2CEMUL_G0].dwSCLCONMask = 0xF;
大意我理解为建立一个GPIO的指针,然后通过调用GPIO结构体中的内容如GPD1.GP_CON来进行操作。我不知道是不是封装起来了,我追不到这些工作的方法,也看不到地址部分怎么处理的。望有过WINCE寄存器开发经验的达人给予解答! |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
×
|