Page 1 of 2

Usart flow control (rts/cts) in stm32f1xx

Posted: Mon Oct 01, 2012 6:33 am
by ucasano
Hello, i Was wondering if rts/cts flow control is supported by chibios for stm32f1xx ucontrollers.
If yes, were could i find a code snippet of such configuration, showing also how to receive and transmit?

I tried using cr1, cr2 and cr3 in uartconfig structure while configuring; but I Saw no rts/cts handling by uc,
Expecially in receiving stage.

Thanks
-g

Re: Usart flow control (rts/cts) in stm32f1xx

Posted: Mon Oct 01, 2012 8:17 am
by Giovanni
Hi,

HW flow control is not explicitly implemented in the driver but is should be pretty much automatic when enabled in control registers, at least this is what I read in the reference manual in section 27.3.14. Make sure that CTS/RTS pins are configured correctly, outputs should be alternate functions on the F1.

Giovanni

Re: Usart flow control (rts/cts) in stm32f1xx

Posted: Mon Oct 01, 2012 5:02 pm
by ucasano
Hi Giovanni, I have done what you wrote, which is the same I did before, and receiver does not work.

The reason is RTS stays always UP, and never gets down.

So I am wondering, do I have to explicitly call the uartStartReceive function after each send?

Bye
-g

Re: Usart flow control (rts/cts) in stm32f1xx

Posted: Mon Oct 01, 2012 6:17 pm
by Giovanni
Hi,

Is RTS programmed as alternate output?

A question, are you sure you need the "UART" driver? it is possible the "Serial" driver is better in your case, what are your requirements? note that the UART driver is unbuffered (the Serial driver is buffered instead) and you have to restart the transfers after each callback.

Giovanni

Re: Usart flow control (rts/cts) in stm32f1xx

Posted: Mon Oct 01, 2012 6:29 pm
by ucasano
Hi Giovanni, RTS is alternate output.

But I just read the errata sheet of my stm32f103 (http://www.st.com/internet/com/TECHNICA ... 197763.pdf) and seems that in my case
there is a conflict with CAN:

" the CAN must be remapped to either another IO configuration when the CAN is used, or to the unused configuration (CAN_REMAP[1:0] set to “01”) when the CAN is not used."

How do I remap can to unused configuration?

I am using usart to interface with a gprs modem: is using the uart device the right thing to do?
Another question: does serial peripherals support cts/rts flow control?

Thanks.
-g

Re: Usart flow control (rts/cts) in stm32f1xx

Posted: Mon Oct 01, 2012 7:11 pm
by ucasano
Hello all, I did it.

It depended on the errata sheet I reported in my previous post.

Definitely, now, it seems to works fine.

Just a few seconds for last question: which driver should I use to talk to a gprs modem? usart or serial?

Thanks for your time and consideration.
bye
-g

Re: Usart flow control (rts/cts) in stm32f1xx

Posted: Mon Oct 01, 2012 8:02 pm
by Giovanni
Hi,

Both can be used but Serial is probably easier to use, it does not require callbacks and supports communication timeouts natively, the UART driver is mostly meant for packet-oriented applications at very high rates.

Giovanni

Re: Usart flow control (rts/cts) in stm32f1xx

Posted: Mon Oct 01, 2012 8:55 pm
by ucasano
So uart driver has to be used for implementing lwip over ppp: is'nt it?
P

Re: Usart flow control (rts/cts) in stm32f1xx

Posted: Mon Oct 01, 2012 9:12 pm
by Giovanni
It can be used in any application but Serial is easier most of times.

Could be used for ppp or for an RS485 network for example, anywhere data is organized in packets rather than streams.

Giovanni

Re: Usart flow control (rts/cts) in stm32f1xx

Posted: Tue Oct 02, 2012 7:21 am
by ucasano
Looks good... What about udp streams? Would you use serial or uart driver? In this case, we have streams of datas,
inside udp packets...

-g