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.

MSP432E401Y: MSP432E401Y EPI Bus Initialization Issue

Part Number: MSP432E401Y
Other Parts Discussed in Thread: AB15

Tool/software:

Hello

I am having an issue with the initialization of the EPI bus. The BUS is being configured to access two memory devices.

What I am seeing is on initialization of the EPI bus, I am getting a write enable signal and a chip select active signal which is resulting in unwanted writes to the device.

Yet, there have been no attempts to actually perform a write to the device.

See the diagram Write Enable Pulse (WR_ENn, Pin PN2) 

Chip select CS_1n MRAM.

This is the code for the EPI initialization function, when this is called at startup the above events are triggered, result in an unwanted write to the device.

I am doing something wrong here.

int EPI_TCPIP_init(void)
{

int status = 1;

/* Enable the clock to the GPIO Ports that are required for EPI */

MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);

/* EPI Pin assignments as per the HW/SW ICD */

MAP_GPIOPinConfigure(GPIO_PH0_EPI0S0);
MAP_GPIOPinConfigure(GPIO_PH1_EPI0S1);
MAP_GPIOPinConfigure(GPIO_PH2_EPI0S2);
MAP_GPIOPinConfigure(GPIO_PH3_EPI0S3);

MAP_GPIOPinConfigure(GPIO_PC7_EPI0S4);
MAP_GPIOPinConfigure(GPIO_PC6_EPI0S5);
MAP_GPIOPinConfigure(GPIO_PC5_EPI0S6);
MAP_GPIOPinConfigure(GPIO_PC4_EPI0S7);

MAP_GPIOPinConfigure(GPIO_PA6_EPI0S8);
MAP_GPIOPinConfigure(GPIO_PA7_EPI0S9);

MAP_GPIOPinConfigure(GPIO_PG1_EPI0S10);
MAP_GPIOPinConfigure(GPIO_PG0_EPI0S11);

MAP_GPIOPinConfigure(GPIO_PM3_EPI0S12);
MAP_GPIOPinConfigure(GPIO_PM2_EPI0S13);
MAP_GPIOPinConfigure(GPIO_PM1_EPI0S14);
MAP_GPIOPinConfigure(GPIO_PM0_EPI0S15);

MAP_GPIOPinConfigure(GPIO_PL0_EPI0S16);
MAP_GPIOPinConfigure(GPIO_PL1_EPI0S17);
MAP_GPIOPinConfigure(GPIO_PL2_EPI0S18);
MAP_GPIOPinConfigure(GPIO_PL3_EPI0S19);

MAP_GPIOPinConfigure(GPIO_PQ0_EPI0S20); // PLD Memory AB15
MAP_GPIOPinConfigure(GPIO_PQ1_EPI0S21); // PLD Memory AB16
MAP_GPIOPinConfigure(GPIO_PQ2_EPI0S22); // PLD Memory AB17
MAP_GPIOPinConfigure(GPIO_PQ3_EPI0S23); // PLD Memory AB18

MAP_GPIOPinConfigure(GPIO_PK7_EPI0S24); // EPI_BSEL0n
MAP_GPIOPinConfigure(GPIO_PK6_EPI0S25); // EPI_BSEL1n

MAP_GPIOPinConfigure(GPIO_PL4_EPI0S26); // EPI_CS0n (FPGA). mapped to address range 0x60000000
MAP_GPIOPinConfigure(GPIO_PB2_EPI0S27); // EPI_CS1n (MRAM). mapped to address range 0x

MAP_GPIOPinConfigure(GPIO_PB3_EPI0S28); // EPI_RDn

MAP_GPIOPinConfigure(GPIO_PN2_EPI0S29); // EPI_WRn

MAP_GPIOPinConfigure(GPIO_PN3_EPI0S30); // EPI_ALE

// the following signals are routed to the PLD nut not planned to be used
MAP_GPIOPinConfigure(GPIO_PK5_EPI0S31); // EPI_CLK*
MAP_GPIOPinConfigure(GPIO_PK4_EPI0S32); // EPI_iRDY*
MAP_GPIOPinConfigure(GPIO_PL5_EPI0S33); // EPI_CS3*
MAP_GPIOPinConfigure(GPIO_PN4_EPI0S34); // EPI_CS2*
MAP_GPIOPinConfigure(GPIO_PN5_EPI0S35); // EPI_CRE*


MAP_GPIOPinTypeEPI(GPIO_PORTA_BASE, (GPIO_PIN_7 | GPIO_PIN_6));

MAP_GPIOPinTypeEPI(GPIO_PORTB_BASE, (GPIO_PIN_3 | GPIO_PIN_2 ));


MAP_GPIOPinTypeEPI(GPIO_PORTC_BASE, (GPIO_PIN_7 | GPIO_PIN_6 | GPIO_PIN_5 | GPIO_PIN_4));

MAP_GPIOPinTypeEPI(GPIO_PORTG_BASE, (GPIO_PIN_1 | GPIO_PIN_0));

MAP_GPIOPinTypeEPI(GPIO_PORTH_BASE, (GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0));

MAP_GPIOPinTypeEPI(GPIO_PORTK_BASE, (GPIO_PIN_7 | GPIO_PIN_6 | GPIO_PIN_5 | GPIO_PIN_4));

MAP_GPIOPinTypeEPI(GPIO_PORTL_BASE, (GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0));

MAP_GPIOPinTypeEPI(GPIO_PORTM_BASE, (GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0));

MAP_GPIOPinTypeEPI(GPIO_PORTN_BASE, (GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2));


/* Enable the clock to the EPI and wait for it to be ready */
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_EPI0);
while(!(MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_EPI0)))
{
}

