This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GPIO Write speed f28377S on Lanchpad

Other Parts Discussed in Thread: CONTROLSUITE

Hi to All, I am a beginner.

I've connected scope to GPIO 71 and run blinky.c example without delays  and got f=1.08 MHz.

Is this a physical limitation of writing to GPIO?

Can I get the same speed writing to 8 GPIOs simultaneously? 

Can I organize random GPIOs to group of 8?

Thanks in advance Oleg

#include "F28x_Project.h" // Device Headerfile and Examples Include File

void main(void)
{
InitSysCtrl(); InitGpio();
GPIO_SetupPinMux(71, GPIO_MUX_CPU1, 0);
GPIO_SetupPinOptions(71, GPIO_OUTPUT, GPIO_PUSHPULL);
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
for(;;)
{
GPIO_WritePin(71, 0);
GPIO_WritePin(71, 1);
}

  • Hi,

    Is this a physical limitation of writing to GPIO?

    No, GPIO registers can be written faster and can be toggle at much higher speed. Here you are using a 'C' function to write into GPIO register. The function call itself will have some over head which makes the toggle slow. If you need to toggle GPIO at higher frq, use direct write to GPIO SET registers to toggle the pin. Yon can refer the  GPIO_WritePin function definition for the code.

    Can I get the same speed writing to 8 GPIOs simultaneously?

    Yes, you can toggle multiple GPIO pin at same time. Each SET register has control for 32bit GPIO pins.

     Can I organize random GPIOs to group of 8?

    Yes, you can use random GPIOs to group of 8 but as I mention each SET register has control for 32 GPIOs so if you use GPIO which are part of different GPIO SET registers then you need to write two GPIO SET registers.

    Regards,

    Vivek Singh

  • Thanks a lot, Vivek.
    It would be great if you refer to an example of function for direct writing to GPIOs built-in to C-program
  • Hi,

    You can refer function "Gpio_example2" in "gpio_toggle" example code in controlSUITE.

    In this given case you could replace following code -

    GPIO_WritePin(71, 0);
    GPIO_WritePin(71, 1);

    with -

    GpioDataRegs.GPCCLEAR.bits.GPIO71 = 1;
    GpioDataRegs.GPCSET.bits.GPIO71 = 1;
     

    Or if want to optimize the toggle speed further then use following code -

    GpioDataRegs.GPCCLEAR.all = 0x80;
    GpioDataRegs.GPCSET.all = 0x80;

    Regards,

    Vivek Singh