cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f100 U(S)ART and busy flag

semler
Associate II
Posted on August 25, 2014 at 19:58

I read the reference manual for circuit mentioned but I cannot find any flag in register for USART that will show there is some transmission/reception active. Is there someone who solved similar problem? I need this for my own irda multi-master protocol.

6 REPLIES 6
Posted on August 25, 2014 at 20:09

The TC flag indicates the last bit, of the last byte was transmitted. ie last bit hits the wire, and TXE=1

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
semler
Associate II
Posted on August 25, 2014 at 20:56

and what about reception? Because I need both ways...

Posted on August 25, 2014 at 22:55

Yeah, not sure how you expect to achieve that short of monitoring the pin.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 26, 2014 at 09:22

Wouldn't external interrupt on given pin work even if configured as AF?

RM (at least for 'F4) states, that even in AF, read access to the input data register gets the IO state.

OTOH, the same RM states, in a separate subchapter (8.3.8) that ''to use external interrupt lines, the port must be configured in input mode''. I suspect this is simply not true, but have no time to experiment now.

JW

 
semler
Associate II
Posted on August 26, 2014 at 20:53

Thank you for your idea. According to the diagram, usage of EXTI events should be possible (it also can provide trigger to timer and provide me the functionality of RTOF in newer mcus) or maybe I consider using Cortex-M0 stm32f030x as they have this functionality. I need only one usart interface, so it would be enough for me.

jpeacock
Associate II
Posted on August 27, 2014 at 13:34

Look at the IDLE flag (for LIN) in the SR register, it shows if the RX line is not busy but it's not all that reliable.  I connect the RX line to a timer capture pin, timer in reset mode, timer overflows if not reset by incoming bits in order to detect an idle line.  Using a timer gives you finer control over the message gap size.

TC shows when the output shift register has completed for the last byte, and it's safe to do a half duplex line turnaround.

  Jack Peacock