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.

TM4C1294KCPDT: EPI General Parallel GPIO

Part Number: TM4C1294KCPDT

We are using the TM4C1294KCPDT micro-controller with the EPI bus 32-bit (EPIOS0 - EPIOS31) to XC7S25-2CSGA225C FPGA. The FPGA asserts pin PP0 configured as an interrupt input (fpgaReadReady) when data is available to transfer to the micro-controller. Within the interrupt, we want to read the EPI bus data into the micro-controller. The micro-controller then asserts pin PM5 configured as an output to acknowledge data receipt (ucReadACK). It works fine when the EPI bus pins are configured as GPIO inputs, however our attempts to set this up using the TivaWare EPI library have failed thus far. Can you provide any examples that configure the EPI bus just to read the 32 EPI pin states when queried?  Please review the attached code and let me know if you see any violations in the usage.

The following are the relevant sections used to configure and read the EPI bus. Note, not using interrupt while attempting to debug.

static void configEPIPeripheral( void )
{
// Configure FPGA read acknowledge output
MAP_SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOM );
while( ! MAP_SysCtlPeripheralReady( SYSCTL_PERIPH_GPIOM ) );
MAP_GPIOPinTypeGPIOOutput( SYSCTL_PERIPH_GPIOM, OUTPUT_EPI0_READ_ACK_PM5 );
MAP_GPIOPinWrite( SYSCTL_PERIPH_GPIOM, OUTPUT_EPI0_READ_ACK_PM5, OUTPUT_EPI0_READ_ACK_PM5 );

// Configure FPGA read ready input
MAP_SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOP );
while( ! MAP_SysCtlPeripheralReady( SYSCTL_PERIPH_GPIOP ) );
MAP_GPIOPinTypeGPIOInput( GPIO_PORTP_BASE, INPUT_EPI0_READ_RDY_INT_PP0 );

enablePeripheral( SYSCTL_PERIPH_EPI0 );

// Configure EPI pins
MAP_SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOA );
while( ! MAP_SysCtlPeripheralReady( SYSCTL_PERIPH_GPIOA ) );
MAP_GPIOPinTypeEPI( GPIO_PORTA_BASE, EPI0_SIGNAL_9_PA7 | EPI0_SIGNAL_8_PA6 );
MAP_GPIOPinConfigure( EPI0_SIGNAL_9_PA7 | EPI0_SIGNAL_8_PA6 );

MAP_SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOB );
while( ! MAP_SysCtlPeripheralReady( SYSCTL_PERIPH_GPIOB ) );
MAP_GPIOPinTypeEPI( GPIO_PORTB_BASE, EPI0_SIGNAL_28_PB3 | EPI0_SIGNAL_27_PB2 );
MAP_GPIOPinConfigure( EPI0_SIGNAL_28_PB3 | EPI0_SIGNAL_27_PB2 );

MAP_SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOC );
while( ! MAP_SysCtlPeripheralReady( SYSCTL_PERIPH_GPIOC ) );
MAP_GPIOPinTypeEPI( GPIO_PORTC_BASE, EPI0_SIGNAL_4_PC7 | EPI0_SIGNAL_5_PC6 | EPI0_SIGNAL_6_PC5 | EPI0_SIGNAL_7_PC4 );
MAP_GPIOPinConfigure( EPI0_SIGNAL_4_PC7 | EPI0_SIGNAL_5_PC6 | EPI0_SIGNAL_6_PC5 | EPI0_SIGNAL_7_PC4 );

MAP_SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOG );
while( ! MAP_SysCtlPeripheralReady( SYSCTL_PERIPH_GPIOG ) );
MAP_GPIOPinTypeEPI( SYSCTL_PERIPH_GPIOG, EPI0_SIGNAL_10_PG1 | EPI0_SIGNAL_11_PG0 );
MAP_GPIOPinConfigure( EPI0_SIGNAL_10_PG1 | EPI0_SIGNAL_11_PG0 );

MAP_SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOK );
while( ! MAP_SysCtlPeripheralReady( SYSCTL_PERIPH_GPIOK ) );
MAP_GPIOPinTypeEPI( SYSCTL_PERIPH_GPIOH, EPI0_SIGNAL_24_PK7 | EPI0_SIGNAL_25_PK6 | EPI0_SIGNAL_31_PK5 );
MAP_GPIOPinConfigure( EPI0_SIGNAL_24_PK7 | EPI0_SIGNAL_25_PK6 | EPI0_SIGNAL_31_PK5 );

MAP_SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOL );
while( ! MAP_SysCtlPeripheralReady( SYSCTL_PERIPH_GPIOL ) );
MAP_GPIOPinTypeEPI( SYSCTL_PERIPH_GPIOL, EPI0_SIGNAL_26_PL4 | EPI0_SIGNAL_19_PL3 | EPI0_SIGNAL_18_PL2 | EPI0_SIGNAL_17_PL1 | EPI0_SIGNAL_16_PL0 );
MAP_GPIOPinConfigure( EPI0_SIGNAL_26_PL4 | EPI0_SIGNAL_19_PL3 | EPI0_SIGNAL_18_PL2 | EPI0_SIGNAL_17_PL1 | EPI0_SIGNAL_16_PL0 );

MAP_GPIOPinTypeEPI( SYSCTL_PERIPH_GPIOM, EPI0_SIGNAL_12_PM3 | EPI0_SIGNAL_13_PM2 | EPI0_SIGNAL_14_PM1 | EPI0_SIGNAL_15_PM0 );
MAP_GPIOPinConfigure( EPI0_SIGNAL_12_PM3 | EPI0_SIGNAL_13_PM2 | EPI0_SIGNAL_14_PM1 | EPI0_SIGNAL_15_PM0 );

MAP_GPIOPinTypeEPI( SYSCTL_PERIPH_GPIOQ, EPI0_SIGNAL_30_PP3 | EPI0_SIGNAL_29_PP2 );
MAP_GPIOPinConfigure( EPI0_SIGNAL_30_PP3 | EPI0_SIGNAL_29_PP2 );

// Configure EPI operations
MAP_EPIModeSet( EPI0_BASE, EPI_MODE_GENERAL );
MAP_EPIDividerSet( EPI0_BASE, 1 );
MAP_EPIConfigGPModeSet( EPI0_BASE, EPI_GPMODE_ASIZE_NONE | EPI_GPMODE_DSIZE_32, 0, 0 );
MAP_EPIAddressMapSet( EPI0_BASE, EPI_ADDR_PER_BASE_A );

}

