Skip to main content
Visitor II
November 11, 2025
Solved

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

  • November 11, 2025
  • 5 replies
  • 625 views

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.

    This topic has been closed for replies.
    Best answer by Pranoti

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

    5 replies

    Visitor II
    November 11, 2025

    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?

     

    PranotiAuthor
    Visitor II
    November 11, 2025

    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. 

    PranotiAuthor
    Visitor II
    November 11, 2025

    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.

    Technical Moderator
    November 11, 2025

    hello @Pranoti 

    >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?

    -For the oscillator pins, this is the normal behavior of CubeMX when assigning oscillator pins.

     

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

    Regarding your question about the code snippet:
    The code generated by CubeMX  ensure synchronization between the CM7 and CM4 cores at the start of the program. If you do not intend to use the CM4 core, you only need to comment out this line in the generated code by CubeMX

    #define DUAL_CORE_BOOT_SYNC_SEQUENCE

    BR
    Gyessine

    PranotiAuthor
    Visitor II
    November 12, 2025

    Yes, I tried This but still that code is not working in Customized board.

    Super User
    November 12, 2025

    > 4)Here is the code that is working 

    Wouldn't it be more useful to show us the code that isn't working?

    Yes, you will need to assign pins to a core if you want them initialized.

    PranotiAuthor
    Visitor II
    November 12, 2025

    Yes, But problem is not about code it's about general IOC settings that i need to change for my customized board as the same code is working fine for nucleo  H755ZIQ board. I have attached the UART code here that is not working .
    Please le me know what changes i need to do in that so that it will work in customized board.

    Technical Moderator
    November 12, 2025

    @Pranoti wrote:

    3)Than I tried to write code without using IOC for gpio toggling that code is working fine.


    I'm not sure this is true as the code you shared is very simple and I'm pretty sure the SMPS power supply was not configured meaning the MCU was set to be powered with LDO and I have the impression that you've locked the MCU. According to your schematic (blurry image and bad quality), I can conclude the hardware is configured in SMPS:

    mALLEm_0-1762939278428.png

    So please review this knowledge base: How can I recover my STM32H7/STM32H7RS board after facing a power configuration deadlock?

    PranotiAuthor
    Visitor II
    November 13, 2025

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

    Technical Moderator
    November 13, 2025

    @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.

    Technical Moderator
    November 13, 2025

    @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.

    PranotiAuthorAnswer
    Visitor II
    November 13, 2025

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

    Technical Moderator
    November 13, 2025

    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