cancel
Showing results for 
Search instead for 
Did you mean: 

DMA to eMMC can only talk to SYSRAM but not RAM (SRAM1, SRAM2, SRAM3)

cbcooper
Senior

I've got a custom board with an STM32MP135AAE3 talking to an eMMC (THGBMTG5D1LBAIL if it makes a difference). I've discovered that if I write from SYSTEM to the eMMC using DMA (HAL_MMC_WriteBlocks_DMA) it works fine, but if I use anything in RAM (SRAM1, SRAM2, or SRAM3) as the source, the DMA fails immediately.

If it helps, the SDMMC2 registers inside SDMMC2_IRQHandler() are: STA=0x8001010; DCOUNT=0x200; DCTRL=0x90; IDMACTRL=0x1; MASK=0x11A

Is this a known limitation of the IDMA? If not, is it something I'm somehow initializing incorrectly?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

I think this the root cause as FSBL loaded by BootROM is limited to 128KB on STM32MP13
https://wiki.st.com/stm32mpu/wiki/STM32_MPU_ROM_code_overview#On_STM32MP1-lines_4

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Tip of the day: Try Sidekick STM32 AI agent, see here

View solution in original post

4 REPLIES 4
PatrickF
ST Employee

Hi @cbcooper 

Maybe check that ETZPC configuration for SDMMC2, SYSRAM and SRAMx are consistent.

Check that the right SRAMs addresses are used for SDMMC DMA.

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Tip of the day: Try Sidekick STM32 AI agent, see here

I think you're right about the ETZPC configuration (this is the first time I've programmed an STM32 chip where I had to think about secure vs. non-secure memory).  All I had was this line:

LL_ETZPC_SetSecureSysRamSize(ETZPC, 0);

but if I add these 3 lines;

  HAL_ETZPC_Set_SRAM1_PeriphProtection(ETZPC, LL_ETZPC_PERIPH_PROTECTION_READ_WRITE_NONSECURE);
  HAL_ETZPC_Set_SRAM2_PeriphProtection(ETZPC, LL_ETZPC_PERIPH_PROTECTION_READ_WRITE_NONSECURE);
  HAL_ETZPC_Set_SRAM3_PeriphProtection(ETZPC, LL_ETZPC_PERIPH_PROTECTION_READ_WRITE_NONSECURE);

then STM32_Programmer_CLI.exe hangs when trying to download the application. 

Why would the download hang?  I assumed STM32_Programmer_CLI. would download the application first and succeed at that, and then run the program (which could fail/crash/hang if those lines are wrong) but how can adding those lines affect the download?

Is the BootROM only able to upload into SYSRAM (and not SRAM1/SRAM2/SRAM3)?  Adding those 3 lines increased the payload size from 0x1F57C = 128,380 bytes to 0x20588 = 132,488 bytes.  I have a check in my LD file:

ASSERT(. <= ORIGIN(RAM) + LENGTH(RAM), "RAM overflow: sections exceed available RAM")

where

MEMORY {
    SYSRAM_BASE (rwx)   : ORIGIN = 0x2FFE0000, LENGTH = 128K
    SRAM1_BASE (rwx)    : ORIGIN = 0x30000000, LENGTH = 16K
    SRAM2_BASE (rwx)    : ORIGIN = 0x30004000, LENGTH = 8K
    SRAM3_BASE (rwx)    : ORIGIN = 0x30006000, LENGTH = 8K
    /* InternalMEM = SYSRAM + SRAM1 + SRAM2 + SRAM3 */
    InternalMEM (rwx)   : ORIGIN = 0x2FFE0000, LENGTH = 160K
    DDR_BASE (rwx)      : ORIGIN = 0xC0000000, LENGTH = 128M
}

/* Select Memory in which code has to be placed and offset of code from start of this memory */ 
REGION_ALIAS("RAM", InternalMEM);

but do I instead need to check

ASSERT(. <= ORIGIN(SYSRAM_BASE) + LENGTH(SYSRAM_BASE), "RAM overflow: sections exceed available RAM")

 

 

Hi,

I think this the root cause as FSBL loaded by BootROM is limited to 128KB on STM32MP13
https://wiki.st.com/stm32mpu/wiki/STM32_MPU_ROM_code_overview#On_STM32MP1-lines_4

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Tip of the day: Try Sidekick STM32 AI agent, see here