cancel
Showing results for 
Search instead for 
Did you mean: 

Different application-speed after download

Andreas Fecht
Associate II

Hello,

I'm using a STM32L433CCU3 in my Application with STM32CubeMX.

I'm download my hex-files with the STM32CubeProgrammer in UART serial download mode.

If I start my application directly after download with the "Run after programming"-function of the STM32CubeProgrammer my software runs 30% slower than as a start from a cold-boot.

Is there any reason for this behaviour.

Best regards

Andreas Fecht

3 REPLIES 3

Not starting the clocks properly or making assumptions? Make sure to clear auto/local variables in the routines that configure the clocks. Make sure to explicitly set clocks rather than make assumptions they will be in reset conditions.

To understand the issue print out telemetry and register settings so you can observe the differences.

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

I've not made any changes in the clock section of the STM32CubeMX.

Everything is on default settings.

Ok, and may be that's too sloppy..

Auto/local variables are on the stack, the stack contains random undefined crap.

You're going to have to dig to find the reason. You can start by unpacking the clocking state.

I don't have your code, I don't have your boards.

//****************************************************************************
 
extern const uint32_t MSIRangeTable[];
 
//****************************************************************************
 
uint32_t MSICLOCK(void)  // sourcer32@gmail.com
{
  uint32_t msirange = 0;
  uint32_t cr = RCC->CR;
  uint32_t csr = RCC->CSR;
 
  if (cr & RCC_CR_MSIRGSEL)
    msirange = (csr & RCC_CSR_MSISRANGE) >> RCC_CSR_MSISRANGE_Pos;  /* MSISRANGE from RCC_CSR applies */
  else
    msirange = (cr & RCC_CR_MSIRANGE) >> RCC_CR_MSIRANGE_Pos;       /* MSIRANGE from RCC_CR applies */
 
  /*MSI frequency range in HZ*/
  return(MSIRangeTable[msirange]);
}
 
//***************************************************************************
 
 
  printf("Core=%d, %d MHz\n", SystemCoreClock, SystemCoreClock / 1000000);
  printf("MCLK=%d\n", MSICLOCK());
  printf("HCLK=%d\n", HAL_RCC_GetHCLKFreq());
  printf("APB1=%d\n", HAL_RCC_GetPCLK1Freq());
  printf("APB2=%d\n", HAL_RCC_GetPCLK2Freq());

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