Other Parts Discussed in Thread: CONTROLSUITE
Hello,
I am currently trying to establish a I²C transmission with a F28335 as master. My code:
void init_I2C(void)
{
EALLOW;
/* Enable internal pull-up for the selected pins */
// Pull-ups can be enabled or disabled disabled by the user.
GpioCtrlRegs.GPBPUD.bit.GPIO32 = 1; // Disable pull-up for GPIO32 (SDAA)
GpioCtrlRegs.GPBPUD.bit.GPIO33 = 1; // Disable pull-up for GPIO33 (SCLA)
/* Set qualification for selected pins to asynch only */
// This will select asynch (no qualification) for the selected pins.
GpioCtrlRegs.GPBQSEL1.bit.GPIO32 = 3; // Asynch input GPIO32 (SDAA)
GpioCtrlRegs.GPBQSEL1.bit.GPIO33 = 3; // Asynch input GPIO33 (SCLA)
/* Configure SCI pins using GPIO regs */
// This specifies which of the possible GPIO pins will be I2C functional pins.
GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 1; // Configure GPIO32 for SDAA operation
GpioCtrlRegs.GPBMUX1.bit.GPIO33 = 1; // Configure GPIO33 for SCLA operation
EDIS;
I2caRegs.I2CPSC.all = 14; // Prescaler need 7-12 Mhz on module clk (150/15 =
10MHz)
// Configure SCL clock
I2caRegs.I2CCLKL = 12; // NOTE: must be non zero
I2caRegs.I2CCLKH = 7; // NOTE: must be non Zero
I2caRegs.I2CMDR.all = 0x0020; // Take I2C out of reset
// Stop I2C when suspended
I2caRegs.I2CFFTX.all = 0x6000; // Enable FIFO mode and TXFIFO
}
void I2C_write_data(void)
{
while(I2caRegs.I2CMDR.bit.STP == 1);
// Check if bus busy
while(I2caRegs.I2CSTR.bit.BB == 1);
I2caRegs.I2CSAR = 0b0011010;
I2caRegs.I2CCNT = 1;
I2caRegs.I2CDXR = 0x0F; // test transmit
I2caRegs.I2CMDR.all = 0x2E20;
}
In the main function I do the InitSysCtrl() activating the peripheral clocks etc. followed by the init_I2C() and I2C_write_data().
Observing the two I2C lines on the oscilloscope, I saw, that after
I2caRegs.I2CMDR.all = 0x2E20;
both the clock and data lines go low and stay in this condition. There is nothing more happening.
Any ideas ?
Thank's in advance.
~Brian