Dear all I am using an LPC2138 uController and I'm trying to set up 4 PWM signals while still having the ports for serial communication (TXD0, RXD0) Hence the choice fell on PWM2, PWM4, PWM5, PWM6. Problem: PWM2,4,6 worked fine first, only PWM5 did not show any signal. Later (one fine day) PWM4 went out as well. PWM2 and 6 work perfectly as they should. Debugging: 1) I measured the outputs directly at the uController's pins, so bad connections on the board should not be the problem (except pin is pulled to ground...I'll check that) 2) I configured PWM4 and 5 as GPIO and put a 1 to them -> I measured 0V! 3) I configured PWM6 as GPIO and put a 1 to it -> I measured 3.3V (works) Program code: **********************snip******************** /* init PLL, MAM etc. */ systemInit(); uart0Init(UART_BAUD(BAUD), UART_8N1, UART_FIFO_8); /* Enable pin 0.0 TXD0; pin 0.1 RXD0; pin 0.7 as PWM2; pin 0.8 as PWM4; pin 0.9 PWM6*/ PINSEL0 = 0x000A8005; /*Enable pin 0.21 as PWM5*/ PINSEL1 = 0x00000400; /*Tests with gpio/* //PINSEL0 = 0x88005; //set pwm4 as gpio //PINSEL0 = 0x28005; //set pwm6 as gpio //PINSEL1 = 0x0; //set pwm5 as gpio //IODIR0 = 0x200000; //set direction as output of according pin //IOSET0 = 0x200000; // set level to 1 of according pin /* Load prescaler on x ticks * Here: 3B bei 4*14,7456MHz, Aufloesung auf ca 1us */ PWMPR = 0x0000003B; /* PWM channel 2,4,5,6 single edge control, output enable */ PWMPCR = 0x00007400; /* On match with timer reset the counter */ PWMMCR = 0x00000002; /* Set cycle rate to x ticks, /*here 3ms at 4*14.7...MHz and resolution of 1us*/ PWMMR0 = 0x00000BB8; /* Set of PWM2 to x ticks, PWMMR5 = CENTER[0]; PWMMR2 = CENTER[1]; PWMMR4 = CENTER[2]; PWMMR6 = CENTER[3]; /* Enable shadow latch for match 0-1 */ PWMLER = 0x00000075; /* Enable counter and PWM, release counter from reset */ PWMTCR = 0x0000000B; PWMTCR = 0x00000009; while(1) //from here on main while loop ***********************snip**************************************** Possible causes: - uController pins of PWM4 and PWM5 broken but works correctly with the rest?? - Register values wrong?? Many thanks in advance!!
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.