Skip to main content
Graduate
October 23, 2024
Solved

invalidate D-Cache in stm32h745i-disco

  • October 23, 2024
  • 2 replies
  • 4803 views

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.

 

    This topic has been closed for replies.
    Best answer by mƎALLEm

    Hello,



    This is why users need to read the documentation before starting a development especially for complex products such as H7 dual core line:

    In red is what you configured and in green is what you need to configure for this board. You can notice that the external HW is not the same. So the software needs to follow the hardware configuration:

    SofLit_0-1729764833673.png

    And also to refer to the Hardware getting started and board's schematics and User manual of it.

    This is what is provided in the user manual of the board:

    SofLit_1-1729765218246.png

    And also at least to refer to the Cube examples and how they were implemented especially for ST boards.

     

     

    2 replies

    Technical Moderator
    October 23, 2024

    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.

     

    Graduate
    October 23, 2024

    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.

     

     

    Technical Moderator
    October 23, 2024

    @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

    Graduate II
    October 23, 2024

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

    Graduate
    October 23, 2024

    sorry I did not understand

    Technical Moderator
    October 23, 2024

    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

    Technical Moderator
    October 23, 2024

    It was a spam.. hope you didn't click on the click he shared!

    Graduate
    October 23, 2024

    Thanks SofLit for the help, unfortunately I think I will not be able to make the board work again, since I have done the steps several times. I hope it can help someone else.

    For the moment I just have to be more careful with the power supply I choose for the RCC and just to be sure I ask you: any power supply that says SMPS is valid?
    I mean, won't it give me problems at least like this one?
    because by default this “PWR_DIRECT_SMPS_SUPPLY” but I happened that sometimes I do not have that option and also this SMPS options from 1V8 to 2V5 and I want to be sure that it will not damage anything to test with any. I know now that neither PWR_external nor PWR_LDO to use.

     

    mƎALLEmAnswer
    Technical Moderator
    October 24, 2024

    Hello,



    This is why users need to read the documentation before starting a development especially for complex products such as H7 dual core line:

    In red is what you configured and in green is what you need to configure for this board. You can notice that the external HW is not the same. So the software needs to follow the hardware configuration:

    SofLit_0-1729764833673.png

    And also to refer to the Hardware getting started and board's schematics and User manual of it.

    This is what is provided in the user manual of the board:

    SofLit_1-1729765218246.png

    And also at least to refer to the Cube examples and how they were implemented especially for ST boards.