/* Configure the EPI to access the MRAM memory at 120 MHz Set the EPI clock to the system clock for MRAM (120MHz),
* and one quarter of the system clock for FPGA(30Mhz) */
EPIDividerSet(EPI0_BASE, 3);
// EPIDividerSet(EPI0_BASE, 0x00030003); // slower clock 30Mhz, still corruption

// Host-bus 16-bit interface
EPIModeSet(EPI0_BASE, EPI_MODE_HB16);

// HB16 settings as per ICD to allow for individual configurations
// of PLD Memory (CS0) and MRAM (CS1)
EPIConfigHB16Set(EPI0_BASE,
(EPI_HB16_MODE_ADMUX |
EPI_HB16_IN_READY_EN |
EPI_HB16_BSEL |
EPI_HB16_CSCFG_ALE_DUAL_CS |
EPI_HB16_CSBAUD),
8); //PF was 0

// Configuration for CS0, FPGA interface, refer to the ICD, FPGA Works
EPIConfigHB16CSSet(EPI0_BASE, 0,
(EPI_HB16_MODE_ADMUX |
EPI_HB16_WRWAIT_0 |
EPI_HB16_RDWAIT_0 |
EPI_HB16_ALE_HIGH));

// Configuration for CS1, MRAM interface, refer to the ICD
EPIConfigHB16CSSet(EPI0_BASE, 1,
(EPI_HB16_MODE_ADMUX |
EPI_HB16_WRWAIT_1 |
EPI_HB16_RDWAIT_1 |
EPI_HB16_ALE_HIGH));


EPIAddressMapSet(EPI0_BASE, ((EPI_ADDR_RAM_BASE_6 | EPI_ADDR_RAM_SIZE_16MB) | (EPI_ADDR_PER_BASE_A | EPI_ADDR_PER_SIZE_16MB)));

/*** adjust the MRAM wait states, reduce both read and write by 1 wait state ****/
//EPIConfigHB16TimingSet(EPI0_BASE, 1, (EPI_HB16_RDWAIT_MINUS_ENABLE | EPI_HB16_WRWAIT_MINUS_ENABLE));
//EPIConfigHB16TimingSet(EPI0_BASE, 1, EPI_HB16_RDWAIT_MINUS_ENABLE);
//EPIConfigHB16TimingSet(EPI0_BASE, 1, EPI_HB16_WRWAIT_MINUS_ENABLE);

/* Wait for the wake-up to complete by polling the
* initialization sequence bit. This bit is true when the SDRAM interface
* is going through the initialization and false when the SDRAM interface
* it is not in a wake-up period. */

while(EPI0->STAT & EPI_STAT_INITSEQ)
{
}

return(status);

}

Thanks In Advance.

Perry

  • Hi Perry,

      I'm not sure why CS and WRn become active after initialization. Can you single step through the code to find out which line of code during initialization caused the WRn and CS to go low and then high again?

  • Hi Charles

    I stepped thru the code, so when the function EPIModeSet() is called, the WRn and CS lines go low (active), as well as the address lines on the EPI bus.

    When EPIConfigHB16Set() function is called, the WRn and CS lines go high (inactive state).

    This is what is creating the problem.  To the MRAM device is looks like a write to address zero.

    Is there no way to configure the default state of the control lines?

    Can you also confirm that the EPI address lines will always be zero after a call to EPIModeSet() ?

    If we can confirm this and we just do not use address zero on our MRAM device we could get around this issue?

    Code snippet below

    ************************************************************

    // Host-bus 16-bit interface

    // when this function is called WRn and CS are set to low (active state)
    EPIModeSet(EPI0_BASE, EPI_MODE_HB16);

    // HB16 settings as per ICD to allow for individual configurations
    // of PLD Memory (CS0) and MRAM (CS1)

    // when this function is called WRn and CS are set to high (inactive state)
    EPIConfigHB16Set(EPI0_BASE,
    (EPI_HB16_MODE_ADMUX |
    EPI_HB16_IN_READY_EN |
    EPI_HB16_BSEL |
    EPI_HB16_CSCFG_ALE_DUAL_CS |
    EPI_HB16_CSBAUD),
    8); //PF was 0

    *************************************************************

    Thanks In Advance

    Perry

  • Hi Perry,

      Can you try to move the below line after EPIModeSet? I hope that will solve the unwanted active WRn in the beginning. Perhaps, you can set PN2 to high in GPIO mode before EPIModeSet. Let me know if that makes a difference. 

    MAP_GPIOPinConfigure(GPIO_PN2_EPI0S29); // EPI_WRn

  • Hi Charles

    It appears I have been able to resolve the issue by moving initialization of all GPOI Port N pins to after the EPI bus has been configured.

    I moved these lines of code

    //Configure Port N GPIO pins for use by the EPI
    MAP_GPIOPinConfigure(GPIO_PN2_EPI0S29); //WRn
    MAP_GPIOPinConfigure(GPIO_PN3_EPI0S30); //EPI_ALE
    MAP_GPIOPinConfigure(GPIO_PN4_EPI0S34); //CS2n (FPGA), UNUSED
    MAP_GPIOPinConfigure(GPIO_PN5_EPI0S35); //CRE, UNUSED

    //Configure Port N GPIO pins for use by the EPI
    MAP_GPIOPinTypeEPI(GPIO_PORTN_BASE, (GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2));

    to after 

    while(EPI0->STAT & EPI_STAT_INITSEQ){};

    Verified via the analyzer we no longer see the Write Enable (WRn) pin pulse on power reset and MRAM corruption on power resets are no longer an issue.

    Thanks for Assistance.

    Perry