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.

TMS320F28377D: EMIF 8 bit asynchronous memory read and write

Part Number: TMS320F28377D


Hi,

I am trying to read and write data to 8 bit SRAM (AS6C4008A - 512K X 8 BIT LOW POWER CMOS SRAM) using F28377D processor. I have made the hardware connections as below

F2837xD EMIF1Pins SRAM
GPIO93 EM1BA0 A0
GPIO92 EM1BA1 A1
GPIO38 EM1A0 A2
GPIO39 EM1A1 A3
GPIO40 EM1A2 A4
GPIO41 EM1A3 A5
GPIO44 EM1A4 A6
GPIO45 EM1A5 A7
GPIO46 EM1A6 A8
GPIO47 EM1A7 A9
GPIO48 EM1A8 A10
GPIO49 EM1A9 A11
GPIO50 EM1A10 A12
GPIO51 EM1A11 A13
GPIO52 EM1A12 A14
GPIO86 EM1A13 A15
GPIO85 EM1D0 DQ0
GPIO83 EM1D1 DQ1
GPIO82 EM1D2 DQ2
GPIO81 EM1D3 DQ3
GPIO80 EM1D4 DQ4
GPIO79 EM1D5 DQ5
GPIO78 EM1D6 DQ6
GPIO77 EM1D7 DQ7
GPIO31 /EM1WE WE#
GPIO34 /EM1CS2 CE#
GPIO37 /EM1OE OE#

In the software I am configuring the EMIF1 CS2 as below

/* EMIF1 Configuration function*/
void initEMIF1()
{
Emif1Initialize();
EALLOW;
Emif1ConfigRegs.EMIF1ACCPROT0.all = 0x0;
Emif1ConfigRegs.EMIF1COMMIT.all = 0x1;
Emif1ConfigRegs.EMIF1LOCK.all = 0x1;

/* EMIF clock configuration - SYSCLKOUT/2 */
ClkCfgRegs.PERCLKDIVSEL.bit.EMIF1CLKDIV = 1U;
EDIS;

/* Set extended timeout interrupt mask */
Emif1Regs.INT_MSK_SET.bit.AT_MASK_SET = 1;

/* Set up GPIO pins for EMIF1 Asynchronous memory */
setup_emif1_pinmux_async_16bit(0);

/* EMIF1 CS2 Data bus - 8 bits, Turn around - 3 cycles,
Read hold - 3 cycles, Read strobe - 5 cycles, Read setup - 1 cycles,
Write hold - 2 cycles, Write strobe - 5 cycles, Write setup - 1 cycles,
Extended wait enable - 0U, Strobe mode */
ASync_cs2_config(0, 0, 3, 3, 5, 1, 2, 5, 1, 0U, 1);
}

I am facing an issue when I write and read 16 bit data on odd memory location. For example, if I write 0x1234 to the memory location 0x100001, and read back the data I read 0xZZ34 where ZZ (most significant byte) is junk value. But if I write 0x1234 to the memory location 0x100002 and read back I read 0x1234 properly.

But If I write 32 bit data to the memory location it write in both even and odd memory location. If I read back the 32 bit data at once from the same memory location I will have the proper data. But if I read 16 bit data twice instead of 32 bit data, the data from the odd memory location will have the same problem as mentioned above (Most significant byte is junk value).

I checked the pins EM1BA0 , EM1BA1 along with WE, OE and CS2 and the pin values seems to get generated correctly. I am not sure about the reason of failure of write and read of MSB data at odd memory locations.

Thanks,

Aditya

  • Aditya,

    Look like you the ASIZE is configured as 16bit and not 8bit in the software. Can you please check the same and make the appropriate change in your code.

    Regards,

    Vivek Singh

  • Hi Vivek,

    As I mentioned above I am configuring the CS2 for 8 bit size as below

    ASync_cs2_config(0, 0, 3, 3, 5, 1, 2, 5, 1, 0U, 1);

    You can find the snapshot of CCS highlighting the value of ASIZE for CS2 being set to 0.

    I have highlighted three different variables in CCS in the picture below (highlighted in editor, variables and memory browser)

    1) sram_var1 is 16 bit variable @ 0x100001 (odd memory address) stores the value 0x9A34 instead of 0x1234 which is written.

    2) sram_var2 is 16 bit variable @ 0x100000 (even memory location) stores the value 0x5678 correctly.

    3) sram_var3 is 32 bit variable @ (0x100002 - 0x100003) stores the value 0x9A02DEF1 instead of 0x9ABCDEF1 which is written. Here the data is wrong only in the odd address location (0x100003). 

    Thanks,

    Aditya

  • Hi Vivek,

    One more observation I would like to add is the difference in the value when 16 bit or 32 bit pointer is used to write and read from memory. In the above example, I have 3 variables, two 16 bit variables (0x1234, 0x5678) and one 32 bit variable (0x9ABCDEF1).

    If I try to read all the four memory locations using 16 bit pointer and 32 bit pointer seperately I see different behavior.

    Read the memory starting from 0x100000 using 16 bit pointer 4 times:

    In this case I see the issue in the values at all odd memory locations. Below is the data stored locally after memory read (check also the image for the code and memory window for correlation)

    F2837xD_EMIF_SRAM_B.MemoryCopy6 unsigned int[4] [22136,39476,57073,39426] 0x0000E02C@Data
    [0] unsigned int 0x5678 (Hex) 0x0000E02C@Data is correct data
    [1] unsigned int 0x9A34 (Hex) 0x0000E02D@Data instead of 0x1234
    [2] unsigned int 0xDEF1 (Hex) 0x0000E02E@Data is correct data
    [3] unsigned int 0x9A02 (Hex) 0x0000E02F@Data instead of 0x9ABC

    Read the memory starting from 0x100000 using 32 bit pointer 2 times:

    In this case, I see the issue only in the odd memory location written using 16 bit pointer. And the 32 bit data 0x9ABCDEF1 written using 32 bit pointer is read back correctly as shown below (check also the image for the code and memory window for correlation):

    F2837xD_EMIF_SRAM_B.MemoryCopy7 unsigned long[2] [2595378808,2596069105] 0x0000E024@Data
    [0] unsigned long 0x9AB25678 (Hex) 0x0000E024@Data instead of 0x12345678
    [1] unsigned long 0x9ABCDEF1 (Hex) 0x0000E026@Data is correct data

    So there might be some thing amiss when we are doing write and read using 16 bit pointer.

    Thanks,

    Aditya

  • You may have to scope the address pin (A0) on memory device and see if it's toggling properly for every access (0->1 ->0 ->1). Let me know what you find.

    Regards,

    Vivek Singh
  • Hi Vivek,

    Please find the image captured in the scope for /CS2, address A0 pin, /OE and /WE pins for a write and read sequence for data at odd address for select strobe mode.

    In the scope I can see that write(/WE pin enabled) or read (/OE pin enabled) happens twice with A0 pin being toggling from 0 to 1.

    Thanks,

    Aditya

  • Aditya,

    It appears that you may have poor signal integrity. The waveforms should be square in nature and meet the VIH/VIL requirements of the components. From the looks of it, there may be parasitic capacitance or resistance that is preventing your signals from transitioning cleanly.

    Try slowing down your EMIF and ASYNC timings until you see square waves on the scope and then check the write and read behavior again.

    -Tommy