How to access external PSRAM via FSMC on STM32H753ZI


Weiberg, Bernd
 

Hello,

I ‘am currently working on a project, where an extern device (FPGA) is connected to a STM32H753ZI via a multiplexed FSMC interface.

After some investigation I managed to setup my device tree almost correctly and in also have instantiated the corresponding driver via CONFIG_MEMC=Y.

Now the question is: How do I access the device from my Zephyr application? (Memory mapped).

Here is my fmc device tree section:

 

&fmc {

    status = "okay";

    pinctrl-0 = <&fmc_nl_pb7

                 &fmc_d2_pd0

                 &fmc_d3_pd1

                 &fmc_clk_pd3

                 &fmc_noe_pd4

                 &fmc_nwe_pd5

                 &fmc_nwait_pd6

                 &fmc_ne1_pd7

                 &fmc_d13_pd8

                 &fmc_d14_pd9

                 &fmc_d15_pd10

                 &fmc_a16_pd11

                 &fmc_a17_pd12

                 &fmc_a18_pd13

                 &fmc_d0_pd14

                 &fmc_d1_pd15

                 &fmc_nbl0_pe0

                 &fmc_nbl1_pe1

                 &fmc_a23_pe2

                 &fmc_a19_pe3

                 &fmc_a20_pe4

                 &fmc_a21_pe5

                 &fmc_a22_pe6

                 &fmc_d4_pe7

                 &fmc_d5_pe8

                 &fmc_d6_pe9

                 &fmc_d7_pe10

                 &fmc_d8_pe11

                 &fmc_d9_pe12

                 &fmc_d10_pe13

                 &fmc_d11_pe14

                 &fmc_d12_pe15

                 &fmc_ne3_pg10>;

    pinctrl-names = "default";

   

    sram {

        status = "okay";

        compatible = "st,stm32-fmc-nor-psram";

        #address-cells = <1>;

        #size-cells = <0>;

       

        sram2@2 {

            reg = <0x2>;

            st,control = <STM32_FMC_DATA_ADDRESS_MUX_ENABLE

                          STM32_FMC_MEMORY_TYPE_PSRAM

                          STM32_FMC_NORSRAM_MEM_BUS_WIDTH_16

                          STM32_FMC_BURST_ACCESS_MODE_DISABLE

                          STM32_FMC_WAIT_SIGNAL_POLARITY_LOW

                          STM32_FMC_WAIT_TIMING_BEFORE_WS

                          STM32_FMC_WRITE_OPERATION_ENABLE

                          STM32_FMC_WAIT_SIGNAL_DISABLE

                          STM32_FMC_EXTENDED_MODE_DISABLE

                          STM32_FMC_ASYNCHRONOUS_WAIT_DISABLE

                          STM32_FMC_WRITE_BURST_DISABLE

                          STM32_FMC_CONTINUOUS_CLOCK_SYNC_ONLY

                          STM32_FMC_WRITE_FIFO_DISABLE

                          STM32_FMC_PAGE_SIZE_NONE>;

            st,timing = <3 3 7 1 15 15 STM32_FMC_ACCESS_MODE_D>;

        };

    };

};

 

Cheers!