EHS5 blocking on connect | Thales IoT Developer Community
January 5, 2017 - 4:23pm, 4072 views
Hi,
the problem is thats the code:
(SocketConnection) Connector.open( connectString )
blocks the complete application during open the connection, all Threads, not just the current thread. Is this correct?
ATI1 says:
Cinterion
EHS5-E
Revision 03.001
A-Revision 00.000.42
Can you help me?
Andreas Voigt
Hello,
Can you write some more details: what else is the application doing, how frequently are you able to reproduce it etc.?
This should not happen. We had some reports only that the connection thread may hang in case there is no reply from the server. But it can happen inside getResponseCode() method or on opening the streams if getResponseCode() is not called. Are there other threads in the application that do not depend on the connection thread? How about the AT commands - is it possible to sent commands to the module when that happens?
Regards,
Bartłomiej
Hello Bartłomiej,
basically i have 2 threads:
---------------------
First thread test connect permanently:
while ( true )
{
try
{
String conString = "socket://a.b.c.d:1234;bearer_type=gprs;access_point=internet.t-mobile;dns=0.0.0.0;username=t-mobile;password=tm";
log ( "ConTo: " + conString );
this.connection = (SocketConnection) Connector.open( conString );
this.connection.setSocketOption( SocketConnection.LINGER, 5 );
}
catch ( Exception e )
{
e.printStackTrace();
}
try
{
Thread.sleep( 5000 );
this.connection.close();
}
catch ( Exception e )
{
e.printStackTrace();
}
}
---------------------
Second thread logging permanently:
int i = 0;
while ( true )
{
i++;
log( "" + i );
try
{
Thread.sleep( 500 );
}
catch ( InterruptedException e )
{
e.printStackTrace();
}
}
---------------------
If a simcard inserted and the modem has gprs, the first thread make a connection every 5 seconds, close that ... The seconds thread print every 500ms a logging message to system.out.... Working and do what you want.
If i remove the simcard and the connection can not be established, the second thread blocking in the period the first thread try to connect.
Regards
Andreas
Hello,
So the connection hanging is caused by the SIM card removal. Could you also paste some logs for his scenario? What happens if you insert the cad again?
The problem that I have described was for http connection (I didn't notice that you are using just the socket).
What hardware are you using for these test? Is it some developer board or your propriety hardware? I'm asking because according to the HW documentation if the SIM card is going to be removed and placed back according to the customer scenario there should be the CCIN line used in the SIM interface so that the module could properly detect when the the SIM card is placed in the SIM holder.
Regards,
Bartłomiej
Hi Bartłomiej,
we using the ABox A11 from aplicom. Aplicom write me today:
"This is under investigation by Gemalto, so the complete fix for this is behind them and it may take some time when have the fix."
Until then, we using a workaround from aplicom thats check the GSM state before connecting.
Regards
Andreas
OK, so in such case we should wait until this is solved and use the workaround till then.
As I understand the new information this problem occurs only when there is no connection to the network at the moment when the Connector.open() is called. Such workaround is in fact a good practice to check the network state at least on application start.
Best regards,
Bartłomiej
I can confirm the very same issue observed in my project. Is there any update available? Firmware update?
Yes it's available. Please see here: https://iot-developer.thalesgroup.com/threads/ehs5-latest-firmware-version
***** sir,
i am first time on working EHS5-E module, one uart (Rx &Tx) port is running in this but another is not uart port is not running and sim card detection also not happening. plz suggest the reason
Hello,
The module has two RS232 interfaces. However in the default setting the second interface is not active. Please see AT^SCFG="Serial/Interface/Allocation" in the AT commands specification for more details about interfaces allocation. Please also note that for serial interfaces some lines are shared with other interfaces. This can be configured with AT^SCFG command. To get ASC1 working you need to set AT^SCFG="Gpio/****/ASC1","std". There is also one thing that affects both serial interfaces - AT^SPOW command that configures sleep ****s on UART interfaces - which by deault is active.
As for the SIM card - there is a CCIN line which is responsible for the SIM card detection (CCIN = High, SIM card inserted). You have to use this line if the device should support inserting or replacing the SIM during the operation. If not the line should be kept open. But then the SIM card will not be detected if inserted after power-up.
You can check the SIM card status with AT+CPIN? command. Please set AT+CMEE=2 before to get more information in case of error reply.
Best regards,
Bartłomiej