When I open an ftp transfer connection it is locking the modem up to where it will not stream responses.
Here is a selection of my code:
Do
buffer = ""
localCom.DiscardInBuffer()
localCom.WriteLine("AT+CREG?")
System.Threading.Thread.Sleep(1000)
If localCom.BytesToRead > 0 Then
buffer = buffer + localCom.ReadExisting
End If
Loop While Not buffer.Contains("+CREG: 0,5")
buffer = ""
localCom.DiscardInBuffer()
Do
localCom.WriteLine("AT+CGREG?")
System.Threading.Thread.Sleep(1000)
If localCom.BytesToRead > 0 Then
buffer = buffer + localCom.ReadExisting
End If
Loop While Not buffer.Contains("+CGREG: 0,5")
buffer = ""
localCom.DiscardInBuffer()
localCom.WriteLine("AT+WIND=4")
Do
If localCom.BytesToRead > 0 Then
buffer = buffer + localCom.ReadExisting
End If
Loop While Not buffer.Contains("OK")
buffer = ""
localCom.DiscardInBuffer()
localCom.WriteLine("AT+WIPCFG=1")
Do
If localCom.BytesToRead > 0 Then
buffer = buffer + localCom.ReadExisting
End If
Loop While Not buffer.Contains("OK")
buffer = ""
localCom.DiscardInBuffer()
localCom.WriteLine("AT+WIPBR=1,6")
Do
If localCom.BytesToRead > 0 Then
buffer = buffer + localCom.ReadExisting
End If
Loop While Not buffer.Contains("OK")
buffer = ""
localCom.DiscardInBuffer()
localCom.WriteLine("AT+WIPBR=2,6,11," & Chr(34) & "MYAPN" & Chr(34))
Do
If localCom.BytesToRead > 0 Then
buffer = buffer + localCom.ReadExisting
End If
Loop While Not buffer.Contains("OK")
buffer = ""
localCom.DiscardInBuffer()
localCom.WriteLine("AT+WIPBR=4,6,0")
Do
If localCom.BytesToRead > 0 Then
buffer = buffer + localCom.ReadExisting
End If
Loop While Not buffer.Contains("OK")
buffer = ""
localCom.DiscardInBuffer()
localCom.WriteLine("AT+WIPCREATE=4,1," & Chr(34) & "MYFTPSIGHT" & Chr(34) & ",21," & Chr(34) & "MYUSERNAME" & Chr(34) & "," & Chr(34) & "MYPASSWORD" & Chr(34))
Do
If localCom.BytesToRead > 0 Then
buffer = buffer + localCom.ReadExisting
End If
Loop While Not buffer.Contains("OK")
buffer = ""
localCom.DiscardInBuffer()
localCom.WriteLine("AT+WIPOPT=4,1,2,40,1")
Do
If localCom.BytesToRead > 0 Then
buffer = buffer + localCom.ReadExisting
End If
Loop While Not buffer.Contains("OK")
buffer = ""
localCom.DiscardInBuffer()
Try
localCom.WriteLine("AT+WIPFILE=4,1,2," & Chr(34) & "./10kTest.txt" & Chr(34))
Do
If localCom.BytesToRead > 0 Then
buffer = buffer + localCom.ReadExisting
End If
System.Threading.Thread.Sleep(500)
Loop Until buffer.Contains("CONNECT")
buffer = ""
localCom.DiscardInBuffer()
fileBuffer = fileReader.ReadToEnd
chrBuffer = fileBuffer.ToCharArray()
For Each chrbuff As Char In chrBuffer
Do
If localCom.CtsHolding = True Then
localCom.Write(chrbuff)
Exit Do
End If
Loop
Next
localCom.WriteLine(Chr(3))
Do
System.Threading.Thread.Sleep(1000)
If localCom.BytesToRead > 0 Then
buffer = buffer + localCom.ReadExisting
End If
Loop While Not buffer.Contains("OK")
.......
Everything works great up until the localCom.WriteLine(“AT+WIPFILE=4,1,2,” & Chr(34) & “./10kTest2.txt” & Chr(34))
It returns “AT+WIPFILE=4,1,2,”./10kTest2.txt"
but nothing after that is ever foound in the serialPort Buffer.
(I ended up putting counters in the loops so they would execute through after I realized the commands were being processed by the modem)
Everything works out great the file gets transfered, I end this function by stoping the stack, closing the bearer, etc.
THEN when I open up HyperTerminal everything streams out, as if the CTS on the TE side was False.
I currently have AT+IFC=0,2 SO that I am able to check CTS from the Modem and don’t overflow the buffer. When I instead set the modem to AT+IFC=0,0
there is no problem. All data is streamed back from the modem, EXCEPT that I overflow the buffer in the modem, and lose some of the data in the stream from the TE side.
Has anyone else had this problem and what is the fix?