cancel
Showing results for 
Search instead for 
Did you mean: 

Able to program GPIO_EXTI example but the board doesnt responds

RafaelS
Associate II

Hello,

I am new to STM MCUs and need to test the different peripherals of the STM32H745 to decide if it fits my project. I began with the GPIO_EXTI example, and it worked. Later, I tried to configure a USART for debugging purposes, but it didn’t work. After several days of trying, I reprogrammed the GPIO_EXTI example, but to my surprise, the LEDs no longer toggle when I press the user button.

 

I have tried programming the ELF file using both STM32CubeIDE and STM32CubeProgrammer (after performing a full chip erase). In both cases, the programming process completes without errors.

I have no idea why this is happening. Does anyone have any advice, please?

 

Thank you very much.

PS. I use the STM32H745I-DISCO board

 

 

25 REPLIES 25

Did you change the boot options or not?

SofLit_0-1736330521648.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.
RafaelS
Associate II

Hello!
I have noticed something interesting. While running the bubble algorithm in debug mode, I realized that the CM7 core remains stuck in a while(1) loop due to an error handler.

 

 

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

 

It seems that there is a timeout... it seems that the D2 is not ready for some reason, I am going to take a look in this registers.

I have not changed the boot options.


@RafaelS wrote:

Hello!
I have noticed something interesting. While running the bubble algorithm in debug mode, I realized that the CM7 core remains stuck in a while(1) loop due to an error handler.

 

 

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

It seems that there is a timeout... it seems that the D2 is not ready for some reason, I am going to take a look in this registers.


That's normal, CM7 is wating a wakeup signal from CM4 that you didn't run its program. 

At this stage I suggest to comment these lines:

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

and run again the example.

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.
RafaelS
Associate II

Hello,

the bubble algorithm works in both cores.

 

I have realise that the code

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

 apears twice in main.c of CM7. I've commented out the first piece of code. This way, the second time the code appears, the CM7 doesn't get blocked due to a timeout.

So I did the following test: in the USART2_debug code I attached earlier, I commented out the first occurrence of that code and ran it step by step. When it reaches the line to toggle the LED, the LED turns on! This rules out the possibility that the board is damaged.

 

 


@RafaelS wrote:

Hello,

the bubble algorithm works in both cores.

 

I have realise that the code

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

 apears twice in main.c of CM7.

 


But not the same condition: != RESET for the first and == RESET for the second.

And indeed this confirms my doubts. The board is OK but run the code in debug mode. The debug mode is a bit tricky as CM7 and CM4 are synchronized and CM4 is put in low power mode. 

You need to stop the debug session as I said previously and run the application in a stand alone mode.

Or  if you are not using CM4 simply comment out:

  /* 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();
  }
  

 and

  /*HW semaphore Clock enable*/
  __HAL_RCC_HSEM_CLK_ENABLE();

  /*Take HSEM */
  HAL_HSEM_FastTake(HSEM_ID_0);
  /*Release HSEM in order to notify the CPU2(CM4)*/
  HAL_HSEM_Release(HSEM_ID_0,0);

  /* wait until CPU2 wakes up from stop mode */
  timeout = 0xFFFF;
  while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) == RESET) && (timeout-- > 0));
  if ( timeout < 0 )
  {
    Error_Handler();
  }

This makes your application running as a Single Core MCU configuration.

Hope that helps you.

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.