Skip to main content
mzenn.280
Associate II
June 12, 2023
Solved

how to access rpmb partition with HAL_MMC_xx functions

  • June 12, 2023
  • 4 replies
  • 1621 views

I am using STM32H735AGI6 on a custom board with an KLM8G1GETF eMMC

I am reading JEDEC Standard No. 84-B451

I want to start reading counter: std says "The counter read sequence is initiated by Write Multiple Block command, CMD25. Prior to CMD25, the block count is set to 1 by CMD23"

Prob 1: There is only 1 block to write but in HAL_MMC_WriteBlocks_DMA I find

if (NumberOfBlocks > 1U)

{

hmmc->Context = (MMC_CONTEXT_WRITE_MULTIPLE_BLOCK | MMC_CONTEXT_DMA);

/* Write Multi Block command */

errorstate = SDMMC_CmdWriteMultiBlock(hmmc->Instance, add);

}

else

{

hmmc->Context = (MMC_CONTEXT_WRITE_SINGLE_BLOCK | MMC_CONTEXT_DMA);

/* Write Single Block command */

errorstate = SDMMC_CmdWriteSingleBlock(hmmc->Instance, add);

}

so it will send "write single block"

Prob 2: As you can see, before SDMMC_CmdWriteMultiBlock, it does not send CMD23.

Moreover, if you search for SDMMC_CMD_SET_BLOCK_COUNT (aka CMD23), you find only the #define

Can you help me?

This topic has been closed for replies.
Best answer by mzenn.280

to whom it may concern:

 

First of all, you must add a function that implements cmd23

Next you must implement  read/write functions that mimics HAL_MMC_ReadBlocks_DMA and HAL_MMC_WriteBlocks_DMA but they:

1) always use multiple block commands

2) do not send cmd12 (stop command), you must modify HAL_MMC_IRQHandler

Now you can do all the operations on rpmb

4 replies

Tesla DeLorean
Guru
June 12, 2023

Add the function / code needed to communicate the expected length, makes parts like those from SanDisk faster.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
mzenn.280
mzenn.280Author
Associate II
June 12, 2023

I don't understand

I should call HAL_MMC_WriteBlocks_DMA(mmc, my_read_counter_command,0,1), but:

1) the func will use CMD24, not CMD25

2) CMD23 is never used

Can you point me to examples using CMD23?

mzenn.280
mzenn.280Author
Associate II
June 26, 2023

no help?

mzenn.280
mzenn.280AuthorBest answer
Associate II
July 10, 2023

to whom it may concern:

 

First of all, you must add a function that implements cmd23

Next you must implement  read/write functions that mimics HAL_MMC_ReadBlocks_DMA and HAL_MMC_WriteBlocks_DMA but they:

1) always use multiple block commands

2) do not send cmd12 (stop command), you must modify HAL_MMC_IRQHandler

Now you can do all the operations on rpmb