Try to implement an IIC Interface on XE162FL :(

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hello, I'm a german student and I try to implement an IIC Interface on my XE162FL to transmit data to an eeprom.
First I tried to get the code with Dave but it doesn't work. After that, I tried to setup the register manually but that doesnt work too.
I tried to put a simple byte on the SDA line...
I have a debugger, where I can see all the register it seems like it is all correctly but on my oscilloscop I cant see anything.
For example the TBUF00 Register gets loaded with 0xA6 like in the code I attached.
Can anybody help me? (sorry for my written english)

Some deatails:
USIC1 CH0 -->U1C0
Master Mode
SCL pin P10.11
SDA pin P10.13

void vInit_IIC_CU_HW(void) {

// Sperren der seriellen Schnittstelle ueber Channel Control Register
U1C0_CCR = 0x0000;

// Voreinstellung Baudrate
//Baudrate auf 400,000 kbaud einstellen

U1C0_FDRL = 0x83C0; /// - The Fractional divider is selected
/// - The step value STEP = 960
U1C0_BRGL = 0x6100;
U1C0_BRGH = 0x0002;

/// - The data input DX0D (P10.13) is selected
U1C0_DX0CR = 0x0003; // load U1C0 input control register(Data)

/// - The clock input DX1D (P10.11) is selected
U1C0_DX1CR = 0x0003; // load U1C0 input control register(Clock)

// Festlegen der Interrupt-Kanaele
U1C0_INPRL = 0x0000; //
U1C0_INPRH = 0x0000; //

// Shift Control
U1C0_SCTRL = 0x0303;
U1C0_SCTRH = 0x073F; //Word Length = 7

// Transmit Control Register
U1C0_TCSRL = 0x0500; // single shot mode und TBUF Data enable
U1C0_TCSRH = 0x0000;

// Protocol Control Register
U1C0_PCRL = 0x0000;
U1C0_PCRH = 0x0002;

// FIFO Configuration
U1C0_TBCTRL = 0x0000; // load U1C0 transmitter buffer control

U1C0_TBCTRH = 0x0200; // load U1C0 transmitter buffer control

U1C0_RBCTRL = 0x0004; // load U1C0 receive buffer control register

U1C0_RBCTRH = 0x0100; // load U1C0 receive buffer control register

P10_IOCR13 = 0x00D0; //set direction register
P10_IOCR11 = 0x00D0; //set direction register

U1C0_CCR = 0x0004; // load U1C0 channel control register mit IIC
U1C0_TBUF00 = 0xA6;
}
0 Likes
1 Reply
Not applicable
I found the solution, i forgot to setup the right TDF Bits for Startcondition. TDF is Bit 8 to 10 at the Transmitbuffer TBUF.
For start TDF has to be written with 100 (3bits).
So on, next part...
0 Likes