Mahmoud Hosseini

GPIO speed on the LPC812

Discussion created by Mahmoud Hosseini on Aug 14, 2016
Latest reply on Aug 15, 2016 by Mahmoud Hosseini

Based on datasheet -page 17:

 

    GPIO registers are located on the ARM Cortex M0+ IO bus for fastest possible

    single-cycle I/O timing, allowing GPIO toggling with rates of up to 15 MHz.

 

And I used a tiny code (based on the LPCOPEN library )to test it's speed:

 

Code: [Select]

      Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0, 12);
   
    while(1)
    {
         Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0, 12, true);
         Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0, 12, false);
   
    }

 

When I trace this GPIO pin by logic analyzer,It's toggling around 250 KHZ which is far away from mentioned value in datasheet.

 

I also used PLL to increase main clock and system clock for achieving better speed:

 

Code: [Select]

    Chip_IRC_SetFreq(96000000, 24000000);

 

but even for different values 250KHZ is the most frequency which I cant overtake.Decreasing PLL speed cause decrements on output frequency of GPIO and also I know I can achieve better speed with assembly code but 250KHZ is so far away from datasheet & It seems MCU are not able to overtake from this limit(there ara same substance for 60MHZ/30MHZ - 60MHZ/15MHZ and so) Also 250KHZ is maximum speed which pins in the SPI peripheral state can toggled.

Outcomes