I made a program and it works well without UART2. I just made a simple program but nothing happend on the TX pin of the UART2.
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_UART_Transmit(&huart2, &displayBuffer, 1, 0xFFFF);
"updateLcd()" function is using I2C and the clock source is same of UART2, so I think the clock for UART2 works. I2C works well.
TX line voltage continues hi, as idle. No data come up.
I can see the TDR resistor changes the value each 1 sec, so my data is stored in TDR for sure.
I tried to not use HAL_UART_Transmit() function and tried to write the data directly into the TDR like following, the result was same...
huart2.Instance->TDR = displayBuffer;
The periferal clock is 16MHz, and the UART2 setting is following.
/* USART2 init function */
static void MX_USART2_UART_Init(void)
huart2.Instance = USART2;
huart2.Init.BaudRate = 9600;
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)