lpcware

GPIO P0_22/23 problems

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
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);

Outcomes