cancel
Showing results for 
Search instead for 
Did you mean: 

how to access rpmb partition with HAL_MMC_xx functions

mzenn.280
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions
mzenn.280
Associate II

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

View solution in original post

4 REPLIES 4

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
Up vote any posts that you find helpful, it shows what's working..
mzenn.280
Associate II

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
Associate II

no help?

mzenn.280
Associate II

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