Skip to main content
er3481
Associate III
July 22, 2020
Question

STM32F030 HAL_UART_Transmit problem

  • July 22, 2020
  • 3 replies
  • 669 views

Hi,

I am trying to receive and trasnmit data with STM32F030C8 mcu, i can receive any data from serial monitor, but when i try to use HAL_UART_Transmit to send data, i can not see anything on serial monitor. Any advise?

uint8_t data[25];//this my data buffer to send
 
HAL_UART_Transmit(&huart2, data, sizeof(data), HAL_MAX_DELAY); //in startup i use this to send data bufer
 
 
static void MX_USART2_UART_Init(void)//this is my usart2 setup
{
 
 huart2.Instance = USART2;
 huart2.Init.BaudRate = 115200;
 huart2.Init.WordLength = UART_WORDLENGTH_8B;
 huart2.Init.StopBits = UART_STOPBITS_1;
 huart2.Init.Parity = UART_PARITY_NONE;
 huart2.Init.Mode = UART_MODE_TX_RX;
 huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
 huart2.Init.OverSampling = UART_OVERSAMPLING_16;
 huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
 huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
 if (HAL_UART_Init(&huart2) != HAL_OK)
 {
 _Error_Handler(__FILE__, __LINE__);
 }
 
}

This topic has been closed for replies.

3 replies

waclawek.jan
Super User
July 22, 2020

Read out and check/post the USART and relevant GPIO registers content.

JW

S.Ma
Principal
July 22, 2020

for uart, better use low layer.

KnarfB
Super User
July 22, 2020

If you can receive, you could do a loopback by connecting TX and RX directly and check transmission. And: check TX pin with a LA/scope. How accurate is the MCU/UART clock?