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

关于28035的I2C通信,真是百思不得其解啊!求大神们救命!

自己编写的I2C通信子程序,在28015上跑很正常!

但是呢,在28035上跑根本不行,具体情况我单步执行下来,发现:I2CCNT=0x0010,,换句话说就是需要发送16个字节,,,但是I2CFFTX却只能增加到0x6480!!!

这是为什么啊!?我设置为发送16个字节,他却只增加到4。28035换了,i2c芯片也换了,还是这样,根本得不到SCD中断!查看I2CSTR发现是0x1010,显示是忙~~!!

我的I2C设置如下:

void InitI2CA(void)
{
I2caRegs.I2CMDR.all =0x0000;
I2caRegs.I2CSAR =0x0050; // Slave address – EEPROM control code

I2caRegs.I2CPSC.all =6; // Prescaler – need 7-12 Mhz on module clk
I2caRegs.I2CCLKL =10; // NOTE: must be non zero
I2caRegs.I2CCLKH =5; // NOTE: must be non zero
I2caRegs.I2CIER.all =0x24; // Enable SCD & ARDY interrupts
I2caRegs.I2CMDR.all =0x0020; // Take I2C out of reset
// Stop I2C when suspended
I2caRegs.I2CFFTX.all =0x6000; // Enable FIFO mode and TXFIFO, clear TXFFINT
I2caRegs.I2CFFRX.all =0x2040; // Enable RXFIFO, clear RXFFINT
}

I2C端口设置如下:

void InitI2CGpio(void)
{
EALLOW;
// Enable internal pull-up for the selected pins
GpioCtrlRegs.GPBPUD.bit.GPIO32=0; // Enable pull-up for GPIO32 (SDAA)
GpioCtrlRegs.GPBPUD.bit.GPIO33=0; // Enable pull-up for GPIO33 (SCLA)

// Set qualification for selected pins to asynch only
GpioCtrlRegs.GPBQSEL1.bit.GPIO32=3; // Asynch input GPIO32 (SDAA)
GpioCtrlRegs.GPBQSEL1.bit.GPIO33=3; // Asynch input GPIO33 (SCLA)

// Configure SCI pins using GPIO regs
GpioCtrlRegs.GPBMUX1.bit.GPIO32=1; // Configure GPIO32 for SDAA operation
GpioCtrlRegs.GPBMUX1.bit.GPIO33=1; // Configure GPIO33 for SCLA operation
EDIS;
}

seven xie:

28035的FIFO是4个字的。不像28015的是16个字的

自己编写的I2C通信子程序,在28015上跑很正常!

但是呢,在28035上跑根本不行,具体情况我单步执行下来,发现:I2CCNT=0x0010,,换句话说就是需要发送16个字节,,,但是I2CFFTX却只能增加到0x6480!!!

这是为什么啊!?我设置为发送16个字节,他却只增加到4。28035换了,i2c芯片也换了,还是这样,根本得不到SCD中断!查看I2CSTR发现是0x1010,显示是忙~~!!

我的I2C设置如下:

void InitI2CA(void)
{
I2caRegs.I2CMDR.all =0x0000;
I2caRegs.I2CSAR =0x0050; // Slave address – EEPROM control code

I2caRegs.I2CPSC.all =6; // Prescaler – need 7-12 Mhz on module clk
I2caRegs.I2CCLKL =10; // NOTE: must be non zero
I2caRegs.I2CCLKH =5; // NOTE: must be non zero
I2caRegs.I2CIER.all =0x24; // Enable SCD & ARDY interrupts
I2caRegs.I2CMDR.all =0x0020; // Take I2C out of reset
// Stop I2C when suspended
I2caRegs.I2CFFTX.all =0x6000; // Enable FIFO mode and TXFIFO, clear TXFFINT
I2caRegs.I2CFFRX.all =0x2040; // Enable RXFIFO, clear RXFFINT
}

I2C端口设置如下:

void InitI2CGpio(void)
{
EALLOW;
// Enable internal pull-up for the selected pins
GpioCtrlRegs.GPBPUD.bit.GPIO32=0; // Enable pull-up for GPIO32 (SDAA)
GpioCtrlRegs.GPBPUD.bit.GPIO33=0; // Enable pull-up for GPIO33 (SCLA)

// Set qualification for selected pins to asynch only
GpioCtrlRegs.GPBQSEL1.bit.GPIO32=3; // Asynch input GPIO32 (SDAA)
GpioCtrlRegs.GPBQSEL1.bit.GPIO33=3; // Asynch input GPIO33 (SCLA)

// Configure SCI pins using GPIO regs
GpioCtrlRegs.GPBMUX1.bit.GPIO32=1; // Configure GPIO32 for SDAA operation
GpioCtrlRegs.GPBMUX1.bit.GPIO33=1; // Configure GPIO33 for SCLA operation
EDIS;
}

jiaxuan tang:

回复 seven xie:

这个,这个。。。。。。。。。真不是不想活了~!

我还以为是和28015一样的呢,就没仔细地看数据手册~~!!!!!

刚刚仔细看了下,想死的心都有啊~~!!!晕死!这么坑人!!!

赞(0)
未经允许不得转载:TI中文支持网 » 关于28035的I2C通信,真是百思不得其解啊!求大神们救命!
分享到: 更多 (0)