0
\$\begingroup\$

I am trying to connect UART communication with STM32L053C8-Discovery. But the problem is on terminal I get unknown symbols.

My Setup on CubeMX

STM32CubeMX UART

/* USER CODE BEGIN Includes */
uint8_t tx_buff[]={1};
uint8_t rx_buff[10];

  while (1)
  {
    HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
    HAL_UART_Transmit_DMA(&huart1,tx_buff,sizeof(tx_buff));// Sending in DMA mode
    HAL_Delay(1000);
}

To RX,TX pins I connected FT232RL FTDI module.

enter image description here

enter image description here

With Arduino it works but with STM32 in terminal I get only symbols. Maybe someone could explain me how to correctly set the format?

enter image description here

Also there is a full code of main.c: https://pastebin.com/kST92XWZ

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

Baud rate mismatch.

Baud rate is set to 9600 baud on the screenshots, but it's 9800 in the linked code.

huart1.Init.BaudRate = 9800;
\$\endgroup\$
3
  • \$\begingroup\$ Sorry, my mistake. But I'm getting the same result with 9600. pastebin.com/qAFpiuy9 \$\endgroup\$
    – m1row
    Nov 2, 2018 at 10:38
  • 1
    \$\begingroup\$ tx_buff[]={1}; is not a printable character code. What should your terminal program do with it? Try transmitting a string. \$\endgroup\$ Nov 2, 2018 at 11:00
  • \$\begingroup\$ Thank you for your replay! I've downloaded STM32Cube MCU Package for STM32L0 series from link. There was an example of UART communication. I will analyse it. Have a good day! \$\endgroup\$
    – m1row
    Nov 2, 2018 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.