Hallo, Thanks for your effort Its a pity, but it doesnt work I watched the pins 26 and 27 -> they didnt toggle. Then I changed the code as I need (0xC00000C to 0xC000000C) and pin 30 and 31 didnt toggle too. Regards Sören PS: these two tings are defined in my LPC2100_addr.h. It's a comfortable way, to access Registers. // helper macro to write to a memory mapped register #define REG(addr) (*(volatile unsigned long *)(addr)) #define PCB_PINSEL0 (0xE002C000) /* pin function sel reg 0 */ #define PCB_PINSEL1 (0xE002C004) /* pin function sel reg 1 */ So I can use it like this: REG(PCB_PINSEL1) &= ~(0xF0000000); >>Hi, >> >>I have a similar problem. I want to use p0.2 and p0.3 as standard GPIO >>Output Pins. >>For this use I need a Pull up resistor. > >Yes, that's to be expected. They are the IIC pins and need pullups. > > >>If I use another Pin like P0.30 the level not changes on wire, not with >>pull up not with pull down and not without anything. >>What can be wrong? >> >>Here is my code: I think it's not the Problem, I hope >> >> REG(PCB_PINSEL1) &= ~(0xF0000000); > >First, what is REG defined as? And also PCB_PINSEL etc... That's an >unusual looking construct. > >> REG(PCB_PINSEL0) &= ~(0xF0); >> REG(GPIO_IODIR) |= 0xC00000C; //Output direction for P0.30/31/2/3 >> REG(GPIO_IOCLR) |= 0xC00000C; //Set Port P0.30/31/2/3 low >>//P0.2/3 OK with Pull-up >> REG(GPIO_IOSET) |= 0xC00000C; //Set Port P0.30/31/2/3 high >I don't believe These lines do what you think they do. You want something >more like. > >IOCLR = 0xC00000C; >IOSET = 0xC00000C; > >And 0xC00000C should be 0xC000000C; > >You're off by a couple of pins. > >IOCLR |= 0xC00000C; > >will clear (at least) pins 2, 3, 26, 27. IOCLR is a write only register. > >IOSET |= 0xC00000C; > >will set pins 2, 3, 26, 27 AND any other pins that had previously been set >(a little redundant but not harmful). > >>//P0.2/3 OK with Pull-up >> b_sleep(0xffff); >> REG(GPIO_IOCLR) |= 0xC00000C; //Set Port P0.30/31/2/3 low >>//P0.2/3 OK with Pull-up > >Check pins 26 & 27 and see if they are toggling. > > >" 'Freedom' has no meaning of itself. There are always restrictions, >be they legal, genetic, or physical. If you don't believe me, try to >chew a radio signal. " > > Kelvin Throop, III
Message
Re: GPIO - Pins
2004-02-04 by Sören Rennecke
Attachments
- No local attachments were found for this message.