Any guide to get started on the PLS62 and JAVA | Telit Cinterion IoT Developer Community
February 8, 2021 - 5:00am, 5755 views
Hello,
Is there a guide on how to set up a "***** world" project in JAVA and "debug it" ?
I have installed the Gemalto SDK, JDSK 1.7.0 and 1.8.0 as required and picked Netbeans because I had issues with Eclipse not finding the JRE (error on start up). I have the Gemalto Module Manager running. Installed it on Win10x64.
Form Netbeans, what are the steps I need to configure the IDE to work with the PLS62 Terminal. The JAVA code when debugging is loaded into the module by the NEtBeans ide ?
Please forgive me is this question sound basic or I look a bit lost, until now I have been working on microcontroller IDE's, in C and C++, were you can look up your dev board or your programmer and microcontroller. This IDEs were tailored to the HW. Is the Netbeans IDE that the Gemalto SDK installed already set up to work with PLS62 terminals ?.
I read some guides but none of them shown how the basic setups is done (if any).
I have read that I need to add som plug ins through the NetBeans ide.
As I said, I just need some basic directions, just a bit of a push for one guy that is starting here :)
My application will read data from a serial device and send it to a known IP and port. Also must allow configuration of parameters via SMS. Until now I was running an init script manually (batch of AT commands). I was planing to program a microcontroller to do this, then I was told that I can use the JAVA on the PLS62 to do all of this and more, not need of an external host processor
Any help would be really appreciated !!!!
Pedro.
Hello,
It could be MES. But it is also possible to use a terminal program or script - there are AT commands usable to upload files to the module - please see AT^SJDL (simple and enough to upload a file) or AT^SFSA (more powerful).
Regards,
Bartłomiej
I got my pretty basic Java app working nicely =) .
Today I was given 2 chips from the customer that got FIXED IPs and belongs to their private APN.
.... now Im having trouble with these.
When I issue AT+COPS ... the app stalls.
Using the console on any of the serial port some***** it wont come back with an answer. I need to hit enter a couple of ***** ... finally got ERROR as a response. After repeating it, I got an OK (just by copying the entire command on the terminal and pressing Enter ... I mean, it wasnt a typo).
The command STARTS with AT and end with \r as pointed in previous threads.
Here is the actual code line:
System.out.println(miAT.send("AT+COPS=0,0,\"AR PERSONAL\",2\r"));
I need to turn my app into a server (the modem most listen for a client an accept it).
ServerSocketConnection blocks the code without any other output. It wont complain about the modem not being registered (I realized later ... my code was like toooo basic.).
What should be the basic checking ?. Can I make them through JAVA objects / methods or I need to use ATCommand class ?.
I have seen that Java allows to quit from a blocking function after certain time if I calle SetSoTimeout previously .... but I dont see this on the documentation (probably is not fro java 2 me ?).
Yes, Im trying to avoid multithreading =).
I didnt open a thread (in the forum) since the doubts are miscellaneous but I will if needed by the mods.
Many thanks.
Pedro.
Hello,
AT+COPS=0 triggers the automatic network registration. To select the operator manually you need to use mode 1 and then it makes sense to add the rest of parameters.
This command may return error sometimes - the module may be busy with network operations an may reject the command execution. And the execution may also take some time depending on the network, signal quality etc. By hitting Enter you in fact breaks this command execution and get error immediately.
acceptAndOpen() method blocks until the incoming connection is received. There is no timer option. You need another thread.
Connector.open() should throw an exception if the data connection cannot be established. You would normally see something like 'Profile could not be activated'.
To monitor the data bearer state, for debug purposes for example, you can also use com.cinterion.io.BearerControl class and setup a listener.
For Java you need to configure at least the bearer type and APN User and password if necessary (for private APN it is most probably required). You may pass it to the Connector.open() method by adding it to the connection string, for example ";bearer_type=gprs;access_point=internet". Please see javax.microedition.io.SocketConnection in the API for more.
Your application should at least be able to verify the SIM and PIN status and network registration. You need AT commands for this.
We can keep this discussion here in this thread.
Regards,
Bartłomiej
Thanks you so much Bartlomiej.
I think I got around using one of the examples suppled that used the ATCommand class but send command in non-blocking fashion using a listener for the response.
I will correct my COPS command and try if it goes more smothly.
And I will check the points you made above.
Yes, Im passing the APN/USR/PASS during the Conector.Open (casted to SocketConnection)
What Im missing or is UNCLEAR to me is: what this command covers and does not cover
For example, does it cover AT+COPS / AT+CGDCONT /AT+SICA /AT-CGPADDR/ AT+SISS (several commands). I mean, a single call would be like doing al this configuration manually on a terminal ?.
For my basic demo client, whit the chip I have been using all this time, just the Conector.open with APN+USR+PASS+IP+PORT was enough to get it up and running. Not sure if it worked because it is ok, or some of my setting got latched in the modem when I was testing it with AT commands.
When I tried to turned the app into a server with this SIM chips with FIXED IP from a private pool, I think I started to suffer some issues. I haven tested the final result because I need the customer help me on their side.
But tried to do as much test on my side as possible before starting to bother the customer ...... by checking with AT commands (while the MIDlet was running) I discovered that sometimes it got its IP, sometimes the IP vas 0.0.0.0. Sometimes AT+CREG had a failure code. Also, the ORANGE LED keep blinking for really long while in my previous app with the previous chip the blink goes out very fast after booting up
So I started to use AT commands inside the JAVA APP and add more checks. ServerSocketConnection doenst no put any message nor exepection like SocketConnection does. Of course, SocketConnection will eventually timeout ... and ServerSocketConnection should never timeout ?.
Many thanks and have a nice Weekend !!!!
Hello,
For Java connection with AT commands you only need to ensure that the module is registered to the network. You don't need to set APN with CGDCONT command. You may only check if there are free entries because Java may need to cerate one entry automatically.
All the rest is done with Java API (alternatively you may use AT^SJNET command).
For PLS62-W you can also optionally specify the CID which should be used for Java app and context reuse option. The context can be shared with IP services used over AT commands.
For data connection monitoring you can use BearerControl class.
As for the server on the module you need to ensure if the provider allows this (if the incoming connections will not be blocked). In case of a private address you of course will not be able to connect to it from the public Internet (only from the provider network if allowed by the provider).
You may need to monitor the network connection and signal quality parameters if you experience issues with the network or data connection. If the signal is weak there may be problems with data transfers or even network registration. In such a case BearerControlListener is also a good idea for debug.
acceptAndOpen() should never timeout but there might be an exception thrown. You need another thread to close this connection if necessary.
Regards,
Bartłomiej
Hello
Im experimenting the following issue issue:
I opened a ServerSocket connection and wait for any incoming connection. The modem has registered succesfully, prints its local IP ... fine. The application it is supposed to wait for a connection ....
After some time .. suddenly I got :
IOError in serversocket::accept = -134, Network is down.
My app is kinda of endless loopm if it goes out because an exception it tries to rester after 10 minutes. This includes de registration.
After 10 minutes;
The PLS62W is able to register fine (the message "REGISTRACION EXITOSA" confirms that)
But then get and IOError Socket unknown: 10200. So, the modem is registered with cannot put it to listen anymore. Of course it works if I power cycle it.
REISTRACION EXITOSA !
2NetDemo: IOError in serversocket::open = 10200, Unknown
I tried to lookup for this code but 10200 is a generic code that provides no further info.
What could be wrong ?.
Many thanks
Pedro.
Best Regards,
Pedro.
I'm behind a clue ... I guess this path of the code is not closing the SocketServer conector ....
I will let you know. =).
It is a bit complicated because didnt got the debuger working so Im debbuging my app more in "detective mode" reading the code and every path. Fortunately this is not my first time doing that. Prints help a lot, but they are hurt by blocking calls like ServerSocket.Accept ... I still need to add you suggestions on checking the status of the network.
Regards,
Pedro
Hello,
It seems like there is a problem with a network. 'Network is down' suggests that the module is not registered. So additional monitoring and checking the status in case of such an exception would probably be helpful here.
As for the second error at the moment I also don't know the meaning of it - 'Unknown' suggests that it is some general error, not any specific one. But your suspicions might be correct - you should make sure that your code clears everything in case of an exception, so 'try catch' block with 'finally' should help to make sure that the socket is closed properly.
In case the socket can't be reopened immediately it may also be a case that some time may be necessary for JVM to perform garbage collection.
Regards,
Bartłomiej
Hello !!!
First some news: we were able to handle the first prototype to our customer and it is working fine on the field. It was all made in Java with the PLS62 LTE Terminal.
We have the OK from our customer to proceed with the production design, but due to lead time issue, PLS62 is not the best option. Our Thales representative is able to deliver the PLS63w with good lead time at a similar cost.
The reason Im writting this post is, the PLS63 solution will be AT COMMAND based, (not java).
I have done some testing with AT commands and the PLS62w and I got registered and internet conectivity etc. Still not sure if Im missing things, since the AT reference is huge and Im not very experienced
Would you mind my to put the "minimal" AT commands to get a module from COLDSTART to a TCP LISTENING SERVER that will manage ONE connection at a time.
For example. I put a list together for a basic TCP CLIENT using transparent mode (see at the end).
For server I dont think it will be much different. BUT Im really WORRIED on missing important things, setting or controls just because it worked.
We want to deliver a robust final solution to our customer.
Another question is that since we need to monitor the health status of the connection, network registration, deal with loss of conectivity etc .... Ithink transparent mode wont work for me. So what would be the approach here ?
And the most important is how I can detect a socket has been closed by the remote peer. In java this gave me headakes, I ended solving it with timeouts and closing the connection after 10 seconds of inactivity.
Im sorry for the long post with many request. I have read th AT reference. Not completely but many of the commands. I dont have issues putting that into a microcontroller and do it work. Im worried about missing important commands or not doing thing robust enough. The end customer is a power utility and once the equipment is commissioned on the field, working on it to fix or patch things get really expensive. So we need to (as much as we can) "do it right the first time".
Many thanks !!!!!!!!!
NOTE (basic command set for transparent client)
AT+IPR=19200 // Cambiar Baudrate a 19200 (default 115200)
// Cambiar terminal a 19200
AT+COPS=1,2,"72234" // Elije como operadora a Personal, ID=72234
// AT+CAPS: Agrenganco ,7 busca LTE
AT+CGDCONT=1,"IP","datos.personal.com" // Contexto PDP, setea APN
// CON ESTE COMANDO CONFIGURO USR Y PASS EN LA APN
// AT^SGAUTH
AT^SICA=1,1 // Activar el conexto
AT+CGPADDR=1 // Obtener IP
AT^SISS=1,srvType,"Socket" // Perfil 1, Tipo de Conexion
AT^SISS=1,conId,1 // Perfil 1, contexto PDP asociado
AT^SISS=1,address,"socktcp://190.191.111.180:11000;etx" // Cliente se conectara a 190.191.111.180, puerto 11000, en modo TRANSPARENTE
AT^SISO=1 // Activar el Perfil 1
at^sist=1 // Abrir Conexion Transparente
.......
........
+++ // Sin echo, vuelve a la linea de comandos
AT^SISC=1 // Cerrar la conexion
Hi Pedro,
Firstly let me confirm which module you will be using: is it PLS62-W or PLS63-W? Those are two entirely different modules so let us clarify this.
Fortunately, AT command sequence for configuration of TCP listener service will be similar on both of those modules:
AT^SISS=<id>,srvType,"Socket"
AT^SISS=<id>,address,"socktcp://listener:<local_port>"
AT^SISS=<id>,srvType,"Socket"
AT^SISS=<id>,address,"socktcp://listener:<local_port>;etx"
Till this point no additional AT commands are required to be added as compared to TCP client service but it's important to have AT^SCFG="Tcp/WithURCs","on" enabled so that URCs can be used to steer your application's control flow. What changes is management after the listener service is opened and ready, what is indicated by ^SIS: <id>,5 URC:
As for your question regarding transparent service being used together with network monitoring, it actually depends on the fact if your application can utilize more than one AT interface. The best solution would be if your application had access to two module interfaces, e.g. USB interface enumerates at least two ports that support AT commands on both PLS62-W and PLS63-W modules. In such setup you could use one port for network management while data could be exchanged through transparent mode on the second port.
In case you application has access to one port only, then you could either exchange data via AT^SISR/AT^SISW commands (with lower maximal throughput compared to transparent mode) or you could switch in your application between AT command mode and transparent mode (which would allow higher throughput at the cost of having more complex control flow in your application).
As for you last question, if your module has AT^SCFG="Tcp/WithURCs","on" enabled you will get notified when the socket connection gets closed by the peer via ^SIS: <serviceId>,0,48,"Remote peer has closed the connection" URC. We also recommend to monitor the status of your internet service, e.g. with AT^SISI=<serviceId> command, if you'd like to implement even more robustness in your application.
BR,
Ida