cancel
Showing results for 
Search instead for 
Did you mean: 

UART message on STM32 IoT node doesn't show up on virtual terminal.

ambinabhi
Associate II

I am playing around with the STM32 IoT node discovery kit, came across this strange behavior while using USART. When only LED_2 and UART are enabled on CubeMX (using SMT32CubeIDE btw) and simple blink(toggle) and a USART message is sent and it doesn't show up on terminal (TeraTerm) although the toggle works fine according to delay set. However on the debugger i can see UART_Transmit function working fine and returns HAL_OK. I am not sure why the message doesn't show up on terminal.

But when i enable all default pin and configurations the message does seem to appear on terminal.

Any idea/help is much appreciated. Attached the sample code below.

6 REPLIES 6
S.Ma
Principal

When HAL_OK returns from sending bytes it's like the brain sent message to a limb (GPIO) even if it is missing. Check for the GPIO pin configuration and especially alternate functions and GPIO port clock enable. A scope on USART pin could help root out the lurking bug.

https://www.st.com/content/ccc/resource/technical/document/user_manual/group0/b1/b8/7a/f2/f7/8d/4b/6b/DM00347848/files/DM00347848.pdf/jcr:content/translations/en.DM00347848.pdf

Using the WRONG pins for USART, using PA9/PA10, when the board used PB6/PB7

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Yea, that's strange cause i am generating it from CubeMX, when i enable USART1 from connectivity section it selects PA9 and PA10. But when i manually do assign PB6 and PB7 the project doesn't compile since USART1 is not enabled.

I'm not using CubeMX, could be driver error, but you can just edit the code in the stm32l4xx_hal_msp.c file to change the pins

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

No it doesn't work, i did just make the change and run again. Loop runs fine but no message on the screen.

Sorry, it was my mistake, i hadn't changed GPIOA -> GPIOB. Thanks, its working now.