Page 1 of 1

Modbus master component Time out response

Posted: Wed Apr 27, 2016 12:49 pm
by tello
Good morning guys again.
I implemented the modbus component in my project.
I have a Modbus slave emulator for testing. the emulator receives the query and responds but the teacher always gets time out.
Someone has made some example to understand my mistake?

Thank you

Re: Modbus master component Time out response

Posted: Wed Apr 27, 2016 3:45 pm
by Benj
Hello,

Please can you attach the Flowcode file and we will investigate for you.

Re: Modbus master component Time out response

Posted: Wed Apr 27, 2016 5:56 pm
by EtsDriver
Hi!
Hard to say, but if this is your main loop: seems like youre missing the modbus master initialize function.

Re: Modbus master component Time out response

Posted: Thu Apr 28, 2016 12:34 pm
by tello
Hi guys.
Attached the program modbus master file.
In the Main routine, I Initialize including Modbus Master.
I found out a curious thing, when sending only a register (PresetSingleRegister) responds sending me the same thing.
When I'm sending four registers (PresetMultipleRegisters) responds with an error "03 = Illegal Data Value. A value Contained in the query data field is not an
allowable value for server (or slave). This
Indicates a fault in the structure of the remainder
of a complex request, the implied Such As That
length is incorrect. It does NOT mean Specifically
That a data item in a storage Submitted for register
has a value outside the expectation of the
application program, since the MODBUS protocol
is unaware of the significance of any individual
value of any special register ".

Why does this happen?? are the same records with the same structure.

I have also the problem that the pic does not recognize the slave response and delivery time out error.

Benj take the opportunity to ask, when we have the new component Modbus Slave ??

Thank you so much

Re: Modbus master component Time out response

Posted: Thu Apr 28, 2016 8:51 pm
by EtsDriver
Changed your flowchart to modbus ascii and captured message:
First sending the "ARRAY[0]" and then the whole array... (Putty output on the right-->)
fc6_mb_Ascii.JPG
(50.1 KiB) Downloaded 2571 times
Compared to MBpoll the Flowcode seems to send it differently? Heres mbpoll sending only one:
mbp1.JPG
mbp1.JPG (73.04 KiB) Viewed 14019 times
Here im sending using mbpoll software the value 65535 over my "loopback" com adapters, to see what ASCII comes out. Settings are Modbus ASCII over serial, ID 1, function 16 - write multiple registers, start address 1, quantity 4.

And here we send multiple:
mbpoll multiregisters.JPG
mbpoll multiregisters.JPG (68.2 KiB) Viewed 14019 times
Any ideas/traces to the problem here Matrix team?

I tried deconstructing the messages the MB master component sends...

Code: Select all

:01 10 0001 0004 PP PPPP PPPP PPPP PPP2
01 SLAVEID
10 PRESET MULTIREGISTER (FC16)
0001 START ADDRESS
0004 REGISTERS TO WRITE
PP NUMBER OF DATABYTES TO FOLLOW

PPPP VALUE FOR 0X0001 
PPPP VALUE FOR 0X0002
PPPP VALUE FOR 0X0003
PPP2 VALUE FOR 0X0004
     CRC MISSING
	 
:01 06 0001 PPPP PK

01 SLAVEID
06 PRESET SINGLE REGISTER (FC6)
0001 DATA ADDRESS OF THE REGISTER (+40001 OFFSET), WILL WRITE REGISTER 40002
PPPP THE VALUE TO WRITE
PK CRC VALUE
It might be that the FC16 is just missing the number of data bytes to follow, and thats why the slave is not answering anything (as the message is "seemingly" missing CRC/or is too short)?

helpful page to understand modbus bit easier :)

Re: Modbus master component Time out response

Posted: Fri Apr 29, 2016 9:32 am
by tello
Thank you.
I understand the plot of sending Flowcode FC16 and you are right, not the data "number of records" I think it's a component failure.
In this case it must be repaired to be used.

I do not understand because I have TimeOut failure in PresetSingleRegister when this frame is correct.

Thanks once again

Re: Modbus master component Time out response

Posted: Tue May 03, 2016 9:34 am
by tello
Good morning Benj
I wonder if it is possible to repair the component block Modbus master "Presetmultipleregisters" is very important for my project.
Not because I find fault with it modbus Timeout response.

Thank you

Re: Modbus master component Time out response

Posted: Wed May 04, 2016 9:37 am
by tello
Hi guys.
I still have the problem of fault block time out modbus master, someone knows where you can set the time of failure time out ??
Thank you

Re: Modbus master component Time out response

Posted: Wed May 04, 2016 11:31 am
by Benj
Hello,

You are right it seems the byte count was missing from the PresetMultipleRegisters command.

The attached component should hopefully fix this. Simply drop the component into your "Flowcode 6/Components" directory before starting Flowcode for the changes to be loaded.
Modbus.fcpx
(16.61 KiB) Downloaded 343 times
The Modbus slave component does need finishing, I just need some time to have a good run at it, hopefully soon.

Re: Modbus master component Time out response

Posted: Wed May 04, 2016 2:11 pm
by tello
Hi Benj.
thank you very very much.
Well now send data to Modbus slave and the slave responds ok.
there is one thing I do not understand. When the master sends the data block and the slave responds, the block is stopped for 2,474s, what is the reason ??
With this pause my program is very very slow.
when it receives the response from the slave should immediately move to the next block, if no response is received then you must wait for the time out.

You know it makes that pause ??

Thanks

Re: Modbus master component Time out response

Posted: Wed May 04, 2016 5:08 pm
by Benj
Hello,

It looks like the receive may be waiting even after the reply is received for some reason. I've re-structured the receive code to try and get the code to return as soon as there is a time out and also dropped the reply time out from 250ms to 120ms.
Modbus.fcpx
(16.63 KiB) Downloaded 300 times
Let me know how your getting on.

Re: Modbus master component Time out response

Posted: Fri May 06, 2016 2:01 pm
by tello
hi Benj.
The new component is much faster than the previous but still have a very large pause 1,14sec after receiving the response from the slave.
You can add a variable to adjust the timeout or time out after receiving the answer ??
My big problem is that the micro does two UART communications and also checks and evaluates the data, if a pause or a delay occurs, the micro does not work on your other tasks and are very important.

Deputy capture the graph of time.

Thanks again for your time, I feel very proud to have flowcode, there are a great team in your work.

thanks, thanks and a thousand thanks

Re: Modbus master component Time out response

Posted: Mon May 09, 2016 1:02 pm
by Benj
Hello,

Any chance I can see your program?

The component should return immediately after the reply so I am wondering if you are maybe calling the GetResponse macro again after the PresetMultipleRegisters command. I've looked in the program above and you don't seem to be doing this.

Of course it could be something wrong in my time out logic so I will go back through and see if I can spot anything further for you.

Re: Modbus master component Time out response

Posted: Mon May 09, 2016 1:16 pm
by Benj
This component now has a new property named Receive Timeout. You should be able to adjust this until the delay has been eliminated.
Modbus.fcpx
(16.7 KiB) Downloaded 279 times
Still not sure why we are not jumping out of the routine at the right time.