Store PLCnext CommunityPLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. thekrel
  2. PLCnext Engineer
  3. Monday, 08 April 2019

Hello,

I am working on a serial communication project utilizing the RS UNI - 2688666 module. I am programming using PLCnext Engineer 2019.0 LTS HF1 (Build 3.13.533.0), PLC firmware 2019.3 (19.3.0.18509) and the AXL Comm Serial 4 function block.

I am reading a Garmin 19x HVS GPS. The GPS transmits in the NMEA 0183 standard over RS-422. I am configured at 38.4 Kbaud 8n1, with the GPS sending an update every 200ms. I am using the end-to-end format with CR and LF as my delimiters. It works, I can read position, heading and speed.  My issue is that the receive buffer is constantly over-flowing and causing an axio bus error. I utilize the NDR output from the control function block to re-trigger the read command. I am only reading 75 bytes/characters. The GPS is a "talker" it does not need to be prompted to transmit nor does it need handshaking with the listener.

Is there a better way to read the data and avoid the buffer overflow? All of the sentences begin with $,G and end with CR,LF.

 

Thank you,

Josh

Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi Josh,

What is the cycle time of the program that is calling the Comm Serial function block?

The reason is, the Serial module has a reasonably large input buffer, but it can only transmit this input data to the CPU in 17 byte chunks (see the manual for details - it has 20 bytes of process data in each direction, but 3 of these are for commands).

So a 75 byte message will take at least 5 scan cycles to transfer, and maybe a few more scan cycles between messages. So if your task cycle time is more than about 40 ms, then you're cutting it fine, and at 50ms you can expect the input buffer to fill up.

If you don't need such a fast cycle time for the rest of your program, you could put your GPS reader in a separate task with a fast cycle, even on a separate CPU core (ESM) if you want, and transfer the data to your other program instance(s) via Ports or global variables.

===================================

EDIT: You will also need to make sure that the Axioline I/O is being updated at the faster rate. By default the Axioline I/O is updated every 50ms, which means the input buffer in the Serial module will fill up regardless of how fast your program is running. You can tie the update of the Axioline I/O to a specific ESM task in the Controller Settings page - in this case, it should be the (fast) task that is calling your Com Serial function block.

===================================

Hope this helps.

Martin.

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support
  1. more than a month ago
  2. PLCnext Engineer
  3. # 1
thekrel Accepted Answer Pending Moderation
0
Votes
Undo

Thank you so much Martin. The cycle time was the problem. I moved the GPS read function to its own Cyclic task set to 25ms. I am no longer getting bus over-flow errors! I read through the manual in regards to the buffer size and I am curious as to why it is only 17+3 bytes. Is this a limitation of the Axio bus? Thank you for your help.

  1. more than a month ago
  2. PLCnext Engineer
  3. # 2
Martin PLCnext Team Accepted Answer Pending Moderation
1
Votes
Undo

Great, glad to hear.

To answer your question - each Axioline I/O module has a defined set of "Process Data" that is detailed in the user manual for that device. This is the data that is transferred between the CPU and the module on each I/O cycle. Every cycle, a maximum of 512 bytes can be transferred between the CPU and all the I/O modules on the local Axioline bus. I guess that, in theory, one module could define 512 bytes of process data, but then it could not be used with any other I/O modules on a local bus. Most types of I/O modules, the ones that deal with digital and analog I/O, can transfer all their data in just a few bytes, but for comms modules like the one you're using, it's a trade-off between transferring large amounts of data each I/O cycle, and leaving enough room on the bus for other modules.

For very demanding applications, or where you have multiple serial devices, you could process the serial data in an external module, something like the one below (which comes in variants with up to 4 serial ports), and transmit the data to the PLC over Ethernet.

85333 1000 int 01

GW DEVICE SERVER 1E/1DB9 - 2702758

http://phoenixcontact.net/product/2702758

 

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support
  1. more than a month ago
  2. PLCnext Engineer
  3. # 3
rizky Accepted Answer Pending Moderation
0
Votes
Undo
Hi Martin,
Can I use AXL SE RS485 to read data from GPS?
Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo
Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.