Skip to main content
Associate II
February 18, 2025
Question

Log Values from STM32H747IGTX M7 Core on PuTTY

  • February 18, 2025
  • 1 reply
  • 628 views

Hello, 

So right now I am trying to get my printf to work on CubeIDE and printing the respective output on PuTTY. I can't seem to figure out why it doesnt work when people on Youtube simply press run and their code works.

For context... 
1. Using M7 core and running USART3 in async mode with 
     a) Baud Rate: 115200 Bit/s, 8 Bits, no Parity, 1 Stop Bit
     b) Checked USART3 global interrupt
     c) Checked pin config (no overlap)

2. In Putty 
      a) Checked all parameter match 
      b) COM port matches

Nothing seems to print in PuTTY although it does connect. If any more information is required I will send immediately. Thanks in advance!!
This is the pseudo code of what I am trying to run 

 

#include "main.h"
#include "usart.h"
#include <arm_math.h>

void SystemClock_Config(void);
void PeriphCommonClock_Config(void);

int main(void)
{
 HAL_Init();
 SystemClock_Config();
 PeriphCommonClock_Config();
 HAL_HSEM_FastTake(HSEM_ID_0);
 HAL_HSEM_Release(HSEM_ID_0,0);

 MX_GPIO_Init();
 MX_DMA_Init();
 MX_I2C1_Init();
 MX_QUADSPI_Init();
 MX_I2S1_Init();
 MX_SPI3_Init();
 MX_USB_OTG_FS_PCD_Init();
 MX_USART3_UART_Init();

 while (1)
 {
 /* USER CODE END WHILE */
// printf("success");
 HAL_UART_Transmit(&huart3, (uint8_t*) "Good", 3, 100);
 HAL_Delay(1000);
 /* USER CODE BEGIN 3 */
 }
}

extern "C"
{
	int _write(int file, char *ptr, int len)
 {
 HAL_UART_Transmit(&huart3, (uint8_t*)ptr, len, HAL_MAX_DELAY);
 return len;
 }
}

 

 

 

1 reply

Ozone
Principal
February 18, 2025

I would recommend to start with finding out what is actually "there".
Use a scope or logic analyzer, and check if there is a signal on the MCU Tx pin.

I don't know the board you use, but make sure this MCU Tx/Rx pins are correctly hooked up to a serial-USB converter (or level converter), and connected to the proper PC pins (i.e. crossed).
And check with the schematics the used MCU pins are free, and notused by other, external components.

And finally, check the transmission parameters settings on both sides (baudrate, start/stop bits, parity), and verify (i.e. measure) on the transmitting side.

Transmitting something continuously in an endless loop is a good starting point for that.

> Nothing seems to print in PuTTY although it does connect. 

That does only mean the terminal program (Putty) was able to open the serial line / COM port with the supplied parameters, and nothing else.

GoldyluxAuthor
Associate II
February 18, 2025

Omg brilliant! I just realized that the pins weren't connected for the USART. Thanks for pointing that out!

Right now, I'm working on a custom board, and I’d like to ask are there any alternative ways to log data from STM32CubeIDE? I know SWO and RTT could work, but is there a more straightforward method that doesn’t require a UART-to-USB converter? Maybe logging directly via USB or using CubeIDE tools?

Andrew Neil
Super User
February 18, 2025

@Goldylux wrote:

is there a more straightforward method that doesn’t require a UART-to-USB converter? Maybe logging directly via USB or using CubeIDE tools?


You certainly could implement something to go over USB; eg, CDC.

Whether that would actually work out as "more straightforward" is another question ...

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.