GPIO P0_22/23 problems

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GPIO P0_22/23 problems

1,357 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by DennisFrie on Wed Jun 25 09:35:57 MST 2014
Using the LPC1548 MCU (64 pin package), I've bumped into a strange problem, when trying to use P0_22 and P0_23.

For some reason, I'm not able to control the pin. I've tried normal pin-toggling, connecting it to a peripheral using the switch-matrix etc. but with no luck. When testing on my LPCXpresso dev. board using LPC1549, everything works as expected - but only due to the pull-up resistors on the I2C lines. If they are removed, I have the same problem.

As an example, creating a new project with LPCOpen and simply configuring a timer like below, I can get a PWM-signal on pretty much any pin, except for P0_22 and P0_23. Have I missed a simple pin-configuration for those pins?

// Enable clock for timer
LPC_SYSCTL->SYSAHBCLKCTRL[1] |= (1<<2);   // Clock SCT0

LPC_SYSCTL-> PRESETCTRL[1] |= (1<<2); // Reset SCT0
LPC_SYSCTL-> PRESETCTRL[1] &= ~(1<<2); // Set SCT0

    // Table 202
LPC_SCT0 -> CONFIG =
(1 << 0) | // Operate as 1 32 bit timer
(1 << 17); // Clear timer on match

// Table 203
LPC_SCT0 -> CTRL_U =
(1 << 2) | // Halt timer for now
(1 << 3) | // Clear timer
(71 << 5); // Prescaler for 1 us resolution

// Table 222 - compare/match value
LPC_SCT0 -> MATCH[0].U = 20000;    // Match register
LPC_SCT0 -> MATCHREL[0].U =20000; // Reload match register

// Table 229 - Match event
LPC_SCT0 -> EVENT[0].STATE = 0xFFFFFFFF;
LPC_SCT0 -> EVENT[0].CTRL = (1 << 0) | (1 << 12);

LPC_SCT0 -> OUT[0].SET = (1 << 0);
LPC_SCT0 -> OUT[0].CLR = (1 << 0);

// Toggle on conflict
LPC_SCT0 -> RES = (3 << 0);

// Connect PWM-signal to P0_23
Chip_SWM_MovablePinAssign(SWM_SCT0_OUT0_O,23); //

// Start timer
LPC_SCT0 -> CTRL_U &= ~(1 << 2);

Labels (1)
0 Kudos
Reply
4 Replies

1,321 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by DennisFrie on Wed Jun 25 11:21:49 MST 2014
Well, that explains the problem !

I apologize for not noticing the open drain nature of the pins.

Thanks for your quick response and helps, much appreciated

0 Kudos
Reply

1,321 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Wed Jun 25 10:36:53 MST 2014
Hi Dennis,
Yes, those two pins are true open drain pins and there is no setting to configure these pins in other modes. True open drain nature of these pins has been mentioned in various places in the user manual.
Some of  the pages are

                       106/759
                        109/759
                        115/759

of the UM10736 LPC15xx User manual Rev. 1.1 — 3 March 2014
0 Kudos
Reply

1,321 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by DennisFrie on Wed Jun 25 09:49:54 MST 2014
Thanks for your quick reply,
I've just edited my first post slightly, as the working pins on the dev. board was caused by the pull-up resistors.

If those pins are only open-drains that's my problem  ;-)
0 Kudos
Reply

1,321 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by capiman on Wed Jun 25 09:42:13 MST 2014
P0_23 seems to be an open-drain pin.

See e.g. here:

7.5.3 Digital pin control registers for open-drain pins PIO0_22/23 on port 0

Could it be that one of the board has a pull-up, whereas the other has not?
0 Kudos
Reply