No PWM on mBuino pins P0_11 to P_016?

Hello,

While working on my latest mBuino project, I couldn’t get PWM to work on a specific pin. Trying to find the cause, I noticed that PWM wasn’t working on some other pins too. According to the mBuino pin-out, PWM should be working on almost every pin of the edge connector.
To test the PWM feature I put mBuino on a breadboard with an external resistor protected LED and used the program below to test all PWM’s by connecting the LED successively on each pin.
For some reason I could not get PWM working properly on these pins, but did get flashes on some pins: P0_11, P0_16 (always off), P0_13, P0_15, P0_14 (flashing). Looking at the LPC1102 datasheet I saw that all pins tied to timer CT32B1 are non functioning, in addition to P0_11 which is tied to CT32B0_MAT3.
I reproduced this issue on two mBuino’s and I think this behavior is software related.

Is this an error in the mbed build for mBuino? Is there a way I can configure mBuino to enable PWM on these pins?


 #include "mbed.h"

main()
{
    BusOut LEDs(LED3, LED4, LED5, LED6, LED7);  // LED1 not used, LED2 used as PWM on P0_8, 
    PwmOut PWMs[] = {(P1_15), (P0_22), (P0_21), (P0_11), (P0_13), (P0_15), (P0_10), (P0_9), (P0_18), (P0_19), (P0_14), (P0_16), (P0_8)};
    // PwmOut seems to work on these pins (using timers CT16B0, CT16B1 and CT32B0):
    ///          P0_22, P0_21, P0_10, P0_9, P0_18, P0_19, P0_8 (=LED2)
    // It doesn't work on these pins (P0_13 to P0_16 all using CT32B1, P0_11 using CT32B0_MAT3):
    //           P0_11, P0_16 (always off),
    //           P0_13, P0_15, P0_14 (flashing)
    // This one works too, but not in combination with others (CT16B0_MAT2 seems shared with P0_10):
    //           P1_15
    
    for(int i=0; i<sizeof(PWMs)/sizeof(PwmOut); i++)
        PWMs[i]=1;
    
    while (true)
    {
        if (LEDs == 31)
            LEDs = 1;
        else
            LEDs=LEDs+1;
        for(int i=0; i<sizeof(PWMs)/sizeof(PwmOut); i++)
        {
            PWMs[i]=PWMs[i]*0.80;
            if(PWMs[i]<0.005) PWMs[i]=1;
        }
        wait(.5);
    }    
}

@ maxint - Sorry about the late reply.

Unfortunately, the pins that you mentioned (P0.11, P0.13, P0.14, P0.15, and P0.16) are not programmed in the firmware for PWM. The image was supposed to be changed a while ago but must have been overlooked. We will update this image as soon as possible. We apologize for any inconvenience this has caused.

You may be able to activate via direct register manipulation or perhaps making a custom firmware build.

Hi @ Aron, thank you for the clarification. At least now I know it wasn’t my own goofy programming. Manipulating the registers sounds like a doable solution, but I don’t have experience in that. If anyone has the time to jump into this that would be nice.

(While you’re at updating documentation, you may also want to update the resistor values of the LEDs in the schematics, Two of them seem incorrect).