cancel
Showing results for 
Search instead for 
Did you mean: 

Foreground interrupts are hanged for sometime (more than 800 milli seconds)while erasing the bank2 with "(HAL_FLASHEx_Erase_IT(&eraseInitStruct) != HAL_OK)" function call in STM32H743.

RKall.1
Associate II

if we test with ( HAL_FLASHEx_Erase(&eraseInitStruct, &SECTORError) != HAL_OK) function there is no impact on foreground interrupts. But per design notes of dual bank concepts there should not be any hang/impact on first bank operation when we erase/program the bank 2.

is it a limitation of STM32H743 device?. or am i missing something.

i referred application note AN4826 as its a similar concept. and there it claiming the full functionality as expected but the reflection on STM32H743 is different, why?

0693W00000HoGDTQA3.png 

5 REPLIES 5
TDK
Guru

Both HAL_FLASHEx_Erase and HAL_FLASHEx_Erase_IT call the same underlying functions to erase the flash. The former just has extra code to wait until it's complete and the latter to enable interrupts. Are you sure there isn't something else that could explain it in your code?

https://github.com/STMicroelectronics/STM32CubeH7/blob/ccb11556044540590ca6e45056e6b65cdca2deb2/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash_ex.c#L178

https://github.com/STMicroelectronics/STM32CubeH7/blob/ccb11556044540590ca6e45056e6b65cdca2deb2/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash_ex.c#L295

If you feel a post has answered your question, please click "Accept as Solution".

Thanks you for very quick reply.

I have been talking to the ST tech support person on the same toping via emails. please find the details in more explanatory manner .

1) We are not using any RTOS.

2) Errata statement wont applicable for me as I am using version V.

Coming to my application sequence :

1) Timer8 triggers(TRGO) ADC SOC, ADC EOC triggers DMA interrupt. This sequence repeats with 80 K Hz Rate. For debug purpose we toggle GPIO in DMA ISR. 

2) We always try to erase and program bank2 and then swap.

3) We start unlock (HAL_FLASH_Unlock()) and perform sector erase(HAL_FLASHEx_Erase_IT(&eraseInitStruct) != HAL_OK) on bank2.

4) Interrupts halted for some time(see the screen short attached with and with out interrupt function call)

5) Interrupt priority for DMA2 is set higher than the flash.(means lower number for DMA2, PRIORITY_GROUP4, no sub priority)

6)BOOT0 pin grounded with 1k resistor, core running at 400 M Hz.

I have placed one GPIO (channel 2: blue in foreground / high speed interrupt(dma2 interrupt), and other GPIO in my application layer where it triggers the flash erase interrupt API ( Channel 3: pink ).

We are updating the bank 2 with 2 sectors erase configuration (file size is 200K bytes)

1) With HAL_FLASHEx_Erase_IT function( (HAL_FLASHEx_Erase_IT(&eraseInitStruct) != HAL_OK) ) my foreground/high speed interrupt is blocking (see attachment)0693W00000HoIA2QAN.png 

2) With ( HAL_FLASHEx_Erase(&eraseInitStruct, &SECTORError) != HAL_OK){) my foreground/high speed interrupt is not blocking (see attachment)

0693W00000HoIA7QAN.png 

please let me know if you still need me to post the code here(takes small amount of time as the Firmware upgrade algorithm is embedded in it , need to identify an d share the code.

Thanks in advance

TDK
Guru

Not real sure. That definitely shows the issue.

If your code tries to access bank 2 during that time, it'll block. In the non-blocking function, your code definitely doesn't access bank 2 as it just waits on the flag. As a test, I would call HAL_FLASHEx_Erase_IT and then go into an infinite loop and see if you still see blocking behavior. If not, that means the issue is likely in your code somewhere.

You could also disable some of the interrupts being set by HAL_FLASHEx_Erase_IT. If you disabled them all, the code should certainly not block as then it's effectively the same as HAL_FLASHEx_Erase. Might be a good sanity check. Might be good to know which flag exactly is causing it, if any.

https://github.com/STMicroelectronics/STM32CubeH7/blob/ccb11556044540590ca6e45056e6b65cdca2deb2/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash_ex.c#L343

If you feel a post has answered your question, please click "Accept as Solution".
RKall.1
Associate II

HI i am very sorry for not posting the details as asked to close this issue. I was struck with unexpected work on priority.

The base conclusion i got: Yes as you said we are accessing the Flash while erasing to know the Bank 2 firmware version. After blocking this snip code, there is no breakage in the foreground interrupt frequency..

I would like to test the all the cases and post the more relavent information with waveforms, needed a small amout of time hopefully by 20th of January.

Thanks for you graet support. If there is something like "close this issue/talk" on priority please consider it as "closed".

@RKall.1​ there is a "select as best answer" button you can click if you want to close the talk

we dont need to firmware by ourselves, lets talk