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.

TM4C1294NCPDT: GPIO toggle speed only 2mhz

Part Number: TM4C1294NCPDT

Hello,

Having some issues in regards to the speed at which we can toggle GPIO pins.

The code below is the test we have been running and looking at with a logic analyser - we see 2mhz which seems awfully slow. 

Is this accurate or are we making a obvious mistake? 

#include <stdint.h>
#include <stdbool.h>
#include "inc/tm4c1294ncpdt.h"
#include "driverlib/sysctl.h"

int main(void)
{
    volatile uint32_t ui32Loop;
    SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
                SYSCTL_CFG_VCO_480), 120000000);

    SYSCTL_RCGCGPIO_R = SYSCTL_RCGCGPIO_R7;
    ui32Loop = SYSCTL_RCGCGPIO_R;

    GPIO_PORTH_AHB_DIR_R = 0x01;
    GPIO_PORTH_AHB_DEN_R = 0x01;
   
    while(1)
    {
      GPIO_PORTH_AHB_DATA_R = 1;
      GPIO_PORTH_AHB_DATA_R = 0;

    }
}

  • Did you enable optimization for the compiler? Right click on the project name and select "Show Build Settings...". Then set the optimization level to at least 2, Global optimizations.

  • In the event that the "highest frequency" output (NOT necessarily via GPIO, only) is sought - a Timer pin w/Timer configured for PWM Output - may prove (near) optimal...
  • Thanks for the replies - It turns out it was a silly error - the board WAS toggling far far faster, our logic analyser was the issue. 

    I apologise if i wasted anyone's time. Too many late nights results in some very silly mistakes!

  • No apology required (at least to me). It would be useful to learn just what toggling speed you DID achieve.     And - how did Bob's "optimization" suggestion impact your results....

  • cb1_mobile said:

    No apology required (at least to me). It would be useful to learn just what toggling speed you DID achieve.     And - how did Bob's "optimization" suggestion impact your results....

    By the time I saw this suggestion we had already determined it wasn't a issue with the TM4C129, and was a issue with our tools. 
    We determined this with a basic discrete counter circuit using logic ICs, which gave us a good indication that the logic analyzer was the issue. 
    Because the logic analyzer is not up to the task, I can't tell you exactly what we were getting but I believe in the 30mhz range. The research I did looking for a exact spec seemed to indicate ~60mhz is realistic when the board is clocked at 120mhz. 
    We never tried the suggestion as we had determined the root problem  - but it's something to keep in mind, though I'm not sure it would have made a difference as when we looked at the assembly code it was I think 4 instructions. 
    This code was built with Makefiles and GCC not with CCS.
    -jjrh