Skip to main content
HBRUS.1
Associate
November 10, 2021
Solved

Hi, Please. STM32F405RG - REV 2 The same code of HAL_FLASH_Program works well in main function and not in interrupt subroutine ? Best regards. Henri

..

This topic has been closed for replies.
HBRUS.1
HBRUS.1Best answer
Associate
November 15, 2021

Hello,

Finally, in the form NVIC, I checked "Flash global interrupt" with priority "0" and I called the function "HAL_FLASH_Program_IT" instead of "HAL_FLASH_Program". Nothing else.

Best regards.

Henri

5 replies

Mike_ST
ST Technical Moderator
November 10, 2021

Hello,

maybe because the Systick cannot increase while your interrupt is executing, because of its priority ?

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
HBRUS.1
HBRUS.1Author
Associate
November 10, 2021

Hello Mike,

Thank you for your attention.

From time to time, I work arround this problem since many days.

Due to your answer, I moved the code from the interrupt sub-routine to the infinite loop "while();" of the file containing the main function. The behavior is the same.

Please, would you have another suggestion ?

For information, the processor runs at 168Mhz.

Precisely, the errors are HAL_FLASH_ERROR_PGP and HAL_FLASH_ERROR_PGS.

Best regards.

Henri

HBRUS.1
HBRUS.1Author
Associate
November 11, 2021

Hello Mike,

You put me on the right track.

With the code in the infinite loop of the main function, without interruption, the writes in the flash are effective.0693W00000GXDoJQAX.jpgLike the image above, increasing the level of preemption of "Time base: System tick timer" has no effect.

So, how to allow Systick to be incremented when other interruptions are active ?

Please, would you have suggestion ?

Best regards.

Henri

HBRUS.1
HBRUS.1Author
Associate
November 15, 2021

Hello,

Help !

In my reply above, there is a mistake.

The NVIC table, preemption priority, is actualy:

0693W00000GXXx6QAH.jpg"Time base : System tick timer" is now at the highest premption priority.

As I could read somewhere, I put the code (mine) of all ISR in RAM (why not), specialy "Time base : System tick timer".

The problem persists.

I can read that I am not the only one facing this difficulty.

It would seem that no one has a solution

Should I give up ?

Best regards.

Henri

HBRUS.1
HBRUS.1AuthorBest answer
Associate
November 15, 2021

Hello,

Finally, in the form NVIC, I checked "Flash global interrupt" with priority "0" and I called the function "HAL_FLASH_Program_IT" instead of "HAL_FLASH_Program". Nothing else.

Best regards.

Henri