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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

15 REPLIES 15
denko
Associate

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.

Gyessine
ST Employee

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

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.

TDK
Super User

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

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

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.

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

Pranoti_0-1762919386276.png

>But here in this project for oscillator pins its showing cortex M7 Pin context assignment.
>yes, I tried this but still it's not working.

mƎALLEm
ST Employee

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

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.