cancel
Showing results for 
Search instead for 
Did you mean: 

UART/USART to print to terminal

botmail2422
Associate II
Posted on June 14, 2016 at 19:00

Board: STM32F407VGT

OS: Ubuntu 14.04

HAL Library (Not SPL)

I am having difficulties getting output from the STM32F4 to communicate with my terminal via ''cat /dev/tty*'', putty, or ckermit. I am using USART2 from PA2 (Tx) and PA3 (Rx) to communicate to the USB. My computer recognizes the USB in the /dev directory but none of the outputs work. I have tried to find HAL tutorials and examples that work but none of them have... What is wrong with my code?

http://pastebin.com/jCaEU4y1

#no-hablo-hal
6 REPLIES 6
Posted on June 14, 2016 at 22:57

Per your earlier thread, you'd want a CMOS Serial (3V) adapter, and not an RS232 one

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
botmail2422
Associate II
Posted on June 15, 2016 at 12:37

I ended up buying a CP2102 USB 2.0 to UART TTL 6PIN Module Serial Converter Adapter (from your recommendation) but that's not what I am worried about right now. I have an led attached to the UART2 Tx pin and during execution, HAL_UART_Transmit is called repeatedly but the led does not blink at all. Clearly there is something wrong with my code... 

AvaTar
Lead
Posted on June 15, 2016 at 13:09

>I have an led attached to the UART2 Tx pin ... but the led does not blink at all.

 

Perhaps because the GPIO can't drive a LED directly in UART Tx mode ?

Check the datasheet, and compare with your LED current requirements.

Posted on June 15, 2016 at 19:50

Really can't help you with the HAL stuff, I've posted a host of working SPL examples here.

Review signalling with a scope.

The TX of the STM32 likely needs to go to the RX of receiver.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
botmail2422
Associate II
Posted on June 17, 2016 at 18:14

My USB to USART came in and I still can't get output to /dev/ttyUSB0, kermit, putty, or screen. Does anyone have a known good example of STM32f4 Disco HAL_UART_Transmit example?

Posted on June 17, 2016 at 19:33

You could try sending a continuous stream of characters and scoping that.

That something ''doesn't work'' really doesn't help anyone diagnose what you are doing wrong. Show the complete code you are using, and diagram exactly the connectivity you have externally, not prose, not a video, a wiring diagram.

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