cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE 1.4.1 and Nucleo-H745 Dual-Core, configuration fails?

Jack3
Senior II

To learn more about Dual-Core STM32's, I got a Nucleo-H745 board.

I used STM32CubeIDE 1.4.1 to create an initial project for it.

When I checked the Clock Configuration, I see both cores are configured for only 8 MHz, I corrected this manually.

But then LD1, LD2, LD3, and B1 are configured in STM32CubeMX, but it seems no code was generated to initialize them. It enables clocks only:

void MX_GPIO_Init(void)
{
  /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOC_CLK_ENABLE();
  __HAL_RCC_GPIOH_CLK_ENABLE();
  __HAL_RCC_GPIOA_CLK_ENABLE();
  __HAL_RCC_GPIOB_CLK_ENABLE();
  __HAL_RCC_GPIOD_CLK_ENABLE();
  __HAL_RCC_GPIOG_CLK_ENABLE();
}

I added declaration and initialization of the LEDs and button and that works.

Both MCU's work, for sure, CM4 toggles LD1 and LD3 every 500mS, CM7 toggles LD2 and LD3 every second.

But with other Nucleo boards, I saw better results in the generated code.

As expected, there is a CM4 and CM7 directory.

Is there a reason behind this?

Or am I forgetting something important?

Your help is much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

I would not be surprised and wouldn't take that as a bad sign. I'm using the pretty mature Nucleo-STM32F042K6 and, the LED is not initialized :-(. I reported that once, it was once fixed, but now its broken again.

In your case it looks like MX_GPIO_Init does not init the LEDs at all (LD2 is on PE1 which is not clocked) but the other peripheral (AF) pins. This may be because you have not specified which core handles those pins. If you go to the System Core GPIO tab in CubeMX and make a Pin Context Assignment for PE1 to say ARM Cortex-M4, proper init code will be generated.

View solution in original post

2 REPLIES 2
KnarfB
Principal III

I would not be surprised and wouldn't take that as a bad sign. I'm using the pretty mature Nucleo-STM32F042K6 and, the LED is not initialized :-(. I reported that once, it was once fixed, but now its broken again.

In your case it looks like MX_GPIO_Init does not init the LEDs at all (LD2 is on PE1 which is not clocked) but the other peripheral (AF) pins. This may be because you have not specified which core handles those pins. If you go to the System Core GPIO tab in CubeMX and make a Pin Context Assignment for PE1 to say ARM Cortex-M4, proper init code will be generated.

Thank you very much! You are awesome! That actually makes a lot of sense, and difference!

Right-clicking those pins shows an additional menu item "Pin Reservation" with choices "Free", "Cortex-M7", and "Cortex-M4".

I didn't click that sub-menu, as I saw the LED labels already. =)

0693W000003On1IQAS.png

Now I reserved LD1 for MC4, LD2 for MC7, and LD3 Free (uses by both cores).

CM4:

void MX_GPIO_Init(void)
{
  GPIO_InitTypeDef GPIO_InitStruct = {0};
 
  /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOB_CLK_ENABLE();
 
  /*Configure GPIO pin Output Level */
  HAL_GPIO_WritePin(LD1_GPIO_Port, LD1_Pin, GPIO_PIN_RESET);
 
  /*Configure GPIO pin : PtPin */
  GPIO_InitStruct.Pin = LD1_Pin;
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
  HAL_GPIO_Init(LD1_GPIO_Port, &GPIO_InitStruct);
}

CM7:

void MX_GPIO_Init(void)
{
 
  GPIO_InitTypeDef GPIO_InitStruct = {0};
  /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOC_CLK_ENABLE();
  __HAL_RCC_GPIOH_CLK_ENABLE();
  __HAL_RCC_GPIOA_CLK_ENABLE();
  __HAL_RCC_GPIOB_CLK_ENABLE();
  __HAL_RCC_GPIOD_CLK_ENABLE();
  __HAL_RCC_GPIOG_CLK_ENABLE();
  __HAL_RCC_GPIOE_CLK_ENABLE();
 
  /*Configure GPIO pin Output Level */
  HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
 
  /*Configure GPIO pin : PtPin */
  GPIO_InitStruct.Pin = LD2_Pin;
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
  HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct);
}

And good catch, clock for PE1 was indeed not enabled, because the init code for LEDs was left out at all.

I added an LED init function that took care of it, and edited my initial text, to reflect that.

But doing it this way makes more sense.

Again, thank you very much!

I can start discovering ST's dual-core now... =)