cancel
Showing results for 
Search instead for 
Did you mean: 

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

Rodo
Senior

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);
1 REPLY 1
TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".