This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-AM335X: GPMC SRAM configuration

Part Number: PROCESSOR-SDK-AM335X

I'm trying to memory map an SRAM chip which has a 16-bit interface (CY62137FV18) in u-boot. This chip is 128K x 16bits, so it should respond to 128k addresses and stores 16-bits at each location, with a total size of 256kB or 2Mb.

However, when I write/read from certain addresses in uboot, it gives one byte per address. When I try to read from an address, I get one byte, and if I try to read a 16-bit word (for example from 0x10000000), I get the contents of that address and the next one (returns contents of 0x10000000 and 0x10000001). So when I memory map this 16-bit device, I can request only 8 bits per address, meaning I get only half the storage space. That might be fine if the memory map was double the size (stretching from 0x10000000 to 0x10040000), but that is not the case. When I write to 0x10020000, address 0x10000000 gets updated as well, meaning that it ignores bit 17, and that the usable size of the memory is only 0x20000 bytes, or 128kB.

I think that my GPMC registers & hardware are probably fine, but I pasted them below anyway.

#define STATIC_RAM_GPMC_CONFIG1 0x00001200            // 16 bit, address and data multiplexed
#define STATIC_RAM_GPMC_CONFIG2 0x000A0900           // cswroff = A*fclk, csrdoff = 9*fclk
#define STATIC_RAM_GPMC_CONFIG3 0x0020200             //advrdoff = 2*fclk, advwroff = 2*fclk
#define STATIC_RAM_GPMC_CONFIG4 0x0A030903          //oeontime =3*fclk,oeofftime = 9*fclk,weontime = 3*fclk, weofftime = A*fclk
#define STATIC_RAM_GPMC_CONFIG5 0x000D0E0E        //rdcycletime = E*fclk, wrcycletime = e*fclk, rdaccesstime = D*fclk
#define STATIC_RAM_GPMC_CONFIG6 0x0D040000        //wrdataonadmuxbus = 4*fclk, wraccesstime = d*fclk
#define STATIC_RAM_GPMC_CONFIG7 0x0000F50


My uboot device tree is this:

&gpmc {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&nandflash_pins_s0>;
    ranges = <0 0 0x08000000 0x1000000
                    1 0 0x10000000 0x1000000>;
    nand@0,0 {
        /*omitted this stuff, since it's irrelevant*/
    };
    sram@1,0{
        reg = <1 0 0x40000>;
    };
};
With these settings, I can see the mapped memory in CCS and edit the values, but (in the memory viewer) all values repeat after 0x10020000.
What am I missing/doing wrong?

  • Hi Kevin,

    From what I understand, to use 16-bit (2 bytes) you need to have the below connection:

    AM335x SRAM
    gpmc_be0n_cle -> BLEn
    gpmc_be1n -> BHEn

    Make sure you have made the correct pinmux and you have expected and valid signals on gpmc_be0n_cle/gpmc_be1n.

    Also I see you have set GPMC_CONFIG1[9:8] MUXADDDATA = 0x2 (Address and data multiplexed attached device). Can you describe which AM335x GPMC addr/data pins you connect to SRAM addr/data pins? Make sure you are aligned with AM335x TRM:
    Table 7-5. GPMC Pin Multiplexing Options
    Figure 7-3. GPMC to 16-Bit Address/Data-Multiplexed Memory

    Regards,
    Pavel
  • I have BLEn and BHEn both grounded. Shouldn't I be able to read both bytes at once? Or is this not correct?

    Also, I have GPMC AD 16 pins connected through latch (enabled by ADV) to SRAM.
  • Kevin Boldingh said:
    I have BLEn and BHEn both grounded. Shouldn't I be able to read both bytes at once? Or is this not correct?

    For reading 16-bit word, both AM335x GPMC BE0n/BE1n should be low, and thus you should be able to read even addresses: 0x10000000, 0x10000002, 0x10000004, etc

    Kevin Boldingh said:
    Also, I have GPMC AD 16 pins connected through latch (enabled by ADV) to SRAM.

    Do you follow the TRM guidelines? AM335x GPMC_A0 should not be used, GPMC_A1 should be connected to SRAM A16 pin.

    Check also sections:

    7.1.2.3.10.1.1.1 Asynchronous Single-Read Operation on an Address/Data Multiplexed Device

    7.1.2.3.10.1.1.2 Asynchronous Single Read on an Address/Data-Multiplexed Device

    Regards,
    Pavel

  • Check also below e2e threads:

    e2e.ti.com/.../325969
    e2e.ti.com/.../512464

    Regards,
    Pavel
  • Looks like I found the issue. I was pinmuxing gpmc_a1-a3 to gpmc_a17-a19, by setting it to MODE(4). When I set it back to MODE(0), it started working.

    Thanks for the help,
    Kevin