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.

PROCESSOR-SDK-AM437X: GPMC issue in RTOS

Part Number: PROCESSOR-SDK-AM437X

Having spent the last few days trying to get this to work, I now need some guidance.

I am using the TI RTOS, and need to add the GPMC interface to the project to interface with a FPGA.

1. I updated the pinmux file to include the required pins.

2. Added GPMC initialize and get the handle to the interface.

    GPMC_init();
    GPMC_Params gpmcParams;
    GPMC_Params_init(&gpmcParams);
    gpmcHandle = GPMC_open(BOARD_GPMC_INSTANCE, &gpmcParams);
    if (NULL == gpmcHandle)
    {
        #ifndef DISABLE_UART_PRINT
            UART_printf("\n\rERROR:\tGPMC Not initialised!");
        #endif
    }

3. This is setup as "Multiplexed 16b NOR type - synchronous".

4. I then have a 1 second timer task that sends data to the FPGA.

       GPMC_Transaction tempGPMC;

       tempGPMC.transType = GPMC_TRANSACTION_TYPE_WRITE;
       tempGPMC.txBuf = tempTxBuffer;
       tempGPMC.count = sizeof(tempTxBuffer);
       tempGPMC.arg = NULL;
       tempGPMC.rxBuf = NULL;    //tempRxBuffer;
       tempGPMC.offset = 0;

        if (GPMC_transfer(gpmcHandle, &tempGPMC) == true)
        {
            #ifndef DISABLE_UART_PRINT
                UART_printf("\n\rGP GPMC Data Sent");
            #endif
        }

5. When this transfer is run, the CCS debugger stops with a "CortexA9: Unhandled ADP_Stopped exception" error.

Any ideas on how to find out what is failing? I am sure it is something silly I have not done.

Regards

Andy

  • Hi Andy,

    It appears the A9 is throwing an exception somewhere during the transfer.

    I don't see anything wrong with your usage of the GPCM LLD API, provided the default settings are OK for you.

    Does the first transfer cause the exception?

    Have you tried stepping into GPMC_transfer() to see where the exception occurs? You can make this easier by compiling the GPMC LLD in debug mode, e.g. for AM437x on Windows:

    > cd <PRSDK install dir>\pdk_am437x_1_0_16\packages
    > pdksetupenv
    > gmake gpmc LIMIT_SOCS="am437x" LIMIT_CORES="a9host" BUILD_PROFILE="debug"

    The resulting debug libraries will be located in pdk_am437x_1_0_16\packages\ti\drv\gpmc\lib\a9\debug

    Next, add this line to your .cfg file:

    Gpmc.Settings.libProfile = "debug";

     

    Then rebuild your application. XDC tools should pick up the debug library during the build, .e.g.:

    Linking with library ti.drv.gpmc:./lib/am437x/a9/debug/ti.drv.gpmc.profiling.aa9fg

    Regards,
    Frank

  • Hi Frank,

    Thanks for the reply.

    I did as you suggested, and got to the sam point. The point of failure is line 644 in GPMC_v1.c, in function GPMC_nor_write_v1 (*pAddr16++ = *pData16++;). pAddr16 is pointing to 0x1000000 (within the GPMC memory mapped area), and pData16++ is pointing to a 16 bit array in RAM.

    My thinking is that the GPMC address point is meesing me arround, and that the area of memory that it is pointing to is deemed out of range. Something I have missed somewhere.

    Regards

    Andy

  • Hi Andy,

    Can you step through the assembly language and see which instruction results in the failure? When the failure occurs, where is the Program Counter? Is it located on an entry in the vector table? I'm wondering if you need an MMU configuration for the memory region.

    Is this the first write of the first transaction? Are you able to write to another location, e.g. 0x0?

    What happens if you change the transaction to a read?

    Regards,
    Frank

  • Hi Frank,

    Your wondering was correct. I checked the ROV and saw that the memory range of the GPMC was not in the list. I added it via the .cfg file for the project, rebult the project, and all working perfectly.

    /* Define the address for the GPMC/FPGA interface */
    var FPGABaseAddr = 0x10000000;

    Mmu.setFirstLevelDescMeta(FPGABaseAddr,
                              FPGABaseAddr,
                              peripheralAttrs); 

    Thanks for all your help.

    Regards

    Andy