Hi,I am trying to get I2C to work on PowerPC 8270. I think I have everything set up according the reference manual, but apparently I am missing something. Here is what I am doing:
On pin port D:
PDIRD bits 14 and 15 clear
PPARD bits 14 and 15 set
PSORD bits 14 and 15 set
PODRD bits 14 and 15 set (I think these don't matter when special function bits are enabled)
The I2C anchor location at IMMR + 0x8AFC is set to 0x9000, which is where I want the I2C parameter block to go.
At IMMR + 0x9000, I have set up rbase and tbase to point with 0x1000 and 0x1080, which puts my BD arrays for rx and tx at IMMR + 0x1000 and IMMR + 0x1080 respectively. I have set rfcr and tfcr in the parameter block to BO = 1 and T2 set (all other bits clear). I've tried the T2 bit both ways.
All rx BD's are configured with their E-bits set. All tx BD's are configured with their R-bit clear and their S, and L bits set. Last BDs in both rx and tx arrays are configured with their W-bit set.
At this point I am issuing the code to CPCR (IMMR + 0x119C0) with the values from table 14-6:
PAGE = 0b1010
SBC = 0b1011
I am seeing the CP clear the FLG bit after this.
I2COM is then set to master mode (bit 7 set).
I2BRG is set to 208 (calculated to give 100 kbaud when predivider is 4)
I2CMR and I2CER are written with all condition bits set (this should set them in I2CMR and clear them in I2CER).
I2MOD predivider field is set to 0b11 to get a pre-divider of 4.
At this point I set the EN bit in I2MOD, and the initialization is assumed to be complete.
On the test bench I have pin port D bits 14 and 15 pulled up with 10K resistors. I have the scope monitoring both of those pins.
The test transmission is effected setting the first tx buffer with the target slave address in the first byte and two data bytes following. The byte count field in the corresponding BD is set to 3. Then I set the R bit in the corresponding tx BD. Then I set STS in I2COM.
At this point I am expecting to see the transmission on the scope and the CP to reset the R bit and set the NAK bit, since there is no device out there to answer.
But none of this happens.
Is there an app-note that has sample initialization code for this device? There is surely something I have neglected to do here, but I can't figure out what it is.