2019-11-06 08:08 AM
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.
2019-11-06 08:18 AM
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.
2019-11-06 09:07 AM
Using the WRONG pins for USART, using PA9/PA10, when the board used PB6/PB7
2019-11-06 09:43 AM
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.
2019-11-06 10:00 AM
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
2019-11-06 10:08 AM
No it doesn't work, i did just make the change and run again. Loop runs fine but no message on the screen.
2019-11-07 12:32 AM
Sorry, it was my mistake, i hadn't changed GPIOA -> GPIOB. Thanks, its working now.