RTU Slave 2.0.3 modbus_listen issue

Asked by akuma84

I am working in a device with master and slave capabilities. Basically I use the master to query some sensors (like 100), and then using shared memory I pass this info to the slave part, which waits to be polled by another device.
The problem is I am having big delays. The slave part is being polled every 10 seconds, because if I poll it more quickly, I won't answer in time. For example, if I poll it at 5 seconds, External Master polls, slave answer in 2 secs, external master polls, slave answer in 3 secs, external master polls, slaves answer in 4 secs, external master polls, external master polls, slave answer, external master polls, external master polls, external master polls.. slave answer... well you get the point.
With 10 seconds I don't have this problem however it's quite quite slow, I am just sending one query with a 50 bytes answer.
First I thought it was because I wasn't correctly synchronizing the shared memory part, however, when I start debugging the problem, I notice that the function "modbus_listen" will absorb most of the time. I mean, sometimes it answer in 10 seconds, sometimes in 15, sometimes in a minute.
I am using RTU.. I didn't find some function specifically for RTU, so the line is

"ret = modbus_listen(&mb_param,query,&query_size);"

I am still using 2.0.3 because I started the code with that library and all the other parts are well working, but if the issue is in actually using the 2.1.0 I will change. Or if you have any other idea of what ca be wrong? Or maybe it is not the correct use of the function.
I am using TS-7400 board, with a ARM EP9302 @200Mhz, with 32 RAM, Linux Debian 2.6.29 kernel.
Regards,
Enrique

Question information

Language:
English Edit question
Status:
Answered
For:
libmodbus Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
akuma84 (akuma84) said :
#1

I forget to mention I am using two RS-485 cables. One for the master part, one for the slave part.

Revision history for this message
Launchpad Janitor (janitor) said :
#2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
akuma84 (akuma84) said :
#3

Sorry, it was my problem. The line was actually okey, but I have some trouble with shared memories.
Now I am polling really quick.
Thanks.

Revision history for this message
akuma84 (akuma84) said :
#4

Sorry, it was my problem. The line was actually okey, but I have some trouble with shared memories.
Now I am polling really quick.
Thanks.

Revision history for this message
Stéphane Raimbault (sra) said :
#5

I really need testers for a major change I've applied to the last version of libmodbus for slaves:

https://github.com/stephane/libmodbus/commit/c1e2e0b319b1f1fbbd663b2322162278bd48e4f5

So please, download the last version and test it:

https://github.com/stephane/libmodbus/zipball/master

Can you help with this problem?

Provide an answer of your own, or ask akuma84 for more information if necessary.

To post a message you must log in.