cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with two simmilar projects

APlot.1
Associate II

Greetings everyone!

Lately, I have generated two projects for Nucleo-STM32H745ZI EvB.

The first one was generated just for the MCU and for the second one I have chosen the EvB as a reference.

So now I do have two quite simmilar projects where the first one (for the MCU) is working well and looping within while and the second one is falling into Error_Handler after startup.

I am encountering the problem within this part of code:

int main(void)
{
  /* USER CODE BEGIN 1 */
 
  /* USER CODE END 1 */
/* USER CODE BEGIN Boot_Mode_Sequence_0 */
  int32_t timeout;
/* USER CODE END Boot_Mode_Sequence_0 */
 
/* USER CODE BEGIN Boot_Mode_Sequence_1 */
  /* Wait until CPU2 boots and enters in stop mode or timeout*/
  timeout = 0xFFFF;
  while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) != RESET) && (timeout-- > 0));
  if ( timeout < 0 )
  {
  Error_Handler();
  }
/* USER CODE END Boot_Mode_Sequence_1 */
  /* MCU Configuration--------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

So I do not get the RCC PD2 flag within the timeout.

Do anyone know any specific reason why is this happening? I can provide the Cube projects if needed.

Thanks in advance.

4 REPLIES 4
Imen.D
ST Employee

Hello @APlot.1​ ,

I would suggest adding more details to your post in order to more understand the issue you are facing.

Which CubeH7 MCU package version are you using ?

Are you using a particular example within Cube package? Which IDE are you using ?

What is the result that you expect ?

I invite you to check this issue (error appears in the same part of code) that can helps you to debug your application.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Seems to be code that dependent on other things happening.

Is code running on the other core? What is starting the clocks or flagging the state? Nothing in the code shown initiates anything.

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

Greetings!

I have checked the https://github.com/STMicroelectronics/STM32CubeH7/issues/34 issue and it seems that the problem is simmilar to mine.

I have made more blank projects for Keil MDK with the help of STM32CubeMx but result is always the same.

As I looked through the recomended issue it appears that the problem was with the option bytes unchecked.

I have checked this out and I do have all option bytes checked.

So now I know that my problem is due to M4 core do not go to STOP MODE at all and I fall into Error_Handler.

I was able to run the MCU by commenting the

timeout = 0xFFFF;
  while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) == RESET) && (timeout-- > 0));
  if ( timeout < 0 )
  {
		Error_Handler();
  }

Still I do not know why hte M4 core is not working correctly. I have not used it at all within the blanc projects. Also though I am suspecting that this commenting I did is correct (@ALABSTM is recomending to do this here https://github.com/STMicroelectronics/STM32CubeH7/issues/34) I am not totally sure.

Greetings and thanks for your reply.

I am not using any specific code within the example. I just generate blank project within Cube for Keil.

And I go within the Error Handler after while that you can see in the provided code.

I do not use M4 core at all.

Alexander