UART example code in STM32F1 HAL library function not transmitting
I attempt to use the ST example code 'UART_TwoBoards_ComPolling' that comes with the STM32CubeF1 library. (All ST examples are very helpful, thank you.)
Development environment used:
* Library: STM32Cube_FW_F1_V1.8.5.
* Hardware: two NUVLEO-F103RB boards (one for UART1_TX, one for UART1_RX).
* IDE: STM32CubeIDE Version: 1.12.1.
The example code is built two times, both for the TX Nucleo and for the RX Nucleo. That means, the UART1 peripherals on both boards are configured the same.
Problem:
The UART1_TX function does not seem to work in the function HAL_UART_Transmit():
/*##-2- Start the transmission process ######### */
if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, TXBUFFERSIZE, 5000)!= HAL_OK)
{
Error_Handler();
}In particular, the IDE debugger shows that the UART data register (DR) does not change during the following char assignment, as the DR value is always shown as 0. See the Debugger screenshot at the bottom.
else
{
huart->Instance->DR = (uint8_t)(*pdata8bits & 0xFFU);
pdata8bits++;
}
huart->TxXferCount--;Increasing the TX-buffer pointer (pdata8bits++) and the counter (TxXferCount++) works, so the correct characters should be written to the UART1->DR.
Question:
* How to confirm that DR is actually being updated?
* Should this work in Debug mode?
* Is the DR cleared immediately after transmitting the data?
Thank you!
