Skip to main content
UBöke.1
Associate II
February 21, 2023
Question

STM32CubeMX NUCLEO-H755ZI-Q project doesn't work with M4 core

  • February 21, 2023
  • 7 replies
  • 4552 views

Creating an CubeMX project with just a minumum of functionallity (M7 / M4 SysTick) can be started for the M7 but not for the M4 ???

M4 sometimes works, sometimes raises a memory error!

Greatings from Saint Égrève.

This topic has been closed for replies.

7 replies

Technical Moderator
February 21, 2023

Hello @Uwe Böker​ 

Could you please explain how the project doesn't work! If possible, share a screenshot of the memory error so that we could help you! You may need to check the sequence of boot as well. When system initialization is finished, M7 will release M4 by means of HSEM notification and wait until M4 wakes up from stop mode. 

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.Best regards,FBL
UBöke.1
UBöke.1Author
Associate II
February 21, 2023

0693W00000aHIfoQAG.bmpHai, Fxxx :) My name is Uwe, I'm from Germany and I work as a freelancer for INOCEL, Saint Égrève.

The code below was generated directly from the STM32CubeMX for the M4 (remarks removed).

int main(void)

{

__HAL_RCC_HSEM_CLK_ENABLE();

 HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));

 HAL_PWREx_ClearPendingEvent();

 HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, PWR_D2_DOMAIN);

 __HAL_HSEM_CLEAR_FLAG(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));

...

If I set a breakpoint @ EnterStopMode..., and resume it afterwards, it works, but the M7 doesn't run.

If I just flash it and switch the board Off and On again, it also works for both kernels.

Within the IAR and without a breakpoint, I got what can be seen in the attachement.

Regards, YouB

Technical Moderator
February 22, 2023

Hi Uwe and welcome to ST Community :D

When you run the program without a breakpoint, the M4 and M7 cores may not be synchronized properly before entering STOP mode, which could cause issues when resuming normal operation.

Adding synchronization barrier in this case before entering stop mode.

__DSB();

When you switch off and on the board, it gives the system enough time to reset and synchronize the access to shared resources, which could explain why it works for both kernels.

Also, try to increase the stack size in the linker configuration.

Hope this helps!

Firas

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.Best regards,FBL
UBöke.1
UBöke.1Author
Associate II
February 25, 2023

Hai, Firas,

I tried it with different settings (__DSB(); ...) even with a FreeRTOS project... always the same. If I put a breakpoint before entering STOP mode (M4 project), then it works for the M4. The reset works for normal projects, but not for the FreeRTOS project.

For this, the M7 runs and the M4 comes till GPIO_Init and dies...

Technical Moderator
February 28, 2023

Could you please share your configuration? Ioc file may would help to investigate further. Any implementation in you code would help as well to reproduce this issue.

Would you precise the stack size set in the linker configuration? Would you share the Options Bytes config?

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.Best regards,FBL
Technical Moderator
February 28, 2023

Note that, CM4 program will be copied by CM7 program. So, after booting sequence of each core, you can add breakpoint and debug your code. Otherwise, a warning of stack outside the range is fired since the memory is corrupted. After that, the debug fails.

Here is an example to debug both cores. Make sure to enable multicore debugging/shared mode in STLink configuration.

0693W00000aHpVSQA0.pngHope this helps understand the issue!

Firas

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.Best regards,FBL
UBöke.1
UBöke.1Author
Associate II
February 28, 2023

I’ll check that during the day… thank you!

[edit: personal data removed by moderator]

UBöke.1
UBöke.1Author
Associate II
March 9, 2023

Hai, Firas,

dual debug works in the meantime... was a problem with the IAR.

But the project still doesn't run... ???

Technical Moderator
March 9, 2023

Hai @Uwe Böker​, 

Could you explain more your requirements? I didn't catch your point. I've run your project on H745 Nucleo. There may indeed be some differences compared to H755 Nucleo Board.

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.Best regards,FBL