GPIO output problems on LPC2138 board

I had purchased a lpc2138 development board from olimex, and i am having problems in toggling a particular pin

pin 0.11 to be exact, i have no problem toggling pin 0.10 or 0.12

the code that i use to initial the pin is

PINSEL0 &= ~PINSEL0_P0_11_MASK;
IO0DIR = 0x800;

IO0SET |= 0x800;

then i have a main while loop that looks like this

while(1){
   wait_ms(20);

    if(IO0PIN & 0x800){  
       IO0CLR |= 0x800;
    }else{
       IO0SET |= 0x800;
    }
}

if use the same code except for 0.10 or 0.12 it works but not for 0.11

i am wondering whether i have forgotten anything or if there is a problem with this pin with respect to the [olimex lpc2138 dev board

Regards,

Michael](LPC-P2138)

See the data sheet (page 13) - it’s an I2C open-drain output (SCL1). Try a pull-up resistor.

thank you very much,

that did the trick, now it works

mwoo769:
thank you very much,

that did the trick, now it works

Note that the statements like:
IO0SET |= 0x800;
IO0CLR |= 0x800;

should actually be:

IO0SET = 0x800;
IO0CLR = 0x800;

You might have got away with it here but you won’t always be so lucky :wink:

hello again,

I have recently discovered that the chip that I got with the Dev board is a lpc2138/01 and so it has a few extra features, namely fractional baudrate generators, and supposed Fast IO.

This seems to be a problem, i have successfully been able to get the fractional baudrate generator working, however I cant do the most trivial things with the IOs such as toggle an LED.

this is the code that I am using

FIO0DIR1 |= 0x10;
FIO0CLR1 = 0x10;

while(1){
   wait_ms(2);
   if(FIO0PIN1 & 0x10){  
     FIO0CLR1 = 0x10;
   }else{
     FIO0SET1 = 0x10;
   }
}

is there something wrong with my code?

mwoo769:
This seems to be a problem, i have successfully been able to get the fractional baudrate generator working, however I cant do the most trivial things with the IOs such as toggle an LED.

Make sure you have set the System Control and Status Flag register (SCS) correctly to use FastIO. Refer to Ch. 4 ‘System Control Block’ in the User Manual for LPC213x. You may also need to check that the FastIO port mask (i.e. FIOxMASK) value is set correctly. Refer to Ch. 8 for details.

thank you,

after i had posted last, i read further into the manual and found out about the System Control and Status stuff.