cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 Custom Board: GPIO Toggling, UART, and others not working.

Pranoti
Visitor

Hello,
I am working On Customized Board using STM32H755ZIT6 microcontroller. I have written code using .IOC  functionality in stm32 CubeIDE but that code is not working in Our customized board. 
2)That same code is working In Nucleo H755ZI-Q board and functionality is working.
3)Than I tried to write code without using IOC for gpio toggling that code is working fine.
4)Here is the code that is working 

 
/*
* main.c
*
* Created on: Nov 4, 2025
* Author: PK01
*/

#include "stm32h7xx_hal.h"
#include "main.h"

GPIO_InitTypeDef GPIOD_Init = {};
void gpio_config(void);
void gpio_config1(void);
void delay(uint32_t delayVal);

int main(void){
//HAL_Init();
gpio_config();

//USART3_Config();
gpio_config1();

/*gpio_config2();
gpio_config3();*/

// if(HAL_UART_Transmit(&usart3,(uint8_t*)msg,msgSize,timeDelay)!=HAL_OK){
// ErrorHandler();
// }

while(1){
HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_0);
HAL_GPIO_TogglePin(GPIOE,GPIO_PIN_12);

// HAL_GPIO_TogglePin(GPIOE,GPIO_PIN_8);
// HAL_GPIO_TogglePin(GPIOE,GPIO_PIN_9);

delay(5000000);
}

}



//USART CONFIGURATION



//void USART3_Config(){

// usart3.Instance = USART3;

// usart3.Init.BaudRate = 115200;

// usart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;

// usart3.Init.StopBits = UART_STOPBITS_1;

// usart3.Init.Mode = UART_MODE_TX_RX;

// usart3.Init.Parity = UART_PARITY_NONE;

// usart3.Init.WordLength = UART_WORDLENGTH_8B;

// if(HAL_UART_Init(&usart3)!=HAL_OK){

// ErrorHandler();

// }

//}



void gpio_config(void){

__HAL_RCC_GPIOE_CLK_ENABLE();



GPIO_InitTypeDef GPIOE_Init = {};



GPIOE_Init.Pin = GPIO_PIN_12;

GPIOE_Init.Mode = GPIO_MODE_OUTPUT_PP;



HAL_GPIO_Init(GPIOE,&GPIOE_Init);

}



void gpio_config1(void){

__HAL_RCC_GPIOA_CLK_ENABLE();



GPIO_InitTypeDef GPIOA_Init = {};



GPIOA_Init.Pin = GPIO_PIN_0;

GPIOA_Init.Mode = GPIO_MODE_OUTPUT_PP;



HAL_GPIO_Init(GPIOA,&GPIOA_Init);

}



//void gpio_config2(void){

// __HAL_RCC_GPIOE_CLK_ENABLE();

//

// GPIO_InitTypeDef GPIOE1_Init = {};

//

// GPIOE1_Init.Pin = GPIO_PIN_7;

// GPIOE1_Init.Mode = GPIO_MODE_OUTPUT_PP;

//

// HAL_GPIO_Init(GPIOE,&GPIOE1_Init);

//}

//void gpio_config3(void){

// __HAL_RCC_GPIOE_CLK_ENABLE();

//

// GPIO_InitTypeDef GPIOE2_Init = {};

//

// GPIOE2_Init.Pin = GPIO_PIN_9;

// GPIOE2_Init.Mode = GPIO_MODE_OUTPUT_PP;

//

// HAL_GPIO_Init(GPIOE,&GPIOE2_Init);

//}





void ErrorHandler(){

for(int j =0;j<100;j++){

HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_0);

HAL_Delay(500);

}

}

void gpio_config(void){

__HAL_RCC_GPIOD_CLK_ENABLE();



GPIO_InitTypeDef GPIOD_Init = {};



GPIOD_Init.Pin = GPIO_PIN_8;

GPIOD_Init.Mode = GPIO_MODE_OUTPUT_PP;



HAL_GPIO_Init(GPIOD,&GPIOD_Init);

}

void delay(uint32_t delayVal){

uint32_t i;

for(i=0;i<delayVal;i++){



}

}



4)But the same code that i am generating using IOC is not working its stuck in this error handling while loop

 
while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) == RESET) && (timeout-- > 0));
if ( timeout < 0 )
{
  Error_Handler();
}



when i do comment this for only gpio toggling genrated using ioc than that gpio toggling is working fine.
5)but for uart and other functionalities after commenting that code of error handling its still doesnt work.

Below is the schematic screenshot

Pranoti_1-1762857427272.png


Edited to apply source code formatting - please see How to insert source code for future reference.

3 REPLIES 3
denko
Visitor

1. Why do you have HAL_Init(); commented out?
2. The NUCLEO-H755ZI-Q board does not have an external HSE crystal connected, but your custom board does. Are you configuring the clocks properly for your board?
3. Do you have the same SMPS section layout, and have you set the HAL_PWREx_ConfigSupply(uint32_t SupplySource); configuration appropriately for your board?

 

1) That Code Snippet is working in customized board I have initialized all things manually. Problem is that if same code is generated in Ioc than its not working.
2)Yes we just given the provision for it on board but that component are not mounted on that board.
3)

Pranoti_0-1762863086782.png

Yes I think its same as nucleo Board Please check above part of smps power supply. 

And Please let me know why there is free in pin context Assignment as i am using cortex m7 it should be cortex m7 right?If no how to change to cortex m7 or this is the reason of not working the code?

Pranoti_1-1762863301508.png

these are pins of oscillator.