LPC54016 EMC not generate WE signal

cancel
Showing results for 
Search instead for 
Did you mean: 

LPC54016 EMC not generate WE signal

568 Views
vasyapupkin
Contributor I

Hi!

External device connected to EMC as static memory. Use A0-A5, D0-D15, CS0, WE, OE signals.

#define SWITCH_EMC             EMC
#define SWITCH_BASE_ADR        (0x80000000ul)
#define SWITCH_EMC_CLKDIV    (2)
#define WaitWriteEn_Ns        (0)
#define WaitOutEn_Ns        (0)
#define WaitReadNoPage_Ns    (10)
#define WaitReadPage_Ns        (10)
#define WaitWrite_Ns        (10)
#define WaitTurn_Ns            (10)

static emc_basic_config_t emc_cfg = {
        .endian = kEMC_LittleEndian,
        .fbClkSrc = kEMC_IntloopbackEmcclk,
        .emcClkDiv = SWITCH_EMC_CLKDIV
};

static emc_static_chip_config_t switch_static_mem_cfg = {
        .chipIndex = 0,
        .memWidth = kEMC_16BitWidth,         /*!< Memory width. */
        .specailConfig = kEMC_NoSpecials,    /*!< Static configuration,a logical OR of "emc_static_special_config_t". */
        .tWaitWriteEn_Ns = WaitWriteEn_Ns,    /*!< The delay form chip select to write enable in unit of nanosecond. */
        .tWaitOutEn_Ns = WaitOutEn_Ns,        /*!< The delay from chip selcet to output enable in unit of nanosecond. */
        .tWaitReadNoPage_Ns = WaitReadNoPage_Ns,    /*!< In No-page mode, the delay from chip select to read access in unit of nanosecond. */
        .tWaitReadPage_Ns = WaitReadPage_Ns,    /*!< In page mode, the read after the first read wait states in unit of nanosecond. */
        .tWaitWrite_Ns = WaitWrite_Ns,        /*!< The delay from chip select to write access in unit of nanosecond. */
        .tWaitTurn_Ns = WaitTurn_Ns            /*!< The Bus turn-around time in unit of nanosecond. */
};

static inline void
emc_syscon_init(void) {
    /* shift mode disable & burst mode disable */
     SYSCON->EMCSYSCTRL |= SYSCON_EMCSYSCTRL_EMCSC(1) |
             SYSCON_EMCSYSCTRL_EMCBC(1);
}

void
switch_io_init(void) {
    EMC_Init(SWITCH_EMC, &emc_cfg);
    emc_syscon_init();
    EMC_StaticMemInit(SWITCH_EMC, NULL, &switch_static_mem_cfg, 1);
    EMC_Enable(SWITCH_EMC, true);
    SWITCH_PRST(PRST_OFF);
}

Reading from the device is normal.

But when trying to write to the device there is no WE signal, CS signal is set low.

WE pin configured:

    IOCON->PIO[0][15] = ((IOCON->PIO[0][15] &
                          /* Mask bits to zero which are setting */
                          (~(IOCON_PIO_FUNC_MASK | IOCON_PIO_ANAMODE_MASK | IOCON_PIO_DIGIMODE_MASK)))

                         /* Selects pin function.
                          * : PORT015 (pin L4) is configured as EMC_WEN. */
                         | IOCON_PIO_FUNC(PIO015_FUNC_ALT6)

                         /* Enables or disables analog mode.
                          * : Disable analog Mode. */
                         | IOCON_PIO_ANAMODE(PIO015_ANAMODE_DISABLED)

                         /* Select Analog/Digital mode.
                          * : Digital mode. */
                         | IOCON_PIO_DIGIMODE(PIO015_DIGIMODE_DIGITAL));

Checked the line in GPIO mode - it works.

What could be the problem?

Labels (1)
0 Kudos
5 Replies

513 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Vasya,

Regarding your question that the EMC writing signal does not appear, but if you set it as GPIO, the pin can toggle, I have not good idea frankly speaking.

Anyway,Pls check the following items in Debugger.

The IOCON bit in AHB Clock Control register 2 must be set to enable the IOCON clock before writing IOCON->PIO[0][15]  register.

Pls check the IOCON->PIO[0][15]  register in debugger if the FUNC bits are 6, DIGMODE bit is 1.

The EMC bit in AHB Clock Control register 2 must be  set to enable EMC clock.

For the EMC module, pls check the STATICWAITWEN[x] register, it define the delay time from  /CS falling edge to the /WE falling edge.

pls check the STATICWAITWR[x] register, I think the value of STATICWAITWR[x] register must be greater than the value of STATICWAITWEN[x] register.

Hope it can help you

BR

XiangJun Rong

pastedImage_1.png

0 Kudos

513 Views
vasyapupkin
Contributor I

Hi!

Thanks for the answer.

I looked at the timing chart in the datasheets.

It was necessary to set the PB bit in the STATICCONFIG0 register.

Under the description of the register in the UserManual (UM11060) it was not clear)))

0 Kudos

513 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Vasya,

Pls try to set/clear the PB bit, but I do not think it can explain why the /WE is not driven.

BR

XiangJun Rong

0 Kudos

513 Views
vasyapupkin
Contributor I

Hi!

I also do not understand)

But this is exactly the case. Setting the PB bit activates the WE signal.

0 Kudos

513 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Vasya,

Great news, now, I see the PB bit function.

BR

XiangJun Rong

0 Kudos