Skip to main content
Visitor II
September 23, 2024
Question

Access to DDR in M4

  • September 23, 2024
  • 2 replies
  • 2042 views

Deaers,

I'm using stm32mp151fad and would like to transfter sram data to ddr in M4 side. I refer to the logic analyzer example https://github.com/STMicroelectronics/logicanalyser. The sram data could be copied into ddr immediately.  

 

// mask and transfer first SRAM buff
 
        uint32_t * pSource = (uint32_t *)&mSampBuff[0];
        uint32_t * pDest = (uint32_t *)(mArrayDdrBuff[mArrayDdrBuffIndex].physAddr+mRollingCompSampCount);
        // we have a buffer of mSramPacketSize/2 bytes, to send by packet of 4 => loop on mSramPacketSize/8
        for (int i=0; i<mSramPacketSize/8; i++) {
        *(pDest+i) = *(pSource+i) & 0x7F7F7F7F; // 76µs to perform this operation, a memcpy takes 104µs
        }
 
But when I tried it, the program will go to crash. The destination address is 0xf7841000.
 
Here is my etzpc configuration in tf-a. and I use spmin instead of optee.
DECPROT(STM32MP1_ETZPC_DDRCTRL_ID, DECPROT_NS_R_S_W, DECPROT_LOCK)
DECPROT(STM32MP1_ETZPC_DDRPHYC_ID, DECPROT_NS_R_S_W, DECPROT_LOCK)

Do you have any thoughts about its root cause?

    This topic has been closed for replies.

    2 replies

    Visitor II
    September 28, 2024

    I use 1GB DDR. And I find it's strange that M4 could write/read DDR address 0xd0000000, but 0xf7841000 still can't. Do I misconfigure anything? The DDR size is already to set to 1GB in device tree.

    ST Employee
    October 4, 2024

    Hi @fantasylsdo,

     

    About the DDR configuration, I would like to point out the following wiki article: https://wiki.st.com/stm32mpu/wiki/How_to_configure_a_256MB_DDR_mapping_from_STM32_MPU_Distribution_Package.

    It might be useful to cross-check if you configure correctly for 1GB DDR.

     

    Hope this information helps.

     

    Regards,

    JC.

    Visitor II
    October 6, 2024

    Hello Christphone,

    Thanks for your kind reply. I checked the dts. The memory size is 1GB.

    memory@c0000000 {
    device_type = "memory";
    reg = <0xC0000000 0x40000000>;
    };

     

    And here is the output of /proc/iomem.

    c0000000-cfffffff : System RAM
    c0008000-c0ffffff : Kernel code
    c1100000-c125dd3f : Kernel data
    d3200000-fffffffe : System RAM

    Do I mis-configure other things?

     

    Regards,

    fantasylsdo