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.

TMS320F28388D: Led Toggle Timings

Part Number: TMS320F28388D


I have a question about timings.

I wanted to know time difference between bitfield and driverlib examples. I configured Led1 pin(PIN31) as output on the control board and toggled it via different ways. In endless loop when I write below code, it takes 50 ns for each high and low sequences. This one is driverlib function's related part.

    while(1)
    {
        gpioDataReg = (uint32_t *)((uintptr_t)GPIODATA_BASE) + ((31 / 32U) * GPIO_DATA_REGS_STEP);
        gpioDataReg[GPIO_GPxTOGGLE_INDEX] = (uint32_t)1U << (31 % 32U);
    }

Then I tried it with bitfield as below (2 different ways) and it takes 40 ns each.

    while(1)
    {
        GpioDataRegs.GPASET.bit.GPIO31 = 1;
        GpioDataRegs.GPACLEAR.bit.GPIO31 = 1;
    }
    
    while(1)
    {
        GpioDataRegs.GPADAT.bit.GPIO31 = 1;
        GpioDataRegs.GPADAT.bit.GPIO31 = 0;
    }

When I try it with toggle bit as below, it takes 50 ns again. Why it takes 10 ns more ? What is the best(fastest) way to control pins for future applications ?

    while(1)
    {
        GpioDataRegs.GPATOGGLE.bit.GPIO31 = 1;
    }