2025-08-07 1:47 AM
I am working with the STM32C092CCTx microcontroller and have configured USART2 in asynchronous mode using STM32CubeMX. The system clock (SYSCLK), HCLK, and PCLK1 are all set to 48 MHz. USART2 TX/RX pins are correctly assigned with their alternate functions, and the peripheral is initialized using HAL.
However, I do not see the USART2 clock source (clock mux) option in the Clock Configuration tab. I would like to confirm whether, for this STM32C0 series device, USART2 is fixed to use PCLK1 as its clock source — and whether the absence of the clock mux option is expected behavior in CubeMX for this MCU.
Despite calling HAL_UART_Transmit() with valid parameters and configuring the baud rate to 115200 bps, I am not observing any data on the TX line. All clock and GPIO configurations appear correct. Could this be related to an internal clocking issue, or is there another possible misconfiguration I should look into?
Any guidance on this would be greatly appreciated.
2025-08-07 6:43 AM
USART2 clock is always the APB clock. Only USART1 has a clock selection mux. You can see this in the reference manual.
Set the pin as output and toggle and view on the scope to verify connectivity. Otherwise, add details of your setup. Board, pin, connections, etc.
2025-08-07 10:48 PM
Thank you for confirming that on STM32C0 devices, USART2 always runs from PCLK1.
My current clock and peripheral configuration is as follows:
MCU: STM32C092CCTx (custom board)
SYSCLK / HCLK / PCLK1: 48 MHz
USART2: Asynchronous mode, Baud rate 115200, 8N1, no parity, no hardware flow control
USART2 TX/RX Pins:
PA8 → USART2_Tx
PA15 → USART2_Rx
CubeMX Settings: Generated MX_USART2_UART_Init() from CubeMX, no manual changes to HAL init code
Clock Prescaler: UART_PRESCALER_DIV1
HAL Code Used: HAL_UART_Transmit(&huart2, wifiicon, sizeof(wifiicon), HAL_MAX_DELAY);
Tests performed so far:
Configured PA8 as GPIO output in CubeMX and toggled it in firmware — waveform observed on oscilloscope, so pin/hardware are fine.
Verified PCLK1 frequency = 48 MHz.
Confirmed peripheral initialization runs without error.
No signal appears on TX pin when calling HAL_UART_Transmit().
At this point, I’m trying to determine if there are:
Any additional configuration steps needed for USART2 on STM32C0
Any known errata or HAL/CubeMX issues that could cause TX to remain idle
Specific settings in CubeMX or code that must be enabled beyond the default generated init function
I can share the .ioc file if it helps with reproducing the issue.
2025-08-08 6:47 AM
Does the HAL_UART_Transmit function return HAL_OK? Probably a bug in pin initialization somewhere then.
2025-08-11 5:05 AM
Does the HAL_UART_Transmit function return HAL_OK?
yes it returning HAL_OK!. i verified with my UART pins