static void readEPI( void )
{
uint32_t inx,
epiData;

for( inx = 0 ; inx < 100 ; inx++ )
{
while( ! MAP_GPIOPinRead( GPIO_PORTP_BASE, INPUT_EPI0_READ_RDY_INT_PP0 ) );

MAP_GPIOPinWrite( GPIO_PORTM_BASE, OUTPUT_EPI0_READ_ACK_PM5, ~OUTPUT_EPI0_READ_ACK_PM5 );

epiData = 0;
epiData = HWREG( 0xA0000000 );

MAP_GPIOPinWrite( GPIO_PORTM_BASE, OUTPUT_EPI0_READ_ACK_PM5, OUTPUT_EPI0_READ_ACK_PM5 );

if( epiData != EPI_DATA_PATTERN[ inx % 2 ] )
logError( INVALID_EPI_PATTERN_ERROR );
}
}

  • however our attempts to set this up using the TivaWare EPI library have failed thus far. Can you provide any examples that configure the EPI bus

    HI,

      There is an example in C:\ti\TivaWare_C_Series-2.2.0.295\examples\peripherals\epi\sdram.c. Although the example is for EPI interfacing to a SDRAM, but the EPI pin configuration should be the same. Please note that some of the EPI bus pins are not needed for SDRAM vs. General-Purpose mode. In the example, PCTL register is rather manually setup for each pin rather than through GPIOPinConfigure.  

       //
        // The EPI0 peripheral must be enabled for use.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_EPI0);
    
        //
        // For this example EPI0 is used with multiple pins on PortA, B, C, G, H,
        // K, L, M and N.  The actual port and pins used may be different on your
        // part, consult the data sheet for more information.
        // TODO: Update based upon the EPI pin assignment on your target part.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
    
        //
        // This step configures the internal pin muxes to set the EPI pins for use
        // with EPI.  Please refer to the datasheet for more information about pin
        // muxing.  Note that EPI0S27:20 are not used for the EPI SDRAM
        // implementation.
        // TODO: Update this section based upon the EPI pin assignment on your
        // target part.
        //
    
        //
        // EPI0S4 ~ EPI0S7: C4 ~ 7
        //
        ui32Val = HWREG(GPIO_PORTC_BASE + GPIO_O_PCTL);
        ui32Val &= 0x0000FFFF;
        ui32Val |= 0xFFFF0000;
        HWREG(GPIO_PORTC_BASE + GPIO_O_PCTL) = ui32Val;
    
        //
        // EPI0S8 ~ EPI0S9: A6 ~ 7
        //
        ui32Val = HWREG(GPIO_PORTA_BASE + GPIO_O_PCTL);
        ui32Val &= 0x00FFFFFF;
        ui32Val |= 0xFF000000;
        HWREG(GPIO_PORTA_BASE + GPIO_O_PCTL) = ui32Val;
    
        //
        // EPI0S10 ~ EPI0S11: G0 ~ 1
        //
        ui32Val = HWREG(GPIO_PORTG_BASE + GPIO_O_PCTL);
        ui32Val &= 0xFFFFFF00;
        ui32Val |= 0x000000FF;
        HWREG(GPIO_PORTG_BASE + GPIO_O_PCTL) = ui32Val;
    
        //
        // EPI0S12 ~ EPI0S15: M0 ~ 3
        //
        ui32Val = HWREG(GPIO_PORTM_BASE + GPIO_O_PCTL);
        ui32Val &= 0xFFFF0000;
        ui32Val |= 0x0000FFFF;
        HWREG(GPIO_PORTM_BASE + GPIO_O_PCTL) = ui32Val;
    
        //
        // EPI0S16 ~ EPI0S19: L0 ~ 3
        //
        ui32Val = HWREG(GPIO_PORTL_BASE + GPIO_O_PCTL);
        ui32Val &= 0xFFFF0000;
        ui32Val |= 0x0000FFFF;
        HWREG(GPIO_PORTL_BASE + GPIO_O_PCTL) = ui32Val;
    
        //
        // EPI0S28 : B3
        //
        ui32Val = HWREG(GPIO_PORTB_BASE + GPIO_O_PCTL);
        ui32Val &= 0xFFFF0FFF;
        ui32Val |= 0x0000F000;
        HWREG(GPIO_PORTB_BASE + GPIO_O_PCTL) = ui32Val;
    
        //
        // EPI0S29 ~ EPI0S30: N2 ~ 3
        //
        ui32Val = HWREG(GPIO_PORTN_BASE + GPIO_O_PCTL);
        ui32Val &= 0xFFFF00FF;
        ui32Val |= 0x0000FF00;
        HWREG(GPIO_PORTN_BASE + GPIO_O_PCTL) = ui32Val;
    
        //
        // EPI0S00 ~ EPI0S03, EPI0S31 : K0 ~ 3, K5
        //
        ui32Val = HWREG(GPIO_PORTK_BASE + GPIO_O_PCTL);
        ui32Val &= 0xFF0F0000;
        ui32Val |= 0x00F0FFFF;
        HWREG(GPIO_PORTK_BASE + GPIO_O_PCTL) = ui32Val;
    
        //
        // Configure the GPIO pins for EPI mode.  All the EPI pins require 8mA
        // drive strength in push-pull operation.  This step also gives control of
        // pins to the EPI module.
        //
        GPIOPinTypeEPI(GPIO_PORTA_BASE, EPI_PORTA_PINS);
        GPIOPinTypeEPI(GPIO_PORTB_BASE, EPI_PORTB_PINS);
        GPIOPinTypeEPI(GPIO_PORTC_BASE, EPI_PORTC_PINS);
        GPIOPinTypeEPI(GPIO_PORTG_BASE, EPI_PORTG_PINS);
        GPIOPinTypeEPI(GPIO_PORTK_BASE, EPI_PORTK_PINS);
        GPIOPinTypeEPI(GPIO_PORTL_BASE, EPI_PORTL_PINS);
        GPIOPinTypeEPI(GPIO_PORTM_BASE, EPI_PORTM_PINS);
        GPIOPinTypeEPI(GPIO_PORTN_BASE, EPI_PORTN_PINS);

  • Yes, I'm aware of the SDRAM example you mentioned.  I have studied that and several of the other EPI posts.  As I mentioned in my original question, I only need to read the input on EPI0 - EPI31 when the FPGA indicates data ready.  This is similar to a 32 bit SPI bus, where the FPGA is the master with the data ready flag acting as a clock signal where data is read by the micro-controller on the rising edge and sourced by the FPGA on the falling edge.  Can you suggest a method to read the EPI bus data without reading each individual port pin?

  • Hi Patrick,

      I don't really spot anything wrong with your code. Can you tell me what data did you read? Is it reading zeros or some garbage data?

     Can you show the GPIO register setting particularly the GPIO_PCTL and GPIO_DEN and GPIO_AFSEL registers from the register browser?

    EPI uses many pins. Let's first pick EPI0S8 and EPI0S9 per your below configuration as these two EPI signals are mapped to PA6 and PA7. I want to see their settings. I would have expected 0xFF000000 in GPIOPCTL register for PortA. What do you get? Of course, the GPIODEN and GPIOAFSEL for these pins should be set too. 

    // Configure EPI pins
    MAP_SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOA );
    while( ! MAP_SysCtlPeripheralReady( SYSCTL_PERIPH_GPIOA ) );
    MAP_GPIOPinTypeEPI( GPIO_PORTA_BASE, EPI0_SIGNAL_9_PA7 | EPI0_SIGNAL_8_PA6 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_9_PA7 | EPI0_SIGNAL_8_PA6 );

    As a matter of fact, all the EPI signals are the 15th selection in the mux table. You should see the PMCx field equal to 0xF for all the relevant EPI pins. 

  • After a few updates I was able to get the correct values in both GPIO_PDCTL and GPIO_DEN.  Please note that I had to call GPIOPinConfigure() for each individual pin to get the GPIO_PDCTL to set 0xF for each pin.  Using the concatenated form (GPIO_PA6_EPI0S8 | GPIO_PA7_EPI0S9) would only set the highest order pin to 0xF.

    However, even with the correct configuration for each of EPI pins I still get a return value of 0 when I expect to receive a test pattern of 0xAA55AA55.  I don't understand what triggers the EPI data to be transferred to the memory location 0xA0000000 for reading.  The only dedicated EPI lines I use are EPI0 - EPI31 for data transfer.  My application uses a GPIO configured as an input from the FPGA that functions as a clock input and a GPIO configured as an output to the FPGA to acknowledge the data has been successfully read.  How can I use the GPIO clock input to trigger transferring data from the EPI bus to a location for reading?

  • Hi Patrick, 

      Can you try to read from EPIREADFIFO0 register instead of reading from 0xA0000000? 

     

    General parallel GPIO. From 1 to 32 pins may be written or read, with the speed precisely
    controlled by the EPIBAUD register baud rate (when used with the WFIFO and/or the NBRFIFO)
    or by the rate of accesses from software or μDMA. Examples of this type of use include:


    – Reading 20 sensors at fixed time periods by configuring 20 pins to be inputs, configuring the
    COUNT0 field in the EPIBAUD register to some divider, and then using non-blocking reads.


    – Implementing a very wide ganged PWM/PCM with fixed frequency for driving actuators, LEDs,
    etc.

      

  • I'm still having problems with the built-in EPI reading.  The following are the values in the pertinent registers when using the built-in EPI reads.

    PORT A
    DEN = 0x000000FF
    PCTL = 0xFF112200
    PORT B
    DEN = 0x0000003C
    PCTL = 0x00FFFF00
    PORT C
    DEN = 0x000000FF
    PCTL = 0xFFFF1111
    PORT G
    DEN = 0x00000003
    PCTL = 0x000000FF
    PORT H
    DEN = 0x0000000F
    PCTL = 0x0000FFFF
    PORT K
    DEN = 0x000000FF
    PCTL = 0xFFF00000
    PORT L
    DEN = 0x0000003F
    PCTL = 0x000FFFFF
    PORT M
    DEN = 0x000000FF
    PCTL = 0x0000FFFF
    PORT P
    DEN = 0x0000000F
    PCTL = 0x0011FF00
    PORT Q
    DEN = 0x0000001F
    PCTL = 0x0000FFFF

    EPI REGISTER
    EPI_CFG = 0x00000010
    EPI_BAUD = 0x0000000A
    EPI_BAUD2 = 0x00000000
    EPI_GPCFG = 0x00000003
    EPI_ADDRMAP = 0x00000010
    EPI_RSIZE0 = 0x00000003
    EPI_READFIFO1 = 0x40272C00
    EPI_READFIFO7 = 0x40272C00
    EPI_FIFOLVL = 0x00000033
    EPI_RIS = 0x00000004

    When operating in BIT_BANG mode everything works fine, however when attempting to use the built-in EPI in GP mode the reading always returns 0xAA.  The 0xAA is the first byte of what is being sent, but I'm not sure if this is just a coincidence.

    Please review the attached code to ensure I'm not missing any small details on the EPI usage?

    static void initEPI( void )
    {
    enablePeripheral( SYSCTL_PERIPH_EPI0 );

    enablePeripheral( SYSCTL_PERIPH_GPIOA );
    MAP_GPIOPinTypeEPI( GPIO_PORTA_BASE, GPIO_PIN_7 | GPIO_PIN_6 );
    MAP_GPIOPinConfigure( GPIO_PA6_EPI0S8 );
    MAP_GPIOPinConfigure( GPIO_PA7_EPI0S9 );

    enablePeripheral( SYSCTL_PERIPH_GPIOB );
    MAP_GPIOPinTypeEPI( GPIO_PORTB_BASE, GPIO_PIN_3 | GPIO_PIN_2 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_27_PB2 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_28_PB3 );

    enablePeripheral( SYSCTL_PERIPH_GPIOC );
    MAP_GPIOPinTypeEPI( GPIO_PORTC_BASE, GPIO_PIN_7 | GPIO_PIN_6 | GPIO_PIN_5 | GPIO_PIN_4 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_7_PC4 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_6_PC5 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_5_PC6 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_4_PC7 );

    enablePeripheral( SYSCTL_PERIPH_GPIOG );
    MAP_GPIOPinTypeEPI( GPIO_PORTG_BASE, GPIO_PIN_1 | GPIO_PIN_0 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_11_PG0 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_10_PG1 );

    enablePeripheral( SYSCTL_PERIPH_GPIOH );
    MAP_GPIOPinTypeEPI( GPIO_PORTH_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_0_PH0 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_1_PH1 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_2_PH2 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_3_PH3 );

    enablePeripheral( SYSCTL_PERIPH_GPIOK );
    MAP_GPIOPinTypeEPI( GPIO_PORTK_BASE, GPIO_PIN_7 | GPIO_PIN_6 | GPIO_PIN_5 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_31_PK5 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_25_PK6 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_24_PK7 );

    enablePeripheral( SYSCTL_PERIPH_GPIOL );
    MAP_GPIOPinTypeEPI( GPIO_PORTL_BASE, GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_16_PL0 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_17_PL1 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_18_PL2 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_19_PL3 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_26_PL4 );

    enablePeripheral( SYSCTL_PERIPH_GPIOM );
    MAP_GPIOPinTypeEPI( GPIO_PORTM_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_15_PM0 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_14_PM1 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_13_PM2 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_12_PM3 );

    enablePeripheral( SYSCTL_PERIPH_GPIOP );
    MAP_GPIOPinTypeEPI( GPIO_PORTP_BASE, GPIO_PIN_3 | GPIO_PIN_2 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_29_PP2 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_30_PP3 );

    enablePeripheral( SYSCTL_PERIPH_GPIOQ );
    MAP_GPIOPinTypeEPI( GPIO_PORTQ_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_20_PQ0 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_21_PQ1 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_22_PQ2 );
    MAP_GPIOPinConfigure( EPI0_SIGNAL_23_PQ3 );

    MAP_EPIModeSet( EPI0_BASE, EPI_MODE_GENERAL );
    MAP_EPIDividerSet( EPI0_BASE, 10 );
    MAP_EPIConfigGPModeSet( EPI0_BASE, EPI_GPMODE_ASIZE_NONE | EPI_GPMODE_DSIZE_32, 0, 0 );
    MAP_EPIAddressMapSet( EPI0_BASE, EPI_ADDR_PER_BASE_A );
    }

    static void testEPI( void )
    {
    uin32_t inx,
    epiData;

    for( inx = 0 ; inx < 100 ; inx++ )
    {
    MAP_GPIOPinWrite( GPIO_PORTM_BASE, OUTPUT_EPI0_READ_ACK_PM5, OUTPUT_EPI0_READ_ACK_PM5 );
    while( ! MAP_GPIOPinRead( GPIO_PORTP_BASE, INPUT_EPI0_READ_RDY_INT_PP0 ) );
    MAP_GPIOPinWrite( GPIO_PORTM_BASE, OUTPUT_EPI0_READ_ACK_PM5, ~OUTPUT_EPI0_READ_ACK_PM5 );
    #ifdef BIT_BANG
    epiData = MAP_GPIOPinRead( GPIO_PORTA_BASE, PORT_A_EPI_PINS ) << 2;
    epiData |= MAP_GPIOPinRead( GPIO_PORTB_BASE, PORT_B_EPI_PINS ) << 25;
    epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTC_BASE, PORT_C_EPI_PINS ) ) >> 20;
    epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTG_BASE, PORT_G_EPI_PINS ) ) >> 20;
    epiData |= MAP_GPIOPinRead( GPIO_PORTH_BASE, PORT_H_EPI_PINS );

    inputPins = MAP_GPIOPinRead( GPIO_PORTK_BASE, PORT_K_EPI_PINS );
    epiData |= (inputPins & 0x00000020) << 26;
    epiData |= (inputPins & 0x00000080) << 17;
    epiData |= (inputPins & 0x00000040) << 19;

    inputPins = MAP_GPIOPinRead( GPIO_PORTL_BASE, PORT_L_EPI_PINS );
    epiData |= (inputPins & 0x0000000F) << 16;
    epiData |= (inputPins & 0x00000010) << 22;

    epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTM_BASE, PORT_M_EPI_PINS ) ) >> 16;
    epiData |= MAP_GPIOPinRead( GPIO_PORTP_BASE, PORT_P_EPI_PINS ) << 27;
    epiData |= MAP_GPIOPinRead( GPIO_PORTQ_BASE, PORT_Q_EPI_PINS ) << 20;
    #else
    epiData = HWREG( 0xA0000000 );
    #endif
    }
    }

  • epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTM_BASE, PORT_M_EPI_PINS ) ) >> 16;
    epiData |= MAP_GPIOPinRead( GPIO_PORTP_BASE, PORT_P_EPI_PINS ) << 27;
    epiData |= MAP_GPIOPinRead( GPIO_PORTQ_BASE, PORT_Q_EPI_PINS ) << 20;
    #else
    epiData = HWREG( 0xA0000000 );
    #endif

    Hi Patrick,

      I still see you read from 0xA0000000. This is a memory based address to read if you are in SDRAM or Host-Bus mode. Have you tried reading from 0x400D.0070 when you are in EPI custom GPIO mode?

    In addition, the EPI controller provides custom GPIO that can use a FIFO with speed
    control by using either the internal write FIFO (WFIFO) or the non-blocking read FIFO (NBRFIFO).
    The WFIFO can hold 4 words of data that are written to the external interface at the rate controlled
    by the EPI Main Baud Rate (EPIBAUD) registers. The NBRFIFO can hold 8 words of data and
    samples at the rate controlled by the EPIBAUD register. The EPI controller provides predictable
    operation and thus has an advantage over regular GPIO which has more variable timing due to
    on-chip bus arbitration and delays across bus bridges

  • Still going in circles with no forward progress.  This is getting frustrating given that I can make it work when I configure all the pins as general purpose inputs.  Attempting to use the EPI TivaWare API's is not providing any success.  As you suggested I changed two lines in my code:

    Changed MAP_EPIAddressMapSet( EPI0_BASE, EPI_ADDR_PER_BASE_A ); to MAP_EPIAddressMapSet( EPI0_BASE, EPI_ADDR_CODE_BASE_NONE );

    Changed epiData = HWREG( 0xA0000000 ); to epiData = HWREG( 0x400D0070 );

    When running it always reads 0x60261C82 when it should toggle between the following test patterns.

    const uint32_t EPI_DATA_PATTERN[ 2 ] =
    {
    0xAA55AA55,
    0x55AA55AA
    };

    Can you please confirm that you have used the EPI bus in general purpose mode?  We have made zero progress on resolving this issue.  Please show me you have done testing with the EPI in general purpose mode by providing some working example code.

    I also tried the suggested changes in E2E design support forum titled TM4C1294 EPI GPIO Mode.  Which suggested the need to use EPI_GPMODE_CLKPIN in the MAP_EPIConfigGPModeSet API.  This also did not work, but it did provide values that cycled between two values although not the expected data pattern.  If Amit is still working at TI can you check with him on how to move this forward?

  • Can you please confirm that you have used the EPI bus in general purpose mode?  We have made zero progress on resolving this issue.  Please show me you have done testing with the EPI in general purpose mode by providing some working example code.

    I also tried the suggested changes in E2E design support forum titled TM4C1294 EPI GPIO Mode.  Which suggested the need to use EPI_GPMODE_CLKPIN in the MAP_EPIConfigGPModeSet API.  This also did not work, but it did provide values that cycled between two values although not the expected data pattern.  If Amit is still working at TI can you check with him on how to move this forward?

    Hi Patrick,

      I fully understand your frustration. Amit has left the group a long time ago. I myself have not used general purpose mode before and I must also that other than a LaunchPad, I don't have a board that can easily talk to an external device using EPI GPIO mode. 

      Can you show your entire EPI module register dump? Or if you don't mind, send me your entire main file with the code so I can run on my own. I want to see if I can make sense of the register setting against spec. The datasheet is actually not that clear about the address and clock setting when used in GPIO mode. 

      I have found one more post about GPIO mode between Amit and another poster. Not sure if you have seen this one. The poster seems to have resolved the issue.

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/553692/configuring-epi-for-gpio-mode/2024408?tisearch=e2e-sitesearch&keymatch=TM4C1294%2520EPI%2520GPIO%2520Mode#2024408

    This below one may be also worth reading. 

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/547978/write-16-bits-in-epi-gpio-mode-no-address-bits---no-clock-output/2068338?tisearch=e2e-sitesearch&keymatch=TM4C1294%252520EPI%252520GPIO%252520Mode#2068338

     

  • How do I send my code files to you?  I don't see any options to attach files.

  • You can just drag the file into the editing window. 

  • 
    /**
     * main.c
     */
    
    // Compiler headers
    #include <stdbool.h>
    #include <stdint.h>
    #include <string.h>
    
    // Tivaware headers
    #include <inc/hw_memmap.h>
    #include <inc/hw_epi.h>
    #include <inc/hw_ints.h>
    #include <inc/hw_types.h>
    #include <driverlib/pin_map.h>
    #include <driverlib/sysctl.h>
    #include <driverlib/gpio.h>
    #include <driverlib/rom.h>
    #include <driverlib/rom_map.h>
    #include <driverlib/epi.h>
    #include <driverlib/sysctl.h>
     
    // Application specific headers
    #include "epiTestPinMap.h"
    
    /******************************************************************************/
    /*                          PRE-PROCESSOR DIRECTIVE(S)                        */
    /******************************************************************************/
    //#define BIT_BANG
    
    /******************************************************************************/
    /*                     GLOBAL MODULE SPECIFIC ENUMERATION(S)                  */
    /******************************************************************************/
    enum outputStateChange_e	// List of available update output commands 
    {
    	DISABLE_OUTPUT = 0,		// Disable specified output pin
    	ENABLE_OUTPUT,			// Enable specified output pin
    	TOGGLE_OUTPUT			// Toggle specified output pin
    };
    
    /******************************************************************************/
    /*                      LOCAL MODULE SPECIFIC DEFINITION(S)                   */
    /******************************************************************************/
    #define EPI_PORT 	( 0xA0000000 )	// Address assigned to the EPI port
    
    /******************************************************************************/
    /*                       LOCAL MODULE SPECIFIC CONSTANT(S)                    */
    /******************************************************************************/
    const uint32_t EPI_DATA_PATTERN[ 2 ] =
    {
    	0xAA55AA55,
    	0x55AA55AA
    };
    
    /******************************************************************************/
    /*                              GLOBAL VARIABLES                              */
    /******************************************************************************/
    uint32_t  m_sysClockFreq;	// Master system clock frequency
    
    /******************************************************************************/
    /*                           FUNCTION DECLERATIONS                            */
    /******************************************************************************/
    static void configGeneralPurposeIOPins( void );
    static void enablePeripheral( uint32_t );
    static void initGPOutput( uint32_t, uint8_t, uint8_t );
    static void configEPIPeripheral( void );
    static void configEPIBusPins( void );
    static void testEPI( void );
    static void updateOutputState( uint32_t, uint8_t, enum outputStateChange_e );
    
    /******************************************************************************/
    /*                                     MAIN                                   */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function is the main program.                           */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       : None                                                         */
    /*                                                                            */
    /******************************************************************************/
    int main( void )
    {	
    	m_sysClockFreq = MAP_SysCtlClockFreqSet( (SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_240), MASTER_CLOCK_FREQUENCY );	// Run from the PLL at 120 MHz
    
    	configGeneralPurposeIOPins( );	// Configure all the general purpose I/O pins
    	configEPIPeripheral( );			// Configure EPI communications peripheral
    	
    	testEPI( );						// Call routine to test EPI communications
    }
    
    /******************************************************************************/
    /*                CONFIGURE GENERAL PURPOSE INPUT/OUTPUT PINS                 */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function configures the general purpose input/output    */
    /*               pins.                                                        */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       : Unused pins are configured as inputs.                        */
    /*                                                                            */
    /******************************************************************************/
    static void configGeneralPurposeIOPins( void )
    {	
    	enablePeripheral( SYSCTL_PERIPH_GPIOA );											// Enable GPIO port A peripheral
    	initGPOutput( GPIO_PORTA_BASE, PORT_A_GPIO_OUTPUTS, 0 );							// Call routine to configure the port A general purpose output pins
    
    	enablePeripheral( SYSCTL_PERIPH_GPIOF );											// Enable GPIO port F peripheral
    	initGPOutput( GPIO_PORTF_BASE, PORT_F_GPIO_OUTPUTS, 0 );							// Call routine to configure the port F general purpose output pins
    
    	enablePeripheral( SYSCTL_PERIPH_GPIOJ );											// Enable GPIO port J peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTJ_BASE, PORT_J_GPIO_INPUTS ); 					// Configure port J input pins
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOK );											// Enable GPIO port K peripheral
    	initGPOutput( GPIO_PORTK_BASE, PORT_K_GPIO_OUTPUTS, 0 );							// Call routine to configure the port K general purpose output pins
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOL );											// Enable GPIO port L peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTL_BASE, INPUT_FPGA_DONE_PL5 ); 					// Configure port L input pin
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOM );											// Enable GPIO port M peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTM_BASE, INPUT_FPGA_STALL_PM6 ); 					// Configure port M input pin
    	MAP_GPIOPinTypeGPIOOutputOD( GPIO_PORTM_BASE, OUTPUT_FPGA_RESET_PM7 ); 				// Configure FPGA reset as a open drain output, externally pulled up
    	MAP_GPIOPinWrite( GPIO_PORTM_BASE, OUTPUT_FPGA_RESET_PM7, OUTPUT_FPGA_RESET_PM7 );	// Clear FPGA reset, allow to run
    	initGPOutput( GPIO_PORTM_BASE, PORT_M_GPIO_OUTPUTS, 0 );							// Call routine to configure the port M general purpose output pins
    	
    	enablePeripheral( SYSCTL_PERIPH_GPION );											// Enable GPIO port N peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTN_BASE, INPUT_EPI0_WRT_ACK_PN5 ); 				// Configure port N input pin
    	initGPOutput( GPIO_PORTN_BASE, PORT_N_GPIO_OUTPUTS, 0 );							// Call routine to configure the port N general purpose output pins
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOP );											// Enable GPIO port P peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTP_BASE, PORT_P_GPIO_INPUTS ); 					// Configure port P input pins
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOQ );											// Enable GPIO port Q peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTQ_BASE, INPUT_IO_EXPANDER_INT_PQ4 ); 			// Configure port Q interrupt input pin	
    }
    
    /******************************************************************************/
    /*                              ENABLE PERIPHERAL                             */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function enables specified peripheral.                  */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       :                                                              */
    /*                                                                            */
    /******************************************************************************/
    static void enablePeripheral( uint32_t peripheralId )
    {
    	MAP_SysCtlPeripheralEnable( peripheralId );				// Enable the requested peripheral
    	while( ! MAP_SysCtlPeripheralReady( peripheralId ) );	// Wait for requested peripheral to be ready
    }
    
    /******************************************************************************/
    /*                      CONFIGURE GENERAL PURPOSE OUTPUTS                     */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function configures the requested ports general purpose */
    /*               output pins.                                                 */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       :                                                              */
    /*                                                                            */
    /******************************************************************************/
    static void initGPOutput( uint32_t port, uint8_t pins, uint8_t initState )
    {
    	MAP_GPIOPinTypeGPIOOutput( port, pins ); 	// Configure specified port input pins
    	MAP_GPIOPinWrite( port, pins, initState );	// Set specified port output to default state
    }
    
    /******************************************************************************/
    /*                          CONFIGURE EPI PERIPHERAL                          */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function configures the EPI peripheral.                 */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       :                                                              */
    /*                                                                            */
    /******************************************************************************/
    static void configEPIPeripheral( void )
    {
    #ifdef BIT_BANG	
    	enablePeripheral( SYSCTL_PERIPH_GPIOA );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTA_BASE, PORT_A_EPI_PINS ); 							// Configure port A EPI pins as input
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOB );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTB_BASE, PORT_B_EPI_PINS ); 							// Configure port B EPI pins as input
    
    	enablePeripheral( SYSCTL_PERIPH_GPIOC );												// Call routine to enable port D GPIO
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTC_BASE, PORT_C_EPI_PINS ); 							// Configure port C EPI pins as input
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOG );												// Call routine to enable port D GPIO
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTG_BASE, PORT_G_EPI_PINS ); 							// Configure port G EPI pins as input
    
    	enablePeripheral( SYSCTL_PERIPH_GPIOH );												// Call routine to enable port D GPIO
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTH_BASE, PORT_H_EPI_PINS ); 							// Configure port H EPI pins as input
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOK );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTK_BASE, PORT_K_EPI_PINS ); 							// Configure port K EPI pins as input
    	enablePeripheral( SYSCTL_PERIPH_GPIOL );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTL_BASE, PORT_L_EPI_PINS ); 							// Configure port L EPI pins as input
    	enablePeripheral( SYSCTL_PERIPH_GPIOM );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTM_BASE, PORT_M_EPI_PINS ); 							// Configure port M EPI pins as input
    	enablePeripheral( SYSCTL_PERIPH_GPIOP );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTP_BASE, PORT_P_EPI_PINS ); 							// Configure port P EPI pins as input
    	enablePeripheral( SYSCTL_PERIPH_GPIOQ );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTQ_BASE, PORT_Q_EPI_PINS ); 							// Configure port Q EPI pins as input	
    #else
    	enablePeripheral( SYSCTL_PERIPH_EPI0 );													// Call routine to enable EPI peripheral
    	configEPIBusPins( );																	// Call routine to configure EPI bus pins
    	
    	MAP_EPIModeSet( EPI0_BASE, EPI_MODE_GENERAL );											// Set mode to general purpose to interface with FPGA
    	MAP_EPIDividerSet( EPI0_BASE, 2 );														// Check whether required.
    	MAP_EPIConfigGPModeSet( EPI0_BASE, EPI_GPMODE_CLKPIN | EPI_GPMODE_DSIZE_32, 0, 0 );		// No Clock out, No address, 32bit
    //	MAP_EPIConfigGPModeSet( EPI0_BASE, EPI_GPMODE_ASIZE_NONE | EPI_GPMODE_DSIZE_32, 0, 0 );	// No Clock out, No address, 32bit
    
    //	MAP_EPIAddressMapSet( EPI0_BASE, EPI_ADDR_CODE_BASE_NONE );  							// Address map to 0xA000.0000
    	MAP_EPIAddressMapSet( EPI0_BASE, EPI_ADDR_PER_BASE_A );  								// Address map to 0xA000.0000
    #endif	
    }
    
    /******************************************************************************/
    /*                            CONFIGURE EPI BUS PINS                          */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function configures the pins used for the extended      */
    /*               peripheral interface bus.                                    */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       : Provides a 32-bit communications to receive data from the    */
    /*               FPGA.                                                        */
    /*                                                                            */
    /******************************************************************************/
    static void configEPIBusPins( void )
    {
        enablePeripheral( SYSCTL_PERIPH_GPIOA );                // Call routine to enable port C GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTA_BASE, PORT_A_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( GPIO_PA6_EPI0S8 );       			// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PA7_EPI0S9 );       			// Assign individual port pin to EPI bus
    
    	enablePeripheral( SYSCTL_PERIPH_GPIOB );                // Call routine to enable port C GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTB_BASE, PORT_B_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( EPI0_SIGNAL_27_PB2 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_28_PB3 );       		// Assign individual port pin to EPI bus
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOC );				// Call routine to enable port C GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTC_BASE, PORT_C_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( EPI0_SIGNAL_7_PC4 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_6_PC5 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_5_PC6 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_4_PC7 );       		// Assign individual port pin to EPI bus
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOG );				// Call routine to enable port G GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTG_BASE, PORT_G_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( EPI0_SIGNAL_11_PG0 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_10_PG1 );       		// Assign individual port pin to EPI bus
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOH );				// Call routine to enable port H GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTH_BASE, PORT_H_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( EPI0_SIGNAL_0_PH0 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_1_PH1 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_2_PH2 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_3_PH3 );       		// Assign individual port pin to EPI bus
        
    	enablePeripheral( SYSCTL_PERIPH_GPIOK );                // Call routine to enable port C GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTK_BASE, PORT_K_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( EPI0_SIGNAL_31_PK5 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_25_PK6 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_24_PK7 );       		// Assign individual port pin to EPI bus
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOL );                // Call routine to enable port C GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTL_BASE, PORT_L_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( EPI0_SIGNAL_16_PL0 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_17_PL1 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_18_PL2 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_19_PL3 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_26_PL4 );       		// Assign individual port pin to EPI bus
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOM );                // Call routine to enable port C GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTM_BASE, PORT_M_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( EPI0_SIGNAL_15_PM0 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_14_PM1 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_13_PM2 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_12_PM3 );       		// Assign individual port pin to EPI bus
        
    	enablePeripheral( SYSCTL_PERIPH_GPIOP );                // Call routine to enable port C GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTP_BASE, PORT_P_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( EPI0_SIGNAL_29_PP2 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_30_PP3 );       		// Assign individual port pin to EPI bus
    
    	enablePeripheral( SYSCTL_PERIPH_GPIOQ );                // Call routine to enable port C GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTQ_BASE, PORT_Q_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( EPI0_SIGNAL_20_PQ0 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_21_PQ1 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_22_PQ2 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( EPI0_SIGNAL_23_PQ3 );       		// Assign individual port pin to EPI bus
    }
    
    /******************************************************************************/
    /*                                TEST EPI BUS                                */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function tests receiving FPGA data on the EPI bus.      */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       :                                                              */
    /*                                                                            */
    /******************************************************************************/
    static void testEPI( void )
    {
    	uint32_t inx,
    #ifdef BIT_BANG
    	        inputPins,
    #endif
    	         epiData;
    
    	for( inx = 0 ; inx < 100 ; inx++ )
    	{
    		updateOutputState( GPIO_PORTM_BASE, OUTPUT_EPI0_CTS_PM5, ENABLE_OUTPUT );			// Set read ack to false while reading data
    
    		while( ! MAP_GPIOPinRead( GPIO_PORTP_BASE, INPUT_EPI0_RTS_INT_PP0 ) );				// Wait for FPGA to indicate data ready to read
    
    		updateOutputState( GPIO_PORTM_BASE, OUTPUT_EPI0_CTS_PM5, DISABLE_OUTPUT );			// Set read ack to false while reading data
    
    #ifdef BIT_BANG
    		epiData = MAP_GPIOPinRead( GPIO_PORTA_BASE, PORT_A_EPI_PINS ) << 2;					// Read the port A EPI input pins
    		epiData |= MAP_GPIOPinRead( GPIO_PORTB_BASE, PORT_B_EPI_PINS ) << 25;				// Read the port B EPI input pins
    		epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTC_BASE, PORT_C_EPI_PINS ) ) >> 20; 	// Read the port C EPI input pins
    		epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTG_BASE, PORT_G_EPI_PINS ) ) >> 20; 	// Read the port G EPI input pins
    		epiData |= MAP_GPIOPinRead( GPIO_PORTH_BASE, PORT_H_EPI_PINS );						// Read the port H EPI input pins
    
    		inputPins = MAP_GPIOPinRead( GPIO_PORTK_BASE, PORT_K_EPI_PINS );					// Read the port K EPI input pins
    		epiData |= (inputPins & 0x00000020) << 26;											// Mask off bit 5 and load bit into position 31
    		epiData |= (inputPins & 0x00000080) << 17;                                      	// Mask off bit 7 and load bit into position 24
            epiData |= (inputPins & 0x00000040) << 19;                                      	// Mask off bit 6 and load bit into position 25
    
    		inputPins = MAP_GPIOPinRead( GPIO_PORTL_BASE, PORT_L_EPI_PINS );					// Read the port L EPI input pins
    		epiData |= (inputPins & 0x0000000F) << 16;                                    		// Load bits 0 - 3 into positions 16 - 19  
    		epiData |= (inputPins & 0x00000010) << 22;                                    		// Load bit 4 into position 22
    
    		epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTM_BASE, PORT_M_EPI_PINS ) ) >> 16;		// Read the port M EPI input pins
    		epiData |= MAP_GPIOPinRead( GPIO_PORTP_BASE, PORT_P_EPI_PINS ) << 27;				// Read the port P EPI input pins
            epiData |= MAP_GPIOPinRead( GPIO_PORTQ_BASE, PORT_Q_EPI_PINS ) << 20;           	// Read the port Q EPI input pins
    #else
    //        epiData = HWREG( 0x400D0070 );                                                  	// Read the FPGA data from EPI bus
            epiData = HWREG( EPI_PORT );                                                  	// Read the FPGA data from EPI bus
    #endif
            updateOutputState( GPIO_PORTN_BASE, OUTPUT_EPI0_READ_DONE_PN4, ENABLE_OUTPUT );    	// Initialize read ack to true
    
            while( MAP_GPIOPinRead( GPIO_PORTP_BASE, INPUT_EPI0_RTS_INT_PP0 ) );            	// Wait for FPGA to indicate data cleared
    
            updateOutputState( GPIO_PORTN_BASE, OUTPUT_EPI0_READ_DONE_PN4, DISABLE_OUTPUT );   	// Initialize read ack to true
    
    		if( epiData != EPI_DATA_PATTERN[ inx % 2 ] )										// If the EPI data doesn't match the expected value
    		    epiData = epiData;																// Breakpoint to check for errors
    	}
    }
    
    /******************************************************************************/
    /*                             UPDATE OUTPUT STATE                            */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function updates the specified pin state.               */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       :                                                              */
    /*                                                                            */
    /******************************************************************************/
    static void updateOutputState( uint32_t port, uint8_t pin, enum outputStateChange_e action )
    {
    	uint8_t state;
    	
    	state = MAP_GPIOPinRead( port, pin );	// Read current pin state
    	switch( action )						// Branch based on the requested action
    	{
    		case DISABLE_OUTPUT :				// If request to disable the specified output
    			state &= ~pin;					// Clear requested pin state
    			break;
    		case ENABLE_OUTPUT  :				// If request to enable the specified output
    			state |= pin;					// Set requested pin state
    			break;
    		case TOGGLE_OUTPUT  :				// If request to toggle the specified output
    			state ^= pin;					// Toggle the specified pin state
    			break;
    	}
    	MAP_GPIOPinWrite( port, pin, state );	// Set specified port output to default state
    }
    
    
    epiTestPinMap.h

    Please find attached the program and header file.  With the current configuration I'm receiving 0x256 on the even index and 0x512 on the odd index and expect 0xAA55AA55 on even index and 0x55AA55AA on the odd index.

  • Hi Patrick,

      I have found one major issue with your pin configuration. I asked you before to check the PCTL registers and you said they are correct. When I run your code, the PCTL registers are not correctly programmed. Let me just pick one line for explanation.

    You have a below line in your EPI0 pin configuration.

    MAP_GPIOPinConfigure( EPI0_SIGNAL_27_PB2 ); // Assign individual port pin to EPI bus

    You redefine EPI0_SIGNAL_27_PB2 as GPIO_PIN_2  and this is absolutely wrong. 

    enum portB_pinMap_e
    {
    USB0_ID_PB0 = GPIO_PIN_0, 
    EPI0_SIGNAL_27_PB2 = GPIO_PIN_2,
    EPI0_SIGNAL_28_PB3 = GPIO_PIN_3,
    QSPI1_ENABLE_PB4 = GPIO_PIN_4, 
    QSPI1_CLK_PB5 = GPIO_PIN_5 
    }

    If you look at how GPIO_PIN_2 is defined, it is equal to 0x00000004. 

    #define GPIO_PIN_0 0x00000001 // GPIO pin 0
    #define GPIO_PIN_1 0x00000002 // GPIO pin 1
    #define GPIO_PIN_2 0x00000004 // GPIO pin 2
    #define GPIO_PIN_3 0x00000008 // GPIO pin 3
    #define GPIO_PIN_4 0x00000010 // GPIO pin 4
    #define GPIO_PIN_5 0x00000020 // GPIO pin 5
    #define GPIO_PIN_6 0x00000040 // GPIO pin 6
    #define GPIO_PIN_7 0x00000080 // GPIO pin 7

    BUT:

    If you were to use the predefined pin macro GPIO_PB2_EPI0S27  in TivaWare, you wouldn't have the problem. The GPIO_PB2_EPI0S27  is equal to 0x0001080F. The lower nibble has the value of F that is used to program the PCTL with F. This is to select the 15th pin mux option. Obviously 0x00000004  is not equal to 0x0001080F. You need to fix up all the MAP_GPIOPinConfigure issue first. 

    MAP_GPIOPinConfigure( GPIO_PB2_EPI0S27 );

    #define GPIO_PB2_T5CCP0 0x00010803
    #define GPIO_PB2_I2C0SCL 0x00010802
    #define GPIO_PB2_USB0STP 0x0001080E
    #define GPIO_PB2_EPI0S27 0x0001080F

  • 
    /**
     * main.c
     */
    
    // Compiler headers
    #include <stdbool.h>
    #include <stdint.h>
    #include <string.h>
    #include <math.h>
    
    // Tivaware headers
    //#include <inc/tm4c1294kcpdt.h>
    #include <inc/hw_memmap.h>
    #include <inc/hw_epi.h>
    #include <inc/hw_ints.h>
    #include <inc/hw_types.h>
    #include <inc/hw_i2c.h>
    #include <driverlib/pin_map.h>
    #include <driverlib/sysctl.h>
    #include <driverlib/gpio.h>
    #include <driverlib/rom.h>
    #include <driverlib/rom_map.h>
    #include <driverlib/epi.h>
    #include <driverlib/i2c.h>
    #include <driverlib/ssi.h>
    #include <driverlib/sysctl.h>
    #include <driverlib/interrupt.h>
    #include <driverlib/adc.h>
    #include <driverlib/uart.h>
    #include <driverlib/watchdog.h>
    #include <driverlib/crc.h>
    #include <utils/uartstdio.h>
     
    // Application specific headers
    #include "epiTestPinMap.h"
    
    /******************************************************************************/
    /*                          PRE-PROCESSOR DIRECTIVE(S)                        */
    /******************************************************************************/
    //#define BIT_BANG
    
    /******************************************************************************/
    /*                     GLOBAL MODULE SPECIFIC ENUMERATION(S)                  */
    /******************************************************************************/
    enum outputStateChange_e	// List of available update output commands 
    {
    	DISABLE_OUTPUT = 0,		// Disable specified output pin
    	ENABLE_OUTPUT,			// Enable specified output pin
    	TOGGLE_OUTPUT			// Toggle specified output pin
    };
    
    /******************************************************************************/
    /*                      LOCAL MODULE SPECIFIC DEFINITION(S)                   */
    /******************************************************************************/
    #define EPI_PORT 	( 0xA0000000 )	// Address assigned to the EPI port
    
    /******************************************************************************/
    /*                       LOCAL MODULE SPECIFIC CONSTANT(S)                    */
    /******************************************************************************/
    const uint32_t EPI_DATA_PATTERN[ 2 ] =
    {
    	0xAA55AA55,
    	0x55AA55AA
    };
    
    /******************************************************************************/
    /*                              GLOBAL VARIABLES                              */
    /******************************************************************************/
    uint32_t  m_sysClockFreq;	// Master system clock frequency
    
    /******************************************************************************/
    /*                           FUNCTION DECLERATIONS                            */
    /******************************************************************************/
    static void configGeneralPurposeIOPins( void );
    static void enablePeripheral( uint32_t );
    static void initGPOutput( uint32_t, uint8_t, uint8_t );
    static void configEPIPeripheral( void );
    static void configEPIBusPins( void );
    static void testEPI( void );
    static void updateOutputState( uint32_t, uint8_t, enum outputStateChange_e );
    
    /******************************************************************************/
    /*                                     MAIN                                   */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function is the main program.                           */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       : None                                                         */
    /*                                                                            */
    /******************************************************************************/
    int main( void )
    {	
    	m_sysClockFreq = MAP_SysCtlClockFreqSet( (SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_240), MASTER_CLOCK_FREQUENCY );	// Run from the PLL at 120 MHz
    
    	configGeneralPurposeIOPins( );	// Configure all the general purpose I/O pins
    	configEPIPeripheral( );			// Configure EPI communications peripheral
    	
    	testEPI( );						// Call routine to test EPI communications
    }
    
    /******************************************************************************/
    /*                CONFIGURE GENERAL PURPOSE INPUT/OUTPUT PINS                 */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function configures the general purpose input/output    */
    /*               pins.                                                        */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       : Unused pins are configured as inputs.                        */
    /*                                                                            */
    /******************************************************************************/
    static void configGeneralPurposeIOPins( void )
    {	
    	enablePeripheral( SYSCTL_PERIPH_GPIOA );											// Enable GPIO port A peripheral
    	initGPOutput( GPIO_PORTA_BASE, PORT_A_GPIO_OUTPUTS, 0 );							// Call routine to configure the port A general purpose output pins
    
    	enablePeripheral( SYSCTL_PERIPH_GPIOF );											// Enable GPIO port F peripheral
    	initGPOutput( GPIO_PORTF_BASE, PORT_F_GPIO_OUTPUTS, 0 );							// Call routine to configure the port F general purpose output pins
    
    	enablePeripheral( SYSCTL_PERIPH_GPIOJ );											// Enable GPIO port J peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTJ_BASE, PORT_J_GPIO_INPUTS ); 					// Configure port J input pins
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOK );											// Enable GPIO port K peripheral
    	initGPOutput( GPIO_PORTK_BASE, PORT_K_GPIO_OUTPUTS, 0 );							// Call routine to configure the port K general purpose output pins
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOL );											// Enable GPIO port L peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTL_BASE, INPUT_FPGA_DONE_PL5 ); 					// Configure port L input pin
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOM );											// Enable GPIO port M peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTM_BASE, INPUT_FPGA_STALL_PM6 ); 					// Configure port M input pin
    	MAP_GPIOPinTypeGPIOOutputOD( GPIO_PORTM_BASE, OUTPUT_FPGA_RESET_PM7 ); 				// Configure FPGA reset as a open drain output, externally pulled up
    	MAP_GPIOPinWrite( GPIO_PORTM_BASE, OUTPUT_FPGA_RESET_PM7, OUTPUT_FPGA_RESET_PM7 );	// Clear FPGA reset, allow to run
    	initGPOutput( GPIO_PORTM_BASE, PORT_M_GPIO_OUTPUTS, 0 );							// Call routine to configure the port M general purpose output pins
    	
    	enablePeripheral( SYSCTL_PERIPH_GPION );											// Enable GPIO port N peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTN_BASE, INPUT_EPI0_WRT_ACK_PN5 ); 				// Configure port N input pin
    	initGPOutput( GPIO_PORTN_BASE, PORT_N_GPIO_OUTPUTS, 0 );							// Call routine to configure the port N general purpose output pins
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOP );											// Enable GPIO port P peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTP_BASE, PORT_P_GPIO_INPUTS ); 					// Configure port P input pins
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOQ );											// Enable GPIO port Q peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTQ_BASE, INPUT_IO_EXPANDER_INT_PQ4 ); 			// Configure port Q interrupt input pin	
    }
    
    /******************************************************************************/
    /*                              ENABLE PERIPHERAL                             */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function enables specified peripheral.                  */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       :                                                              */
    /*                                                                            */
    /******************************************************************************/
    static void enablePeripheral( uint32_t peripheralId )
    {
    	MAP_SysCtlPeripheralEnable( peripheralId );				// Enable the requested peripheral
    	while( ! MAP_SysCtlPeripheralReady( peripheralId ) );	// Wait for requested peripheral to be ready
    }
    
    /******************************************************************************/
    /*                      CONFIGURE GENERAL PURPOSE OUTPUTS                     */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function configures the requested ports general purpose */
    /*               output pins.                                                 */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       :                                                              */
    /*                                                                            */
    /******************************************************************************/
    static void initGPOutput( uint32_t port, uint8_t pins, uint8_t initState )
    {
    	MAP_GPIOPinTypeGPIOOutput( port, pins ); 	// Configure specified port input pins
    	MAP_GPIOPinWrite( port, pins, initState );	// Set specified port output to default state
    }
    
    /******************************************************************************/
    /*                          CONFIGURE EPI PERIPHERAL                          */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function configures the EPI peripheral.                 */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       :                                                              */
    /*                                                                            */
    /******************************************************************************/
    static void configEPIPeripheral( void )
    {
    #ifdef BIT_BANG	
    	enablePeripheral( SYSCTL_PERIPH_GPIOA );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTA_BASE, PORT_A_EPI_PINS ); 							// Configure port A EPI pins as input
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOB );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTB_BASE, PORT_B_EPI_PINS ); 							// Configure port B EPI pins as input
    
    	enablePeripheral( SYSCTL_PERIPH_GPIOC );												// Call routine to enable port D GPIO
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTC_BASE, PORT_C_EPI_PINS ); 							// Configure port C EPI pins as input
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOG );												// Call routine to enable port D GPIO
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTG_BASE, PORT_G_EPI_PINS ); 							// Configure port G EPI pins as input
    
    	enablePeripheral( SYSCTL_PERIPH_GPIOH );												// Call routine to enable port D GPIO
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTH_BASE, PORT_H_EPI_PINS ); 							// Configure port H EPI pins as input
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOK );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTK_BASE, PORT_K_EPI_PINS ); 							// Configure port K EPI pins as input
    	enablePeripheral( SYSCTL_PERIPH_GPIOL );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTL_BASE, PORT_L_EPI_PINS ); 							// Configure port L EPI pins as input
    	enablePeripheral( SYSCTL_PERIPH_GPIOM );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTM_BASE, PORT_M_EPI_PINS ); 							// Configure port M EPI pins as input
    	enablePeripheral( SYSCTL_PERIPH_GPIOP );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTP_BASE, PORT_P_EPI_PINS ); 							// Configure port P EPI pins as input
    	enablePeripheral( SYSCTL_PERIPH_GPIOQ );												// Enable GPIO port A peripheral
    	MAP_GPIOPinTypeGPIOInput( GPIO_PORTQ_BASE, PORT_Q_EPI_PINS ); 							// Configure port Q EPI pins as input	
    #else
    	enablePeripheral( SYSCTL_PERIPH_EPI0 );													// Call routine to enable EPI peripheral
    	configEPIBusPins( );																	// Call routine to configure EPI bus pins
    	
    	MAP_EPIModeSet( EPI0_BASE, EPI_MODE_GENERAL );											// Set mode to general purpose to interface with FPGA
    	MAP_EPIDividerSet( EPI0_BASE, 2 );														// Check whether required.
    	MAP_EPIConfigGPModeSet( EPI0_BASE, EPI_GPMODE_CLKPIN | EPI_GPMODE_DSIZE_32, 0, 0 );		// No Clock out, No address, 32bit
    //	MAP_EPIConfigGPModeSet( EPI0_BASE, EPI_GPMODE_ASIZE_NONE | EPI_GPMODE_DSIZE_32, 0, 0 );	// No Clock out, No address, 32bit
    
    //	MAP_EPIAddressMapSet( EPI0_BASE, EPI_ADDR_CODE_BASE_NONE );  							// Address map to 0xA000.0000
    	MAP_EPIAddressMapSet( EPI0_BASE, EPI_ADDR_PER_BASE_A );  								// Address map to 0xA000.0000
    #endif	
    }
    
    /******************************************************************************/
    /*                            CONFIGURE EPI BUS PINS                          */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function configures the pins used for the extended      */
    /*               peripheral interface bus.                                    */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       : Provides a 32-bit communications to receive data from the    */
    /*               FPGA.                                                        */
    /*                                                                            */
    /******************************************************************************/
    static void configEPIBusPins( void )
    {
        enablePeripheral( SYSCTL_PERIPH_GPIOA );                // Call routine to enable port A GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTA_BASE, PORT_A_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( GPIO_PA6_EPI0S8 );       			// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PA7_EPI0S9 );       			// Assign individual port pin to EPI bus
    
    	enablePeripheral( SYSCTL_PERIPH_GPIOB );                // Call routine to enable port B GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTB_BASE, PORT_B_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( GPIO_PB2_EPI0S27 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PB3_EPI0S28 );       		// Assign individual port pin to EPI bus
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOC );				// Call routine to enable port C GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTC_BASE, PORT_C_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( GPIO_PC4_EPI0S7 );       			// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PC5_EPI0S6 );       			// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PC6_EPI0S5 );       			// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PC7_EPI0S4 );       			// Assign individual port pin to EPI bus
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOG );				// Call routine to enable port G GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTG_BASE, PORT_G_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( GPIO_PG0_EPI0S11 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PG1_EPI0S10 );       		// Assign individual port pin to EPI bus
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOH );				// Call routine to enable port H GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTH_BASE, PORT_H_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( GPIO_PH0_EPI0S0 );       			// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PH1_EPI0S1 );       			// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PH2_EPI0S2 );       			// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PH3_EPI0S3 );       			// Assign individual port pin to EPI bus
        
    	enablePeripheral( SYSCTL_PERIPH_GPIOK );                // Call routine to enable port K GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTK_BASE, PORT_K_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( GPIO_PK5_EPI0S31 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PK6_EPI0S25 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PK7_EPI0S24 );       		// Assign individual port pin to EPI bus
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOL );                // Call routine to enable port L GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTL_BASE, PORT_L_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( GPIO_PL0_EPI0S16 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PL1_EPI0S17 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PL2_EPI0S18 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PL3_EPI0S19 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PL4_EPI0S26 );       		// Assign individual port pin to EPI bus
    	
    	enablePeripheral( SYSCTL_PERIPH_GPIOM );                // Call routine to enable port M GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTM_BASE, PORT_M_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( GPIO_PM0_EPI0S15 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PM1_EPI0S14 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PM2_EPI0S13 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PM3_EPI0S12 );       		// Assign individual port pin to EPI bus
        
    	enablePeripheral( SYSCTL_PERIPH_GPIOP );                // Call routine to enable port P GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTP_BASE, PORT_P_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( GPIO_PP2_EPI0S29 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PP3_EPI0S30 );       		// Assign individual port pin to EPI bus
    
    	enablePeripheral( SYSCTL_PERIPH_GPIOQ );                // Call routine to enable port Q GPIO
        MAP_GPIOPinTypeEPI( GPIO_PORTQ_BASE, PORT_Q_EPI_PINS );	// Configure requested port EPI pins
        MAP_GPIOPinConfigure( GPIO_PQ0_EPI0S20 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PQ1_EPI0S21 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PQ2_EPI0S22 );       		// Assign individual port pin to EPI bus
        MAP_GPIOPinConfigure( GPIO_PQ3_EPI0S23 );       		// Assign individual port pin to EPI bus
    }
    
    /******************************************************************************/
    /*                                TEST EPI BUS                                */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function tests receiving FPGA data on the EPI bus.      */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       :                                                              */
    /*                                                                            */
    /******************************************************************************/
    static void testEPI( void )
    {
    	uint32_t inx,
    #ifdef BIT_BANG
    	         inputPins,
    #endif
    	         epiData;
    
    	for( inx = 0 ; inx < 100 ; inx++ )
    	{
    		updateOutputState( GPIO_PORTM_BASE, OUTPUT_EPI0_CTS_PM5, ENABLE_OUTPUT );			// Set read ack to false while reading data
    
    		while( ! MAP_GPIOPinRead( GPIO_PORTP_BASE, INPUT_EPI0_RTS_INT_PP0 ) );				// Wait for FPGA to indicate data ready to read
    
    		updateOutputState( GPIO_PORTM_BASE, OUTPUT_EPI0_CTS_PM5, DISABLE_OUTPUT );			// Set read ack to false while reading data
    
    #ifdef BIT_BANG
    		epiData = MAP_GPIOPinRead( GPIO_PORTA_BASE, PORT_A_EPI_PINS ) << 2;					// Read the port A EPI input pins
    		epiData |= MAP_GPIOPinRead( GPIO_PORTB_BASE, PORT_B_EPI_PINS ) << 25;				// Read the port B EPI input pins
    		epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTC_BASE, PORT_C_EPI_PINS ) ) >> 20; 	// Read the port C EPI input pins
    		epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTG_BASE, PORT_G_EPI_PINS ) ) >> 20; 	// Read the port G EPI input pins
    		epiData |= MAP_GPIOPinRead( GPIO_PORTH_BASE, PORT_H_EPI_PINS );						// Read the port H EPI input pins
    
    		inputPins = MAP_GPIOPinRead( GPIO_PORTK_BASE, PORT_K_EPI_PINS );					// Read the port K EPI input pins
    		epiData |= (inputPins & 0x00000020) << 26;											// Mask off bit 5 and load bit into position 31
    		epiData |= (inputPins & 0x00000080) << 17;                                      	// Mask off bit 7 and load bit into position 24
            epiData |= (inputPins & 0x00000040) << 19;                                      	// Mask off bit 6 and load bit into position 25
    
    		inputPins = MAP_GPIOPinRead( GPIO_PORTL_BASE, PORT_L_EPI_PINS );					// Read the port L EPI input pins
    		epiData |= (inputPins & 0x0000000F) << 16;                                    		// Load bits 0 - 3 into positions 16 - 19  
    		epiData |= (inputPins & 0x00000010) << 22;                                    		// Load bit 4 into position 22
    
    		epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTM_BASE, PORT_M_EPI_PINS ) ) >> 16;		// Read the port M EPI input pins
    		epiData |= MAP_GPIOPinRead( GPIO_PORTP_BASE, PORT_P_EPI_PINS ) << 27;				// Read the port P EPI input pins
            epiData |= MAP_GPIOPinRead( GPIO_PORTQ_BASE, PORT_Q_EPI_PINS ) << 20;           	// Read the port Q EPI input pins
    #else
    //        epiData = HWREG( 0x400D0070 );                                                  	// Read the FPGA data from EPI bus
            epiData = HWREG( EPI_PORT );                                                  	// Read the FPGA data from EPI bus
    #endif
            updateOutputState( GPIO_PORTN_BASE, OUTPUT_EPI0_READ_DONE_PN4, ENABLE_OUTPUT );    	// Initialize read ack to true
    
            while( MAP_GPIOPinRead( GPIO_PORTP_BASE, INPUT_EPI0_RTS_INT_PP0 ) );            	// Wait for FPGA to indicate data cleared
    
            updateOutputState( GPIO_PORTN_BASE, OUTPUT_EPI0_READ_DONE_PN4, DISABLE_OUTPUT );   	// Initialize read ack to true
    
    		if( epiData != EPI_DATA_PATTERN[ inx % 2 ] )										// If the EPI data doesn't match the expected value
    		    epiData = epiData;																// Breakpoint to check for errors
    	}
    }
    
    /******************************************************************************/
    /*                             UPDATE OUTPUT STATE                            */
    /******************************************************************************/
    /*                                                                            */
    /* Description : This function updates the specified pin state.               */
    /*                                                                            */
    /*============================================================================*/
    /* Notes       :                                                              */
    /*                                                                            */
    /******************************************************************************/
    static void updateOutputState( uint32_t port, uint8_t pin, enum outputStateChange_e action )
    {
    	uint8_t state;
    	
    	state = MAP_GPIOPinRead( port, pin );	// Read current pin state
    	switch( action )						// Branch based on the requested action
    	{
    		case DISABLE_OUTPUT :				// If request to disable the specified output
    			state &= ~pin;					// Clear requested pin state
    			break;
    		case ENABLE_OUTPUT  :				// If request to enable the specified output
    			state |= pin;					// Set requested pin state
    			break;
    		case TOGGLE_OUTPUT  :				// If request to toggle the specified output
    			state ^= pin;					// Toggle the specified pin state
    			break;
    	}
    	MAP_GPIOPinWrite( port, pin, state );	// Set specified port output to default state
    }
    
    
    4274.epiTestPinMap.h

    You are correct, this mistake was introduced during the multiple iterations while debugging.  When I confirmed the contents of PCTL it was setup correct.  I have attached the updated program.  The results are now always reading 2147483648 with using CLKPIN and 170 without using CLKPIN.  It still is not working as expected.  Let me know if you can find any additional errors that may be preventing this from working properly.

  • Hi Patrick,

      I don't have your board to interface with the FPGA using OUTPUT_EPI0_CTS_PM5 and INPUT_EPI0_RTS_INT_PP0 to handshake. Therefore, I comment out pretty much most of your testEPI() with the below code instead. I test it out on a LaunchPad. I connect EPI0S0 (PH0) and EPI0S1 (PH1) to 3.3V and I can see epiData equal to 0x80000003.  As far as I can see the bit0 and bit1 are correct. Why don't you give a try on your side?

      Please be aware of a major US holiday for the rest of the week and expect delayed response. 

    static void testEPI( void )
    {
        uint32_t inx,
    #ifdef BIT_BANG
                 inputPins,
    #endif
                 epiData;
        int i = 0;
    
        while (1){
    
            for (i=0;i<100;i++);
            epiData = HWREG( EPI_PORT );                                                    // Read the FPGA data from EPI bus
    
        }
    
    
    
    //    for( inx = 0 ; inx < 100 ; inx++ )
    //    {
    //        updateOutputState( GPIO_PORTM_BASE, OUTPUT_EPI0_CTS_PM5, ENABLE_OUTPUT );           // Set read ack to false while reading data
    //
    //        while( ! MAP_GPIOPinRead( GPIO_PORTP_BASE, INPUT_EPI0_RTS_INT_PP0 ) );              // Wait for FPGA to indicate data ready to read
    //
    //        updateOutputState( GPIO_PORTM_BASE, OUTPUT_EPI0_CTS_PM5, DISABLE_OUTPUT );          // Set read ack to false while reading data
    //
    //#ifdef BIT_BANG
    //        epiData = MAP_GPIOPinRead( GPIO_PORTA_BASE, PORT_A_EPI_PINS ) << 2;                 // Read the port A EPI input pins
    //        epiData |= MAP_GPIOPinRead( GPIO_PORTB_BASE, PORT_B_EPI_PINS ) << 25;               // Read the port B EPI input pins
    //        epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTC_BASE, PORT_C_EPI_PINS ) ) >> 20;     // Read the port C EPI input pins
    //        epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTG_BASE, PORT_G_EPI_PINS ) ) >> 20;     // Read the port G EPI input pins
    //        epiData |= MAP_GPIOPinRead( GPIO_PORTH_BASE, PORT_H_EPI_PINS );                     // Read the port H EPI input pins
    //
    //        inputPins = MAP_GPIOPinRead( GPIO_PORTK_BASE, PORT_K_EPI_PINS );                    // Read the port K EPI input pins
    //        epiData |= (inputPins & 0x00000020) << 26;                                          // Mask off bit 5 and load bit into position 31
    //        epiData |= (inputPins & 0x00000080) << 17;                                          // Mask off bit 7 and load bit into position 24
    //        epiData |= (inputPins & 0x00000040) << 19;                                          // Mask off bit 6 and load bit into position 25
    //
    //        inputPins = MAP_GPIOPinRead( GPIO_PORTL_BASE, PORT_L_EPI_PINS );                    // Read the port L EPI input pins
    //        epiData |= (inputPins & 0x0000000F) << 16;                                          // Load bits 0 - 3 into positions 16 - 19
    //        epiData |= (inputPins & 0x00000010) << 22;                                          // Load bit 4 into position 22
    //
    //        epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTM_BASE, PORT_M_EPI_PINS ) ) >> 16;     // Read the port M EPI input pins
    //        epiData |= MAP_GPIOPinRead( GPIO_PORTP_BASE, PORT_P_EPI_PINS ) << 27;               // Read the port P EPI input pins
    //        epiData |= MAP_GPIOPinRead( GPIO_PORTQ_BASE, PORT_Q_EPI_PINS ) << 20;               // Read the port Q EPI input pins
    //#else
    ////        epiData = HWREG( 0x400D0070 );                                                    // Read the FPGA data from EPI bus
    //        epiData = HWREG( EPI_PORT );                                                    // Read the FPGA data from EPI bus
    //#endif
    //        updateOutputState( GPIO_PORTN_BASE, OUTPUT_EPI0_READ_DONE_PN4, ENABLE_OUTPUT );     // Initialize read ack to true
    //
    //        while( MAP_GPIOPinRead( GPIO_PORTP_BASE, INPUT_EPI0_RTS_INT_PP0 ) );                // Wait for FPGA to indicate data cleared
    //
    //        updateOutputState( GPIO_PORTN_BASE, OUTPUT_EPI0_READ_DONE_PN4, DISABLE_OUTPUT );    // Initialize read ack to true
    //
    //        if( epiData != EPI_DATA_PATTERN[ inx % 2 ] )                                        // If the EPI data doesn't match the expected value
    //            epiData = epiData;                                                              // Breakpoint to check for errors
    //    }
    }

  • Hi Patrick,

      I don't have your board to interface with the FPGA using OUTPUT_EPI0_CTS_PM5 and INPUT_EPI0_RTS_INT_PP0 to handshake. Therefore, I comment out pretty much most of your testEPI() with the below code instead. I test it out on a LaunchPad. I connect EPI0S0 (PH0) and EPI0S1 (PH1) to 3.3V and I can see epiData equal to 0x80000003.  As far as I can see the bit0 and bit1 are correct. Why don't you give a try on your side?

      Please be aware of a major US holiday for the rest of the week and expect delayed response. 

    static void testEPI( void )
    {
        uint32_t inx,
    #ifdef BIT_BANG
                 inputPins,
    #endif
                 epiData;
        int i = 0;
    
        while (1){
    
            for (i=0;i<100;i++);
            epiData = HWREG( EPI_PORT );                                                    // Read the FPGA data from EPI bus
    
        }
    
    
    
    //    for( inx = 0 ; inx < 100 ; inx++ )
    //    {
    //        updateOutputState( GPIO_PORTM_BASE, OUTPUT_EPI0_CTS_PM5, ENABLE_OUTPUT );           // Set read ack to false while reading data
    //
    //        while( ! MAP_GPIOPinRead( GPIO_PORTP_BASE, INPUT_EPI0_RTS_INT_PP0 ) );              // Wait for FPGA to indicate data ready to read
    //
    //        updateOutputState( GPIO_PORTM_BASE, OUTPUT_EPI0_CTS_PM5, DISABLE_OUTPUT );          // Set read ack to false while reading data
    //
    //#ifdef BIT_BANG
    //        epiData = MAP_GPIOPinRead( GPIO_PORTA_BASE, PORT_A_EPI_PINS ) << 2;                 // Read the port A EPI input pins
    //        epiData |= MAP_GPIOPinRead( GPIO_PORTB_BASE, PORT_B_EPI_PINS ) << 25;               // Read the port B EPI input pins
    //        epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTC_BASE, PORT_C_EPI_PINS ) ) >> 20;     // Read the port C EPI input pins
    //        epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTG_BASE, PORT_G_EPI_PINS ) ) >> 20;     // Read the port G EPI input pins
    //        epiData |= MAP_GPIOPinRead( GPIO_PORTH_BASE, PORT_H_EPI_PINS );                     // Read the port H EPI input pins
    //
    //        inputPins = MAP_GPIOPinRead( GPIO_PORTK_BASE, PORT_K_EPI_PINS );                    // Read the port K EPI input pins
    //        epiData |= (inputPins & 0x00000020) << 26;                                          // Mask off bit 5 and load bit into position 31
    //        epiData |= (inputPins & 0x00000080) << 17;                                          // Mask off bit 7 and load bit into position 24
    //        epiData |= (inputPins & 0x00000040) << 19;                                          // Mask off bit 6 and load bit into position 25
    //
    //        inputPins = MAP_GPIOPinRead( GPIO_PORTL_BASE, PORT_L_EPI_PINS );                    // Read the port L EPI input pins
    //        epiData |= (inputPins & 0x0000000F) << 16;                                          // Load bits 0 - 3 into positions 16 - 19
    //        epiData |= (inputPins & 0x00000010) << 22;                                          // Load bit 4 into position 22
    //
    //        epiData |= __rbit( MAP_GPIOPinRead( GPIO_PORTM_BASE, PORT_M_EPI_PINS ) ) >> 16;     // Read the port M EPI input pins
    //        epiData |= MAP_GPIOPinRead( GPIO_PORTP_BASE, PORT_P_EPI_PINS ) << 27;               // Read the port P EPI input pins
    //        epiData |= MAP_GPIOPinRead( GPIO_PORTQ_BASE, PORT_Q_EPI_PINS ) << 20;               // Read the port Q EPI input pins
    //#else
    ////        epiData = HWREG( 0x400D0070 );                                                    // Read the FPGA data from EPI bus
    //        epiData = HWREG( EPI_PORT );                                                    // Read the FPGA data from EPI bus
    //#endif
    //        updateOutputState( GPIO_PORTN_BASE, OUTPUT_EPI0_READ_DONE_PN4, ENABLE_OUTPUT );     // Initialize read ack to true
    //
    //        while( MAP_GPIOPinRead( GPIO_PORTP_BASE, INPUT_EPI0_RTS_INT_PP0 ) );                // Wait for FPGA to indicate data cleared
    //
    //        updateOutputState( GPIO_PORTN_BASE, OUTPUT_EPI0_READ_DONE_PN4, DISABLE_OUTPUT );    // Initialize read ack to true
    //
    //        if( epiData != EPI_DATA_PATTERN[ inx % 2 ] )                                        // If the EPI data doesn't match the expected value
    //            epiData = epiData;                                                              // Breakpoint to check for errors
    //    }
    }

  • With some update. 

    I connect EPI0S31 (PK5) to 0 and EPI0S0 and EPI0S1 to 1. I see epiData= 0x00000003.