Skip to main content
Visitor II
April 3, 2021
Question

Not able to Transmit data using UART1 in STM32H753 Eval board

  • April 3, 2021
  • 2 replies
  • 781 views

I was working in an application where i need to transmit data from STM32h753 to PC. For this application i used USART1 which is connected to ST-Link. Everything was working fine and suddenly STM32H753 stopped transmitting the data. Even after resetting the controller it did not solve the problem. This is the configuration for USART which i used

void MX_USART1_UART_Init(void)
{
 huart1.Instance = USART1;
 huart1.Init.BaudRate = 9600;
 huart1.Init.WordLength = UART_WORDLENGTH_8B;
 huart1.Init.StopBits = UART_STOPBITS_1;
 huart1.Init.Parity = UART_PARITY_NONE;
 huart1.Init.Mode = UART_MODE_TX_RX;
 huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
 huart1.Init.OverSampling = UART_OVERSAMPLING_16;
 huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
 huart1.Init.ClockPrescaler = UART_PRESCALER_DIV1;
 huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
 if (HAL_UART_Init(&huart1) != HAL_OK)
 {
 Error_Handler();
 }
 if (HAL_UARTEx_SetTxFifoThreshold(&huart1, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
 {
 Error_Handler();
 }
 if (HAL_UARTEx_SetRxFifoThreshold(&huart1, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
 {
 Error_Handler();
 }
 if (HAL_UARTEx_DisableFifoMode(&huart1) != HAL_OK)
 {
 Error_Handler();
 }
}
void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
{
 GPIO_InitTypeDef GPIO_InitStruct = {0};
 if(uartHandle->Instance==USART1)
 {
 /* USER CODE BEGIN USART1_MspInit 0 */
 /* USER CODE END USART1_MspInit 0 */
 /* USART1 clock enable */
 __HAL_RCC_USART1_CLK_ENABLE();
 __HAL_RCC_GPIOB_CLK_ENABLE();
 /**USART1 GPIO Configuration
 PB15 ------> USART1_RX
 PB14 ------> USART1_TX
 */
 GPIO_InitStruct.Pin = RS_232RX_Pin|RS232_TX_Pin;
 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
 GPIO_InitStruct.Pull = GPIO_NOPULL;
 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
 GPIO_InitStruct.Alternate = GPIO_AF4_USART1;
 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 /* USER CODE BEGIN USART1_MspInit 1 */
 /* USER CODE END USART1_MspInit 1 */
 }
}

I tried to erase the flash memory using ST-Link to re-flash the code but i encountered something like this,

0693W000008ycyGQAQ.png 

0693W000008ycyQQAQ.pngThe settings in ST-Link Utility is

0693W000008ycyVQAQ.png0693W000008ycyaQAA.png 

    This topic has been closed for replies.

    2 replies

    Super User
    April 4, 2021

    Has someone else played with the board? There are two jumpers that connect UART1 to DB9 connector, or to the virtual COM port of ST-LINK.

    --pa

    UPa.1Author
    Visitor II
    April 5, 2021

    yeah Pavel its JUMPERS JP7 and JP8. I connected the jumpers such that the Tx and Rx lines goes to the virtual COM port of ST-LINK.