Skip to main content
Associate II
February 29, 2024
Solved

GPIO initialization for STM32F769I-DISCO

  • February 29, 2024
  • 2 replies
  • 1712 views

Hello,
I want to do GPIO initialization for STM32F769I-DISCO
here, i am using those pins in my code:

{GPIO_InitStruct.Pin = EV2_Pin|AF1_Pin|WF5_Pin;

GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
}


EV2_Pin for electrovane AF1_Pin for air-fan
i am connecting the STM32F769i card to relay card and i want to initialize relays to 0 value.
I use this after declaration of pins

{
GPIO_ctrl_relay_AF1(GPIO_OFF);
GPIO_ctrl_relay_EV2(GPIO_OFF);
GPIO_ctrl_relay_WF5(GPIO_OFF);
}


Any Help or suggestion Guys ?

Best answer by mƎALLEm

If I understand well your question, you need to be sure that the relays are off at the startup.

We cannot answer this question for the relays as we don't have your schematics of the circuitry between the GPIOs and the relays but we can answer the question regarding the GPIO pins state.

To unsure that the GPIO pin = 0 at startup:

  1. Enable GPIO RCC clock
  2. Write the pin value to 0 (ODR register).
  3. Configure the pin as output

PS: next time please use </> button to insert your code.

 

2 replies

mƎALLEm
ST Technical Moderator
February 29, 2024

Hello,

The issue is not clear.. Do you have any issue? 

Did you enable RCC GPIO port clock?

You have to provide GPIO_ctrl_relay_AF1(GPIO_OFF) function content.

Which pin you are using? EV2_Pin, AF1_Pin, WF5_Pin correspond to which GPIO pins?

You need also to provide schematics later if requested!

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Associate II
March 1, 2024
The question here is if my code true to initialize led relay to start not allumated or not ??
-- yes i enabled RCC GPIO port clock you find it here:
{ /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOE_CLK_ENABLE();
  __HAL_RCC_GPIOG_CLK_ENABLE();
  __HAL_RCC_GPIOB_CLK_ENABLE();
  __HAL_RCC_GPIOD_CLK_ENABLE();
  __HAL_RCC_GPIOC_CLK_ENABLE();
  __HAL_RCC_GPIOA_CLK_ENABLE();
  __HAL_RCC_GPIOJ_CLK_ENABLE();
  __HAL_RCC_GPIOI_CLK_ENABLE();
  __HAL_RCC_GPIOF_CLK_ENABLE();
  __HAL_RCC_GPIOH_CLK_ENABLE();
}
 
//*
/*ON OFF redefinition*/
#define GPIO_ON GPIO_PIN_RESET
#define GPIO_OFF GPIO_PIN_SET
 
void GPIO_ctrl_relay_AF1(uint16_t OnOff){
GPIO_flag_set( AF1_GPIO_Port,  AF1_Pin,  OnOff, &uiPrevPinState_AF1);
}
//*
//*
void GPIO_ctrl_relay_EV2(uint16_t OnOff){
GPIO_flag_set( EV2_GPIO_Port,  EV2_Pin,  OnOff, &uiPrevPinState_EV2);
//*
 
**for EV2_Pin --> PF7
**for AF1_Pin --> PF6
**for WF5_Pin --> PF10
Associate II
March 1, 2024
The question here is my code here true to initialize led relay to start not allumated
-- yes i enabled RCC GPIO port clock you find it here:
{ /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOE_CLK_ENABLE();
  __HAL_RCC_GPIOG_CLK_ENABLE();
  __HAL_RCC_GPIOB_CLK_ENABLE();
  __HAL_RCC_GPIOD_CLK_ENABLE();
  __HAL_RCC_GPIOC_CLK_ENABLE();
  __HAL_RCC_GPIOA_CLK_ENABLE();
  __HAL_RCC_GPIOJ_CLK_ENABLE();
  __HAL_RCC_GPIOI_CLK_ENABLE();
  __HAL_RCC_GPIOF_CLK_ENABLE();
  __HAL_RCC_GPIOH_CLK_ENABLE();
}
 
//*
/*ON OFF redefinition*/
#define GPIO_ON GPIO_PIN_RESET
#define GPIO_OFF GPIO_PIN_SET
 
void GPIO_ctrl_relay_AF1(uint16_t OnOff){
GPIO_flag_set( AF1_GPIO_Port,  AF1_Pin,  OnOff, &uiPrevPinState_AF1);
}
//*
//*
void GPIO_ctrl_relay_EV2(uint16_t OnOff){
GPIO_flag_set( EV2_GPIO_Port,  EV2_Pin,  OnOff, &uiPrevPinState_EV2);
//*
 
**for EV2_Pin --> PF7
**for AF1_Pin --> PF6
**for WF5_Pin --> PF10
mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
March 1, 2024

If I understand well your question, you need to be sure that the relays are off at the startup.

We cannot answer this question for the relays as we don't have your schematics of the circuitry between the GPIOs and the relays but we can answer the question regarding the GPIO pins state.

To unsure that the GPIO pin = 0 at startup:

  1. Enable GPIO RCC clock
  2. Write the pin value to 0 (ODR register).
  3. Configure the pin as output

PS: next time please use </> button to insert your code.

 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Associate II
March 1, 2024

Thanks,
I appreciate that :smiling_face_with_smiling_eyes: