Skip to main content
Graduate II
March 16, 2024
Question

STM32H745-Disco: How to allocate the peripherals for a core (CM4 or CM7) in an *empty project*?

  • March 16, 2024
  • 1 reply
  • 798 views

Hi all,

Reading page 400 of RM0399 (Reference manual STM32H745/755 and STM32H747/757). It talks about how to allocate peripherals for each core. But I don't understand. I can't seem to find the PERxEN bit in either RCC_DnxxxxENR or RCC_C1_DnxxxxENR registers.

How do I allocate the green and red LEDs (pins) of this board to CM4? or green to CM4 and red to CM7?

Here is the port pin initialization code I have and some #defines. Thanks:

#define RED_LED_PORT	GPIOI		//PI13 = LD2 = Red LED 0=on
#define RED_LED_PIN	GPIO_PIN_13

#define GREEN_LED_PORT	GPIOJ		//PJ2 = LD1 = Green LED 0=on
#define GREEN_LED_PIN	GPIO_PIN_2


__HAL_RCC_GPIOI_CLK_ENABLE();
__HAL_RCC_GPIOJ_CLK_ENABLE();

//Configure GPIO pin Output Level for Red LED. GPIO_PIN_SET = 1 = off
HAL_GPIO_WritePin(RED_LED_PORT, RED_LED_PIN, GPIO_PIN_SET);

//Configure GPIO pin Output Level for Green LED. GPIO_PIN_SET = 1 = off
HAL_GPIO_WritePin(GREEN_LED_PORT, GREEN_LED_PIN, GPIO_PIN_SET);

//Configure and init. GPIO pin
GPIO_InitStruct.Pin = RED_LED_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(RED_LED_PORT, &GPIO_InitStruct);

//Configure and init. GPIO pin
GPIO_InitStruct.Pin = GREEN_LED_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GREEN_LED_PORT, &GPIO_InitStruct);
    This topic has been closed for replies.

    1 reply

    Super User
    March 16, 2024

    Unless you are putting cores to sleep, the allocation mechanism here doesn't matter. Once they are initialized (by either core), either core can access them and toggle the led, etc.

    The allocation comes into play if, say, you are putting CPU2 to sleep but still want the peripheral active for use by CPU1. In that event, you would activate it using CPU1 using the RCC_C1_AHB4ENR register or by putting the default initialization code in CPU1 startup.