今天调试iic,按照csl库的例程,设置了IIC,但在示波器上看不到SCL信号,当然也就访问不了外部IIC设备了。会是什么原因呢?设置如下:
/*锁相环的设置*/
PLL_Config myConfig = {
0, //IAI: the PLL locks using the same process that was underway
//before the idle mode was entered
1, //IOB: If the PLL indicates a break in the phase lock,
//it switches to its bypass mode and restarts the PLL phase-locking
//sequence
12, //PLL multiply value; multiply 12 times
1 //Divide by 2 PLL divide value; it can be either PLL divide value
//(when PLL is enabled), or Bypass-mode divide value
//(PLL in bypass mode, if PLL multiply value is set to 1)
};
/* Create and initialize an I2C initialization structure */
I2C_Setup iicInit = {
0, /* 7 bit address mode */
0, /* own address - don't care if master */
120, /* clkout value (Mhz) */
20, /* a number between 10 and 400*/
0, /* number of bits/byte to be received or transmitted (8)*/
0, /* DLB mode on*/
1 /* FREE mode of operation on*/
};
void main(void)
{
Uint16 iicBuf[3];
CSL_init();
PLL_config(&myConfig);
I2C_setup(&iicInit);
/* Write a data byte to I2C */
//x=I2C_write(databyte1,1,1,0x70,1,30000);
for(i = 0; i < 100; i++)
{
/* Read data byte from I2C */
count=I2C_read(iicBuf,3,1,0x70,1,30000,0);
}
}
在读IIC的时候,通过示波器观察SCL脚,并没有脉冲信号。读一次就会拉低。
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
/* Create and initialize an I2C initialization structure */
I2C_Setup iicInit = {
0, /* 7 bit address mode */
0, /* own address - don't care if master */
20, /* clkout value (Mhz) */
10, /* a number between 10 and 400*/
0, /* number of bits/byte to be received or transmitted (8)*/
0, /* DLB mode on*/
1 /* FREE mode of operation on*/
};
C5000系列资料总结
AIC23的相关操作有没有问题?
一周热门 更多>