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.

TM4C1233H6PM: ISR FAULT with AHB mode in TM4C123x

Part Number: TM4C1233H6PM
Other Parts Discussed in Thread: EK-TM4C123GXL

Hi,


Even though GPIO AHB mode is enabled with SysCtlGPIOAHBEnable() we get ISR FAULT when we read the port in AHB mode.

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
SysCtlGPIOAHBEnable(SYSCTL_PERIPH_GPIOF);
Read = HWREG(GPIO_PORTF_AHB_BASE + GPIO_O_PUR); <- this code gets ISR FAULT

Please let me know what else should be taken care when using port in AHB mode.
Attached the complete code I am using. Note: it works normal in default APB mode.

And does Tiva C ROM library support AHB mode? couldn't find such API in the ROM user guide.

Best Regards
paddu

3750.hello.c
int
main(void)
{
    volatile uint32_t ReadReg = 0;


    //
    // Enable lazy stacking for interrupt handlers.  This allows floating-point
    // instructions to be used within interrupt handlers, but at the expense of
    // extra stack usage.
    //
    ROM_FPULazyStackingEnable();

    //
    // Set the clocking to run directly from the crystal.
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ |
                       SYSCTL_OSC_MAIN);

    //
    // Enable the GPIO port that is used for the on-board LED.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

    //
    // Enable the GPIO pins for the LED (PF2 & PF3).
    //
    ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);

    SysCtlGPIOAHBEnable(SYSCTL_PERIPH_GPIOF);


    //
    // Initialize the UART.
    //
    ConfigureUART();

   // Getting error with below code.........

    UARTprintf("Hello, world!\n");
    ReadReg = HWREG(GPIO_PORTF_AHB_BASE + GPIO_O_PUR);   // Error Code
    UARTprintf("ReadReg=%x\n", ReadReg);



    while(1);

}

  •     uint32_t Read;
        //
        // Setup the system clock to run at 50 Mhz from PLL with crystal reference
        //
        SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
                        SYSCTL_OSC_MAIN);
    
        //
        // Enable and wait for the port to be ready for access
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF))
        {
        }
        SysCtlGPIOAHBEnable(SYSCTL_PERIPH_GPIOF);
        //
        // Configure the GPIO port for the LED operation.
        //
        Read = HWREG(GPIO_PORTF_AHB_BASE + GPIO_O_PUR);
        GPIOPinTypeGPIOOutput(GPIO_PORTF_AHB_BASE, RED_LED|BLUE_LED|GREEN_LED);
    

    Here is the project I used on an EK-TM4C123GXL Launchpad.

    /cfs-file/__key/communityserver-discussions-components-files/908/PortF_5F00_AHB.zip

    You need to wait (32 clocks) for the peripheral to be ready before accessing the registers. This code worked for me with no issue:

  • Hi Bob,

    Thank you very much for the quick reply.

    One more fault was there were both AHB and APB modes in the code.
    came to know that only in 129 (AHB and APB can coexist) but not 123x.

    Best Regards
    paddu