cancel
Showing results for 
Search instead for 
Did you mean: 

Does reading/writing from/to flash require cache operation in STM32H7 ?

Manish Sharma
Associate III

Hi All,

Recently, I was trying to write buffer to flash (BANK1) on STM32H7 and Occasionally, I saw a write failure in my code. Though, when i tried to use SCB_CleanDache opeartions, it worked well.

In my further investigation, I found that write to flash involves cache in AXI path so you need to flush. But, I found that DSB and ISB instructions in the flash's driver does this job where it stalls controller before next instruction (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/CIHGHHIE.html)

I did little more investigation and i changed the FLASH_TIMEOUT_VALUE from 50000 to 100000.

The function call is

"FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE, bank);"

Surprisingly, this works fine all the time. This means to me that small value of timeout is not sufficient enough to let the flash operation complete and flash might be busy doing previous operation which results failure on writing due to"FLASH BUSY".

My question are:

1) Do we require cache operation while reading and writing from/to flash ?

2) Is DSB/ISB instructions not enough to done the job?

3) Is my justification of increasing FLASH_TIMEOUT_VALUE valid ?

Regards,

Manish

0 REPLIES 0