BGS5T serial communication issues | Telit Cinterion IoT Developer Community
January 20, 2015 - 12:26am, 9721 views
I've written TCP/IP to serial modbus protocol 'gateway' for BGS5T module, but cannot get it completelly working due to serial communication. My setup:
BGS5T modem, power saving disabled, Userware/Stdout set to null, using this connection string:
"comm:COM0;baudrate=9600;parity=none;blocking=off;autocts=off;autorts=off" (tried many other variants as well, including stopbits, databits, ... etc.)
- BGS5 connected trough serial<-> usb converter cable to pc;
- Modbus simulator runs on the pc, opened serial port for communication, I have some simulated data entered in it
Result: everything's just fine. I can get those simulated values from serial port and send it back as a modbus TCP response to connected client via BGS5.
2) I have two different PLCs (twido and unitronics jazz). If I connect those directly to the same rs232<->usb cable to the same PC (same rs232 params as defined above in connection string) on serial port and scan the values from them (using 03 modbus function etc.) everyting's also just fine.
Now important part: both PLCs are DCE devices (have female serial port/cable) also the BGS5T is DCE/female device. So, connecting BGS5 to PLC requires "gender changer" / null modem converter. I have original converter especially used for that, and also bought DB9:male<=>DB9:male cable.
Problem: Whatever I use, I cannot get any PLC to respond to serial data sent to it. I am 100% guaranteed that data is sent (connected to terminal and got the exact HEX values I am expecting). Tried male/male converter, cable, also I've cut and rewired the cable Rx/Tx (made it crossed). Nothing works.
Question: Are there any rules I should fulfill using serial port (RTS/DTS signals etc.), or maybe you have any insights/suggestions. Any special wiring must be fullfilled (f.e. null modem cannot be used for some reasons)? I would really appreciate it. It's 3rd day I cannot sleep anymore... :)
I was trying to connect 1wire temperature sensor to BGS5t torugh RS232 and it was working only after I used null modem cabel. So if you have allready tryed this and crossed the wires, I don't know what else you could try.
Is it possible to connect to ASC0 interface from PC and issue AT commands to the module?
Please provide AT^SCFG? and AT^SPOW? output. But I suppose this is not the issue here.
As I understand the data is sent to the PLC but it does not reply for some reason.
I can see that your devices are using DTR and DSR lines and no RTS/CTS.
There is CommConnectionControlLines and CommConnectionControlLinesListener interfaces in the API - you could experiment with it to see the DTR line changes and set DSR line.
Maybe experimenting with using RTS/CTS lines of the module instead of DTR/DSR would be worth trying.
Thanks for reply!
>> "Is it possible to connect to ASC0 interface from PC and issue AT commands to the module?"
Yes, it is. ASC0 and USB ports can be used for AT commands. Did not try ASC1 though.
>> "Please provide AT^SCFG? and AT^SPOW? output. But I suppose this is not the issue here."
Power saving is disabled for ports, (1,0,0 if I remember correctly). Anyways, I'll post the data very soon.
>> "As I understand the data is sent to the PLC but it does not reply for some reason."
Correct, I can verify that data is sent by connecting Modem to PC serial port, and listening to the incoming traffic. Modbus message is sent out from modem serial port correctly formatted, with valid CRC etc.
>> "I can see that your devices are using DTR and DSR lines and no RTS/CTS."
Unfortunatelly, I have no idea here... I know very little knowledge about usage of DTR, DSR, RTS and CTS (almost none). Why do you say/how do you know, that I'm using DTR and DSR? From connection string?
>> "There is CommConnectionControlLines ... "
Thanks a lot for the hint, I'll take a look on that. But I don't have a slightest idea (yet) how to use it. Could you point me out key concepts of using DTR DSR signals in this context?
>> "Maybe experimenting with using RTS/CTS lines of the module instead of DTR/DSR would be worth trying."
I would definitelly check that, but as I mentioned, I have no slightest idea how to do that. Any hints/ samples/... would be highly appreciated...
Have you managed to solve the problem?
You use ;autocts=off;autorts=off in the connection string so my conclusion was that you are not using RTS/CTS flow control.
I suggested a test with connecting RTS/CTS (;autocts=on;autorts=on) lines instead of DTR/DSR because I understood that you are using DTR/DSR without success. Or staying with DTR/DSR but trying to manually set DSR line using CommConnectionControlLines to check if the other party will be able to receive the data and reply then.
I'm also not RS232 expert but generally there are two type of devices DTE (PC or your PLC's) and DCE (modem, wireless module). DTE uses RTS line to indicate that it's ready to receive data. DTE uses CTS line for the same.DTR/DSR lines means device presence. DTR meaning can be similar to RTS for DTE. DSR is used by DCE. The problem is that it may not be true for all devices. Also not all lines are used by all devices.
It would be good to know what lines the PLC devices are using to connect properly. And to try some tricks with lines changing or connecting together in case of problems. For example the PLC may not be transmitting because CTS or DSR line of the module is not high. If that would be true the solution could be to force that line high.
A little bit late, but I also started developing application with MODBUS application. I had same problem like COOLERIV, where sent message over RS232 was correc but I didn't get any response.
In the end I managed to establish working MODBUS with settings like this:
String strCOM = "comm:COM0;blocking=off;baudrate=9600;autocts=on;autorts=on";
affter sent msg I have Thread.sleep(300);
before sending new msg I have: Thread.sleep(2000);
Those two values could probably be quite smaller, but you will have to test that for your self.
I'm having a similar issue with the RS232Demo.
I have a USB to serial converter connected to BGST5 and an extension, to connect the device port to my pc. I'm using Hyperterminal to send simple inputs and I should get them in my Netbeans console.
Even more strange, I managed to receive data a few hours ago but as soon as I ran another programm and tried to run the demo again, it stopped receiving data.
Here's my code:
I think I have the right configuration but still I don't get any data when I run the program.
Can someone lend me some help?
Edit: Yes, I tried switching all the parameters on and off haha.
Please check if you are able to execute AT commands on ASC0 when the MIDlet is not running.
What other program have you run - does it change any configuration?
The RS232Demo program is using the hardware flow control and you should also use RTS/CTS flow control on the PC terminal program. In case of BGS5T (module in the terminal) you should be using the RTS/CTS flow control. Please paste AT^SCFG? and AT^SPOW? outputs.
Just to be sure, the COM i should send my ATCommands is the one where I have connected the gemalto USB port right?
Here i have the config between the port and my serial monitor
I don't get any activity when I send the ATCommands.
PS: I apologize for my lack of knowledge but I'm working with a GSM ****m for the first time haha
Many thanks for your answer.
For BGS5 you can use the RS232 port which you can most probably access via COM1 on your PC and USB ports: one you will find under modems in device manager and another one under ports. There is also the second serial interface. Depending on the configuration ("Serial/Interface/Allocation" parameter of AT^SCFG command) not all may be usable for AT commands. Please close the USB connections to the module on PC while rebooting the module because the USB may not enumerate.
I'm not sure I understood what you mean.
In the picture above you can see what i get in both ports and their configuration.
When I use the port connected to the USB to Serial adapter i get an Echo of the input. When I transmit to the port of the BGS5, I simply don't get an answer.