2025-11-11 2:39 AM - last edited on 2025-11-12 1:01 AM by mƎALLEm
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
Edited to apply source code formatting - please see How to insert source code for future reference.
Solved! Go to Solution.
2025-11-12 8:36 PM
Hi Now my USART3 is working fine independently but when i initialize spi1 in that project printf statements and uart dont work why ?
2025-11-13 1:24 AM
@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.
2025-11-13 1:35 AM
This is not the answer to accept:
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.
2025-11-13 1:38 AM
I solved it by changing clock configuration required for that. Output required for uart was 64MHz and previously it was different.
2025-11-13 1:43 AM
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
2025-11-13 8:30 AM
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...