SIM900 Module

I’m using SIM900 Gadgeeter module. There are some problems with TCP send and connect with seed driver, so I’m using driver from DLSys (http://www.tinyclr.com/codeshare/entry/590)
Everything works perfect, except, the returned state is “OK”, even if the server isn’t available :

 public bool Connect(string serverAddress, int port)
		{
			if (!IsReady) return false;
            var tcpState = _radio.ConnectTCP(serverAddress, port);
             //Thread.Sleep(2000); // wait for connection TODO: make the connect block until "CONNECT" is received (AT)

			_isTcpConnected = tcpState == CellularRadio.ReturnedState.OK;
			return _isTcpConnected;
		}

In my debug window, i see, that response from Cellular Radio is “CONNECT FAIL”, which is correct response:
CellularRadio : SENT: AT+CIPSTART=“TCP”,“xxx.xxx.xxx.xxx”,yyyy

CellularRadio : <AT+CIPSTART=“TCP”,“xxx.xxx.xxx.xxx”,yyyy

OK

CellularRadio : <
STATE: TCP CLOSED

CONNECT FAIL

Is there any chance to read responses from sended AT commands, that are shown in debug window?

Thanks

check gadgeteer.codeplex.org and see if the source code for the Seeed module is there. You can then download the source code and include in your program. If you do that, you can make any changes you need.

Thanks for link.

I downloaded solution, and found cellular module project. I’m working in 4.2 framework, but the cellular module is built in 4.1. When I try to switch to 4.2, it says that class Serial does not exists in Gadgeteer.Interfaces namespace. Where can I found CellularModule, build in 4.2 framework?

PS - If I use CellularModule in 4.1 with my application in 4.2 there are missing CellularRadio dependencies, which are smaller version than currently mine:

Assembly: GTM.Seeed.CellularRadio (1.0.0.0) needs assembly ‘mscorlib’ (4.1.2821.0)
Assembly: GTM.Seeed.CellularRadio (1.0.0.0) needs assembly ‘Gadgeteer’ (2.41.0.0)
Assembly: GTM.Seeed.CellularRadio (1.0.0.0) needs assembly ‘Microsoft.SPOT.Graphics’ (4.1.2821.0)
Assembly: GTM.Seeed.CellularRadio (1.0.0.0) needs assembly ‘Microsoft.SPOT.Native’ (4.1.2821.0)

@ Mike - I downloaded code from http://gadgeteer.codeplex.com/SourceControl/changeset/view/24955
The cellular radio project is part of it. But I cannot find build for 4.2, it’s only for 4.1. What i’m missing here?

you’re probably not missing anything; the code hasn’t been updated for 4.2. Seeed seem to have dropped updating their drivers, and GHI have taken that over, but aren’t necessarily keeping everything up to date in that location all the time - they do the updates and push them periodically when they can.

Why don’t you update it for 4.2 yourself - if you only need to resolve the serial port issues that should be relatively straight forward; track down where the new port definition is.

I’ll try, thanks

@ tvinko, this looks like a bug - I’ll look into it asap.

Please also get the latest code from https://tcpcellularradio.codeplex.com/ - the codeshare site is out of date.

@ Brett, note that the Gadgeteer drivers will not work for TCP data, ever :slight_smile:

@ Byron - I downloaded code an replace:

#region CHECK TCP CONNECT RESULT
            if (response.IndexOf("CONNECT") > 0)
            {
                _isTcpConnectionAtResultReceived = true;
                _tcpConnectResultSuccess = true;
            }
            if (response.IndexOf("ERROR") > 0)
            {
                _isTcpConnectionAtResultReceived = true;
                _tcpConnectResultSuccess = false;
            }
            #endregion

with


 #region CHECK TCP CONNECT RESULT
            if (response.IndexOf("TCP CLOSED") > 0 && response.IndexOf("CONNECT FAIL") > 0)
			{
                _isTcpConnectionAtResultReceived = true;
                _tcpConnectResultSuccess = false;
            }
            else if (response.IndexOf("AT+CIPSTART") > 0 && response.IndexOf("OK") > 0)
            {
                _isTcpConnectionAtResultReceived = true;
                _tcpConnectResultSuccess = true;
            }
			#endregion


Anyway, thanks for resolving TCP bug in original driver.

Can you please try:


 #region CHECK TCP CONNECT RESULT
if (	response.IndexOf("CONNECT OK") > 0 ||
	response.IndexOf("ALREADY CONNECT") > 0)
{
	_isTcpConnectionAtResultReceived = true;
	_tcpConnectResultSuccess = true;
}
else if (response.IndexOf("CONNECT FAIL") > 0 ||
         response.IndexOf("CME ERROR") > 0)
{
	_isTcpConnectionAtResultReceived = true;
	_tcpConnectResultSuccess = false;
}
 #endregion

Let me know how you go, I’ll be pushing some other changes to the codeplex project before the end of the year and if this works I’ll include it.

Thanks for quick fix. I’m currently without spider board, i’ll try by end of the week.
As far as I can remember, the response was :

CellularRadio : SENT: AT+CIPSTART=“TCP”,“xxx.xxx.xxx.xxx”,yyyy

CellularRadio : <AT+CIPSTART=“TCP”,“xxx.xxx.xxx.xxx”,yyyy

OK

CellularRadio : <
STATE: TCP CLOSED

CONNECT FAIL

Does “CONNECT” needs to be replaced with “CONNECT FAIL”? I’m also confused, because first response from “AT+CIPSTART” was “OK”. Then after some time it came response “STATE:TCP CLOSED CONNECT FAIL”, so index of “AT+CIPSTART” >, might fail, because it’s not sended along with TCP CLOSED message

True, I’ll edit my reply - done