2024-03-03 08:01 AM
I have an STM32WB55CGU6 on a custom board with a 32MHz HSE. I'm using low power uart1 with PA2 & PA3 pins. My settings for it are:
- baud rate 9600
- word length 8 bits
- 1 stop bit
- parity none
It won't transmit. Cube doesn't receive it, any terminal doesn't receive it and the pins just remain low all the time. When I tried adding an if clause to test if the result is HAL_OK, the code wouldn't even upload. What's up here, shouldn't be this hard getting basic UART to work.
code:
uint8_t text[]={0,1,2,3,4,5,6,7,8,9};
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_UART_Transmit(&hlpuart1, text, 10, 100);
HAL_Delay(500);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
´´´
2024-03-03 08:15 AM
But this is a custom board. All bets are off. Have you tried this on a well known ST evaluation board?
2024-03-03 08:41 AM
Verify PA2/PA3 are connected to what you think they're connected to by setting them as GPIO outputs and toggling.
> When I tried adding an if clause to test if the result is HAL_OK, the code wouldn't even upload.
Probably have other things going on here. The upload process doesn't care what the code being uploaded is. In what way wouldn't it upload? What happened when you tried?
2024-03-03 09:13 AM
It either says 'target not found' or 'no device on target' and 'couldn't open STM32_Programmer_CLI.exe'. If I remove the if clause the error goes away. Makes no sense but somewhy it still happens. Thanks for your reply
2024-03-03 09:17 AM
No. To my knowledge a simple UART connection does not need an entire evaluation board to get working.
2024-03-03 09:35 AM
Correct, but it allows for the code to be tested on a known platform.
You're sending non-printable characters, perhaps send something you can read. Perhaps send U 0x55 characters and scope the signals.
Not clear on your circuit or serial connectivity.
2024-03-03 10:45 AM
No connection suggests that the debug interface is also being disabled, PA13/PA14, or the chip is going to a low-power mode
2024-03-06 09:37 AM
The reason there is no UART traffic visible is because the UART pins on my ST-LINK/V2 are connected to GND. Do I need to activate the UART interface somewhere?
2024-03-07 12:35 PM
The ST-LINK/V2 doesn't have a working VCP. The UART_TX/RX was a future development and as far as I know, was never implemented.
You can upgrade to a ST-LINK-V3 or use a generic USB<>TTL adapter.
2024-03-07 04:04 PM
This was reposted and answered here:
https://community.st.com/t5/stm32-mcus-products/st-link-v2-lpuart-connection/td-p/647622