cancel
Showing results for 
Search instead for 
Did you mean: 

Flow control not working as I expect

markb
Associate II
Posted on October 06, 2015 at 16:31

Next problem...

I have enabled flow control on the module and the MCU and now attempting to use a bit rate of 460800.

Both ends are using the right bit rate but only the MCU appears to be controlling an RTS signal. The RTS output

on pin 10 of the module goes low on module initialisation and stays low even when I send a lot of data to the

module. The module is in data mode. Not exactly sure what data is getting lost but the comms protocol between

the MCU and the client (via a websocket) is failing. Using exactly the same hardware and software but a lower

bit rate (115200) works absolutely fine.

Is there anything else I need to do apart from setting console1_hwfc to 1 and turning on RTS/CTS flow control

on the MCU?

Cheers,

Mark
25 REPLIES 25
markb
Associate II
Posted on October 08, 2015 at 15:53

Hi Jerry,

I still can't get flow control to work. With console1_hwfc=1, when I send data at a fast rate (921600 baud), the module's RTS stays low and it looks like

either the module's buffers are getting overwritten before they can be sent or swathes of data is simply being thrown away.

For testing, I am writing  a sequence of 4 byte integer values, the value being incremented each time. What I see using either wireshark or by reading the socket data on my client machine is that the sequence of values is OK for a while and then it jumps to a new value and carries on from there and then it jumps again and so on. So it looks like the module's buffer is being overwritten before it can be sent or perhaps chunks of values are being discarded.

Anyway, I have wasted two days on this, it doesn't work. Either the module is broken, or there's something I am not doing right.

Can I get any more diagnostics out of the module?

Is my module's hardware too old?

Cheers,

Mark

Posted on October 08, 2015 at 18:26

Hi Mark,

forgive me for the stupid question... are you crossing RTS/CTS lines between SPWF and external MCU? Can you share the schematic? Just a double check.

Using an oscilloscope, I correctly see RTS line up and down, according to module buffer full/empty.

ciao

j

markb
Associate II
Posted on October 08, 2015 at 19:02

Hi Jerry,

I have double, triple checked the circuit. No, the RTS/CTS connections are not crossed. Sorry, I can't post a schematic to this BB.

The RTS signal from the MCU, goes high briefly when the WIFI sends characters to it at 921600 baud and that appears to be correct.

The RTS signal from the module is high (if pulled up with a 10K resistor) when the module is in reset and goes low when the module

is out of reset and operational. While the module is operating it never goes high no matter how much data I send to the module.

I will build another board next week with a new module and perhaps it will be better.

Cheers,

Mark

Posted on October 08, 2015 at 19:08

I was expecting a ''yes'' as reply :)

I mean:

- module CTS to MCU RTS

- module RTS to MCU CTS

- same on Tx/Rx lines..

markb
Associate II
Posted on October 08, 2015 at 19:21

Sorry, I should have said, yes, they are crossed (RTS to CTS). What I was trying to say was they are not incorrectly connected!

laerte
Associate II
Posted on October 16, 2015 at 16:38

Hi, 

i'm working with spwf01 module and trying to enable hardware flow control using the AT cmd at+s.scfg=console1_hwfc,1.

But when enabled the module didn't give any data on the tx line. 

I'm using baud rate at 115200, but even with higher baudrates don't work.

Any ideas?

markb
Associate II
Posted on October 16, 2015 at 19:25

Hi,

Are you driving the module's CTS line low? It needs that to be able to transmit on the tx line.

That works for me but I am having the opposite problem, when I enable the flow control, the module does not drive the RTS signal no matter how much data I send to it. RTS stays low always when the module is not reset. I have even built a new board with a new module and the behaviour is the same.

Cheers,

Mark

laerte
Associate II
Posted on October 19, 2015 at 10:48

I Mark,

I used an oscilloscope and also my RTS line seems to stay low all the time. This is very strange!

I found my problem, it was an issue in the configuration of the uart of my mcu. Now it works. 

I also changed the parameter wifi_rts_threshold to 0, so the RTS control is always active, did you?

I think you can't drive the CTS line low because this is a read input only before you assert the RTS line and next you send data to rx line...

What mcu are you using?

markb
Associate II
Posted on October 19, 2015 at 11:43

Hi,

I am using an STM32F405.

My understanding is that wifi_rts_threshold is related to the WiFi radio protocol rather than the UART RTS.

I still can't get the module to control the RTS signal, nothing I do makes any difference.

Jerry, does the boot code that goes in the low flash have any influence on the RTS? I wonder if the low code I have in my modules is too old?

Cheers,

Mark

Posted on October 19, 2015 at 21:45

Hi Mark,

- you are right: wifi_rts_threshold has no impact on UART.

- Boot application has no impact on UART management.

- About RTS, you can refer to this thread: https://my.st.com/public/STe2ecommunities/interface/Lists/WiFi%20Modules/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2finterface%2fLists%2fWiFi%20Modules%2fData%20loss%20using%20SPWF01SA%20%28multiples%20of%202kiB%29&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800086789498A6852D4897EA19...

Another user identified an overrun, under fix for next release.

About your case:

1 - you are loosing data - refer to thread above

2 - you are not loosing data, but want to be sure that RTS stop-start external host - you can take a look at screenshot attached into thread above from user

If you want, I can share the simple project for STM32F4Discovery I used for test overrun into thread above. ''Test overrun'' means ''the proof that RTS switch but data are lost anyway''

ciao

jerry