I2C in LPC2103 doesn't work

Hello.

I’m trying to get work I2C0 on Olimex LPC-H2103 board.

I’m using:

Eclipse

Zylin Embedded CDT debug plugin 4.10.1 (for gdb debugging)

YAGARTO GNU ARM toolchain, build 23.12.2009 (Binutils-2.20, Newlib-1.18.0, GCC-4.4.2, GDB-7.0.1)

OpenOCD 0.4.0

I can’t even pass start-byte condition ! I initialize I2C0, send start bit and waiting for state change. Because of my such simple wish I even disconnected slave-device to provide i2c bus absolutely free ! I2CSTAT must change to 0x08 but it doesn’t ! I’ve read a lot of similar messages over the internet and taking into account others’ mistakes I’ve checked absolutelly all. Wires are connected, PCONP register set correctly, PINSEL bits also correspond to selected I2C0, errata sheet is ok… everything is ok ! After power on I’m checking with multimeter levels on pins, they are in high, after i2c init they are also high and after start-bit they are low that means start-bit successfully sent and microcontroller waits for what ???

Linker-script and startup-code from: http://www.siwawi.arubi.uni-kl.de/avr_p … 041214.zip (I’ve modified it for my project)

Compiling:

arm-elf-gcc -I"Z:\Projects\DemoVisionRobot\primary_program\include" -O0 -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -std=gnu99 -c -fmessage-length=0 -funsigned-char -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -mcpu=arm7tdmi-s -g3 -gdwarf-2 -o"$@" "$<"
``` Linking:

arm-elf-g++ -T"Z:\Projects\DemoVisionRobot\primary_program\lpc2103-ROM.ld" -nostartfiles -Wl,-Map,DemoVisionRobot.map -mcpu=arm7tdmi-s -g3 -gdwarf-2 -o"DemoVisionRobot.elf" $(OBJS) $(USER_OBJS) $(LIBS)


// setup SCL pin P02
PINSEL0 &= ~(3<<4);
PINSEL0 |= 1<<4;
// setup SDA pin P03
PINSEL0 &= ~(3<<6);
PINSEL0 |= 1<<6;
// disable and reset interface
I2C0CONCLR = 0x6C;
// I’m not dreaming of high speed
I2C0SCLL = 1000;
I2C0SCLH = 1000;
// enable interface and send start bit
I2C0CONSET = 0x60;
//simply waiting for ANY state change… I’m not ever dreaming of more !
while(I2C0STAT == 0xF8); // loops infinitely


I've tried also to check SI bit in I2CCONSET, different order of setting up registers, to clear SI bit before and after sending start bit, and many other example codes and things - no matters. Interrupts doesnt triggers too. Generated assembly code seems to be also correct.

I've broken my brain ! What's wrong ??? Please, help.