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.

TM4C123GH6PM: AHB set up and APB

Part Number: TM4C123GH6PM

Dear Forum,

I use the APB and the register 0x4002500, no issues. I set up everything in the 4002.5 and add the correct offsets.

I am running into an issue when I use the 0x4005D000 register for portF. It does not work. I set up the register with the same offsets as the APB and nada. I can not even blink an LED.

#define GPIO_PORTF_DATA_R       (*((volatile unsigned long *)0x400253FC))

// VS

#define GPIO_PORTF_DATA_R       (*((volatile unsigned long *)0x4005D3FC))

I have the other registers set up as well and I follow the datasheet. I do get the APB to run, but not the AHB.

Any suggestions?

Thanks in advance.
/Ruslan

  • Several suggestions. First, did you configure GIO Port F to use AHB bus in System Control register 9? Second, why are you using 0x3FC as the offset for the DATA register. The documented offset is 0x000. Third, why are you defining the DATA register as an unsigned long? It should not be written to by anything larger than 32 bits wide.

    I highly encourage the use of proven examples and library routines. When you create your own register definitions you allow the opportunity for making these kinds of mistakes and you make it more difficult for people to help you. I took the simple example "blinky" for the EK-TM4C123G board and changed it to use AHB writes to port F by adding a TivaWare call to SysCtlGPIOAHBEnable() and replacing three time GPIO_PORTF_BASE with GPIO_PORTF_AHB_BASE.

    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_memmap.h"
    #include "driverlib/debug.h"
    #include "driverlib/gpio.h"
    #include "driverlib/sysctl.h"
    
    //*****************************************************************************
    //
    //! \addtogroup example_list
    //! <h1>Blinky (blinky)</h1>
    //!
    //! A very simple example that blinks the on-board LED using direct register
    //! access.
    //
    //*****************************************************************************
    
    //*****************************************************************************
    //
    // The error routine that is called if the driver library encounters an error.
    //
    //*****************************************************************************
    #ifdef DEBUG
    void
    __error__(char *pcFilename, uint32_t ui32Line)
    {
        while(1);
    }
    #endif
    
    //*****************************************************************************
    //
    // Blink the on-board LED.
    //
    //*****************************************************************************
    int
    main(void)
    {
        volatile uint32_t ui32Loop;
    
        //
        // Enable the GPIO port that is used for the on-board LED.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    
        //
        // Check if the peripheral access is enabled.
        //
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF))
        {
        }
    
        // Configure GIO Port F to use AHB bus
        SysCtlGPIOAHBEnable(SYSCTL_PERIPH_GPIOF);
        //
        // Enable the GPIO pin for the LED (PF3).  Set the direction as output, and
        // enable the GPIO pin for digital function.
        //
        GPIOPinTypeGPIOOutput(GPIO_PORTF_AHB_BASE, GPIO_PIN_3);
    
        //
        // Loop forever.
        //
        while(1)
        {
            //
            // Turn on the LED.
            //
            GPIOPinWrite(GPIO_PORTF_AHB_BASE, GPIO_PIN_3, GPIO_PIN_3);
    
            //
            // Delay for a bit.
            //
            for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++)
            {
            }
    
            //
            // Turn off the LED.
            //
            GPIOPinWrite(GPIO_PORTF_AHB_BASE, GPIO_PIN_3, 0x0);
    
            //
            // Delay for a bit.
            //
            for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++)
            {
            }
        }
    }
    

  • *** LIKE *** Extremely detailed - logically presented & justified - simply "Excellent!"

    Yet (another)  unjustified rejection of the "Modern, Eased, Efficient, Proven Method" (API) - justified by the (always ILLUSORY) claim of  "Increased Understanding."    

    As the poster says - that "increase" proves, "Nada!"

  • Dear Bob,

    thank you for your replay.

    a)the control register was set up almost correctly, this solved it. I had set up a the wrong GPIO :-/ inverted the 0x20 to a 0x02.
    b)0x3FC indicates that i want to use all the bits in a register, access read and write config.
    c)I do not use API because what i do currently is creating API examples and header files
    d)voluntarily long is used instead of uint32_t because I do not have any includes in the project. The registers are 32 bits. If you look at the header file of the API or of hardware interpretation in any IDE you will notices that at the very bottom is a 32 bit long. Also all the literature i have read has it that way

    The solution was the