cancel
Showing results for 
Search instead for 
Did you mean: 

No data in Hyper terminal - STM32 Nucleo

TBlak
Associate II

Hi,

I'm having trouble getting serial data out of my STM32 Nucleo board. I managed to get this working a few years ago but for some reason it's not working for me now.

The board that I'm using is an NUCLEO-F413ZH and I'm using a USB-TTL serial cable (TTL-232R-3V3) to try and print some test data to a hyper terminal (RealTerm).

I'm running the UART_printf example from the STM32CubeF4 firmware and have modified the code as shown below:

main.c

uint8_t test_str[] = "Hello World And The Universe!\r\n";

while (1)

{

   HAL_UART_Transmit(&UartHandle, test_str, sizeof(test_str), 10);

   

   HAL_Delay(1000);

}

main.h

#define USARTx              USART2

#define USARTx_CLK_ENABLE()       __HAL_RCC_USART2_CLK_ENABLE();

#define USARTx_RX_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOD_CLK_ENABLE()

#define USARTx_TX_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOD_CLK_ENABLE()

#define USARTx_FORCE_RESET()       __HAL_RCC_USART2_FORCE_RESET()

#define USARTx_RELEASE_RESET()      __HAL_RCC_USART2_RELEASE_RESET()

#define USARTx_TX_PIN          GPIO_PIN_2

#define USARTx_TX_GPIO_PORT       GPIOA

#define USARTx_TX_AF           GPIO_AF7_USART2

#define USARTx_RX_PIN          GPIO_PIN_3

#define USARTx_RX_GPIO_PORT       GPIOA

#define USARTx_RX_AF           GPIO_AF7_USART2

I have the serial cable hooked up as follows:

NUCLEO-F413ZH TTL-232R-3V3

Pin A2 Yellow wire

Pin A3 Orange wire

GND Black wire

These are the COM Port settings I am using:

TTL-232-3V3 RealTerm

COM3 Port: 3

Bits per second: 9600 Baud: 9600

Data bits: 7 Data bits: 7

Parity: Odd Parity: Odd

Stop bit: 1 Stop Bits: 1

Flow control: None Flow control: None

When I run the code, LD4 on the NUCLEO is flashing away indicating transmission, but there is no activity at all in the terminal.

My PC is running Windows 11.

Can anyone help me with this?

Cheers,

Tony

1 ACCEPTED SOLUTION

Accepted Solutions
TBlak
Associate II

Got the code working. I found this tutorial which was super helpful:

Nucleo UART Tutorial | DMC, Inc. (dmcinfo.com)

I'm pretty sure I was just hooked up to the wrong pins but it was beneficial to learn how to use CubeMX to make the setup easier.

Thanks for your help.

View solution in original post

4 REPLIES 4
TBlak
Associate II

Fixed this code but still no joy:

#define USARTx_RX_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOA_CLK_ENABLE()

#define USARTx_TX_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOA_CLK_ENABLE()

Shirley.Ye
ST Employee

Check the baudrate setting in your code (if it is set as 9600 as your hyper term) and the AF function, GPIO, Clock settings....

TBlak
Associate II

Got the code working. I found this tutorial which was super helpful:

Nucleo UART Tutorial | DMC, Inc. (dmcinfo.com)

I'm pretty sure I was just hooked up to the wrong pins but it was beneficial to learn how to use CubeMX to make the setup easier.

Thanks for your help.

TBlak
Associate II

See above