cancel
Showing results for 
Search instead for 
Did you mean: 

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

Pranoti
Associate II

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.

15 REPLIES 15

Hi Now my USART3 is working fine independently but when i initialize spi1 in that project printf statements and uart dont work why ?


@Pranoti wrote:

Hi Now my USART3 is working fine independently but when i initialize spi1 in that project printf statements and uart dont work why ?


This is a new question. As per your answer now, the USART is working. You need to provide how you did solve that and mark it as solution or mark as solution the post that helped the more or guided to the solution and open a new thread for this new question.

Thank you.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
mƎALLEm
ST Employee

@Pranoti 

This is not the answer to accept:

mALLEm_0-1763026431927.png

Please select the answer that provided you the answer to your issue or at least guided you to solve it. I will unmark that one. Or provide how did you solve the issue and mark it as solution.

Thank you for your cooperation.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I solved it by changing clock configuration required for that. Output required for uart was 64MHz and previously it was different.

Now, you can ask your new question in a separated thread and provide more details in it. the steps you followed etc ..

You can refer to How to write your question to maximize your chances to find a solution

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

The new thread is here:

UART is Working Fine Independently but not working when SPI is initialized

@Pranoti - it's helpful to give a link so that people can follow it...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.