cancel
Showing results for 
Search instead for 
Did you mean: 

invalidate D-Cache in stm32h745i-disco

Maximiliano
Associate III

hello everyone,

I am having a problem with my stm32H745I board testing code for the RTC,RCC and power supply it seems that it stopped working. At first it wouldn't let me upload code until with stmprogrammer I connected by holding reset.

Now I can upload code but it doesn't do anything, not even a simple led which is a test code of mine that was working.

When debugging I find that it stays in this part of the code in loop:

 

/* invalidate D-Cache */
sets = (uint32_t)(CCSIDR_SETS(ccsidr));
do {
ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
do {
SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) |
((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk) );
#if defined ( __CC_ARM )
__schedule_barrier();
#endif
} while (ways-- != 0U);
} while(sets-- != 0U);
__DSB();

SCB->CCR |= (uint32_t)SCB_CCR_DC_Msk; /* enable D-Cache */

__DSB();
__ISB();
#endif
}"

 

I tried to update firmware, load .hex, erase memory with stmprogrammer and nothing.

 

30 REPLIES 30
SofLit
ST Employee

Hello @Maximiliano ,

First please use </> button to share your code. I've already edited your post.

Second, as you are using a stm32h745i-disco board what, is the power supply you set? SMPS or LDO? What Frequency and what VOS level you set?

On this board you need to set SMPS for power configuration and you can't exceed 400MHz of system clock at VOS1.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Use invalidate with caution, it can trash the execution state, writes to stack, etc.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you for your response SofLit.

I was testing the RCC with PWR_LDO_SUPPLY and with PWR_EXTERNAL_SOURCE_SUP (I don't remember after which one it stopped working) but I feed the board by USB STLK. The only thing I am sure is that I did not exceed any MHZ limit because it is very clear in that stm32cubeIDE so as soon as I saw something in red or warning when I wanted to generate the code I modified it. I share with you my code in .zip. 

 

I remember that when I used the LSI it generated a delay in the RTC clock so when I changed the LSE it worked without delays but when I restarted the board it did not keep the time but between tests and tests it did not let me upload any more code until I did all the above mentioned.

 

 

sorry I did not understand


@Maximiliano wrote:

Thank you for your response SofLit.

I was testing the RCC with PWR_LDO_SUPPLY and with PWR_EXTERNAL_SOURCE_SUP (I don't remember after which one it stopped working)


This board is configured in SMPS by hardware, so you can't configure another power supply unless you do a modification on the board.

 

 /*!< Supply configuration update enable */
  HAL_PWREx_ConfigSupply(PWR_DIRECT_SMPS_SUPPLY);

  /* The voltage scaling allows optimizing the power consumption when the device is
     clocked below the maximum system frequency, to update the voltage scaling value
     regarding system frequency refer to product datasheet.  */
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);

 

See the example from github: 

https://github.com/STMicroelectronics/STM32CubeH7/blob/master/Projects/NUCLEO-H745ZI-Q/Examples/GPIO/GPIO_EXTI/CM7/Src/main.c.

If you feel the MCU is broken you can recover the MCU. Please refer to this article: https://community.st.com/t5/stm32-mcus/how-can-i-recover-my-stm32h7-board-after-facing-a-power/ta-p/49579

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I double checked your system clock config and found this power contig:

 

  HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);

 

And this is what I have a doubt about!

Need to set it to SMPS:

 

  HAL_PWREx_ConfigSupply(PWR_DIRECT_SMPS_SUPPLY);

 

But this needs to be set after to recover the MCU: https://community.st.com/t5/stm32-mcus/how-can-i-recover-my-stm32h7-board-after-facing-a-power/ta-p/49579

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Thank you very much SofLit, I am looking for the boot0 pin to perform the procedure and as soon as I can make my LED blink code work I will know that I was able to recover the board and I will see the power supply better.

Sorry SofLit on my board it says reference: MB1381B and the schematic I am using says MB1381 is it the same? according to the schematic I have to jumper R144 is it correct? attached photo

Maximiliano_0-1729695527114.png

Maximiliano_1-1729695543088.png

https://www.st.com/resource/en/schematic_pack/mb1381-h750xb-b01-schematic.pdf

 

Try to solder a wire for Boot0 here and connect it to VDD to enter system memory:

SofLit_0-1729697864414.png

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.