cancel
Showing results for 
Search instead for 
Did you mean: 

UART communication issue

mushfiq
Associate II
Posted on September 15, 2016 at 20:42

hello everyone! i wanna know about the way i can know whether my uart is available or not like i did in case of arduino using Serial.available() function call ???

#stm32f103c8t6
4 REPLIES 4
Posted on September 15, 2016 at 21:29

The STM32 USART has no buffer depth, it has a holding register, and you can check the status of that with RXNE. Review the Reference Manual to understand the USART and it's internal registers.

You could build your own buffering around the hardware, and offer an equivalent to Serial.available(), or look directly at your own variables implementing the buffer to see the level of fullness, etc.

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

@clive1: but i'm a beginner, can u tell me the whole process in short, where i can find the reference manual of USART??i'm really confused hey can i use the HAL_UART_GetState() function call to determine whether the USART1 is busy or not?? i have used CubeMX for code initialization and Keil5 Compiler for compiling !

Posted on September 16, 2016 at 22:08

You can Google the part# or the Reference Manual

http://www.st.com/content/ccc/resource/technical/document/reference_manual/59/b9/ba/7f/11/af/43/d5/CD00171190.pdf/files/CD00171190.pdf/jcr:content/translations/en.CD00171190.pdf

I'm not using HAL/CUBE you will need to find your own tutorials, and review the examples provided under the Cube installation.

The TXE, RXNE flags in the USART are similar to those methods used over several decades of serial UART designs, the methods for examining and buffering serial data will have coverage in the many micro-controller texts over that period. Most embedded systems use interrupts and ring-buffers (FIFO) to manage serial data streams.

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

thank you clive1 🙂