Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » modbus TCP/IP ADU send problem(modbus ethernet framing problem, ADU message missing MBAP header)
modbus TCP/IP ADU send problem [message #1734920] Mon, 13 June 2016 18:03 Go to next message
Peter Huszar is currently offline Peter HuszarFriend
Messages: 6
Registered: June 2016
Junior Member
Hi,
I am having trouble communicating with a TCP/IP modbus device using modbusProtocolDevice.

It seems that the ..protocol.modbus package does not implement the required MBAP header for TCP/IP communication. See: Modbus_Messaging_Implementation_Guide_V1_0b.pdf page 5 at modbus.org

According to modbus.org, the MBAP header is required for TCP/IP communication, when sending a PDU. The MBAP header contains transmission ID, protocol identifier, length information and a unit identifier.

Without the header the slave device rejects the transmission when checking the header content. Other modbus master testers work with no problem as they send the MBAP not just the PDU.

Please let me know if anybody else has tried to used successfully the modbus TCP/IP (modbusProtocolDevice) provided as part of Kura with a standard device.

BR. Peter

Re: modbus TCP/IP ADU send problem [message #1735006 is a reply to message #1734920] Tue, 14 June 2016 15:04 Go to previous messageGo to next message
Pierre Pitiot is currently offline Pierre PitiotFriend
Messages: 16
Registered: April 2015
Junior Member
Hello Peter,

you are totally right, the TCP/IP version of Modbus protocol has been partially implemented and is missing the MBAP header. This is not an excuse but at the time we implemented it we had no device to test and we probably used a kind of simulator that was just testing Modbus over TCP/IP but not the standard TCP/IP Modbus.

I will open an issue in Kura github and we will try to fix it in the next release (not the release coming soon but the one after Wink). You are welcome if you want to participate to the fix.

Thanks
--Pierre
Re: modbus TCP/IP ADU send problem [message #1735068 is a reply to message #1735006] Wed, 15 June 2016 08:57 Go to previous messageGo to next message
Peter Huszar is currently offline Peter HuszarFriend
Messages: 6
Registered: June 2016
Junior Member
Hello Pierre,

Thanks for the reply. Meanwhile I have obtained the source and have started fixing the code so I can go forward with my project. I would be glad to
contribute/participate in the fix. At the moment I have some OSGI issues, but that is because I am new to OSGI packages. I'll do some testing just to make sure it works OK. Otherwise the code looks fine. It was great help. Good job!

Regards,
Peter
Re: modbus TCP/IP ADU send problem [message #1735077 is a reply to message #1735068] Wed, 15 June 2016 11:12 Go to previous messageGo to next message
Peter Huszar is currently offline Peter HuszarFriend
Messages: 6
Registered: June 2016
Junior Member
Hello Pierre,

There is on more item that is non-standard in the Modbus implementation: The CRC of the Modbus RTU message is not used in the TCP/IP message, instead a CRC generated at the Ethernet Layer2 (Data Link Layer) is used transparently.

Regards,
Peter
Re: modbus TCP/IP ADU send problem [message #1735237 is a reply to message #1735077] Thu, 16 June 2016 14:06 Go to previous messageGo to next message
Pierre Pitiot is currently offline Pierre PitiotFriend
Messages: 16
Registered: April 2015
Junior Member
Hello Peter,

thanks for all this testing, I think you are probably the first to use the full TCP/IP implementation of Modbus in Kura.
If you are familiar with github pull request and have some time you are very welcome to propose a fix that we will include in the next release. If you prefer and have some code working I can do the PR and test it on my gateways.

Best Regards
--Pierre
Re: modbus TCP/IP ADU send problem [message #1736147 is a reply to message #1735237] Mon, 27 June 2016 07:11 Go to previous messageGo to next message
Peter Huszar is currently offline Peter HuszarFriend
Messages: 6
Registered: June 2016
Junior Member
Hello Pierre,

I have downloaded the source for Kura/Modbus. Unfortunately I keep having class not found exceptions in my project since then. I need to figure out what is happening before I can be of any help. I'll contribute a fix once I figured out how to correctly build the Modbus bundle.

Regards, Peter
Re: modbus TCP/IP ADU send problem [message #1736274 is a reply to message #1736147] Tue, 28 June 2016 07:52 Go to previous messageGo to next message
Pierre Pitiot is currently offline Pierre PitiotFriend
Messages: 16
Registered: April 2015
Junior Member
Hi Peter,

could you please give more details on the class not found exception you have. How did you proceed to build your project? If you want to work on modbus service (org.eclipse.kura.protocol.modbus) you need to work on the full kura distrib as it is described in the wiki :
https://wiki.eclipse.org/Kura/Getting_Started

Thanks
--Pierre
Re: modbus TCP/IP ADU send problem [message #1736394 is a reply to message #1736274] Wed, 29 June 2016 07:15 Go to previous messageGo to next message
Peter Huszar is currently offline Peter HuszarFriend
Messages: 6
Registered: June 2016
Junior Member
Hi Pierre,

Thanks for your kind support. I had the original Modbus bundle working but once I changed to the source files that I have pulled from the repository, the project settings I initially made and the configuration got messed up. As this is my first OSGI project, I had to sort out a few things in my head as well.
So now I am making some modifications to the code and testing it. Sending is OK, but there are a few things in receiving that need to be changed as well since the header explicitly contains length and there is no CRC. Once I can dedicate some time to the project it should not take long to complete the modification. I'll let you know my progress. After initial testing, I would gladly contribute the changes.

Thanks,
Peter
Re: modbus TCP/IP ADU send problem [message #1736520 is a reply to message #1736394] Thu, 30 June 2016 07:15 Go to previous messageGo to next message
Peter Huszar is currently offline Peter HuszarFriend
Messages: 6
Registered: June 2016
Junior Member
Hi Pierre,

I made some code changes and is seems to work. Please let me know what is the review policy, how should I contribute the code. Also there is a TransactionID variable which should persist preferably for more than a single connection attempt. Where would you recommend to place/declare this variable?

Best regards,
Peter
Re: modbus TCP/IP ADU send problem [message #1736793 is a reply to message #1736520] Fri, 01 July 2016 18:56 Go to previous messageGo to next message
David Woodard is currently offline David WoodardFriend
Messages: 420
Registered: July 2014
Senior Member
Hi Peter,

The documentation on how to contribute code is here [1]. The important parts are signing the CLA and making sure you have your commits squashed and signed. If you need help with any of that let us know.

[1] https://wiki.eclipse.org/Development_Resources/Contributing_via_Git

Thanks,
--Dave
Re: modbus TCP/IP ADU send problem [message #1737187 is a reply to message #1736793] Wed, 06 July 2016 09:45 Go to previous messageGo to next message
Pierre Pitiot is currently offline Pierre PitiotFriend
Messages: 16
Registered: April 2015
Junior Member
Hi Peter

for the Transaction ID I suggest a function as the example below (to add in ModbusProtocolDevice):
	private static int transactionIndex = 0;

	private int getNextTransactionIndex() {
		transactionIndex++;
		if (transactionIndex > 0xffff)
			transactionIndex = 0;
		return transactionIndex;
	}


By the way, the present implementation on Ethernet is correct, it is implementing RTU over TCP/IP. Adding Modbus TCP will require to add a new option for PROTOCOL_CONNECTION_TYPE.

Thanks
--Pierre
Re: modbus TCP/IP ADU send problem [message #1745002 is a reply to message #1734920] Tue, 04 October 2016 05:02 Go to previous messageGo to next message
Jerrold Law is currently offline Jerrold LawFriend
Messages: 1
Registered: October 2016
Junior Member
Hello,

May I just check the status on this issue if it is still ongoing at all? Thanks!
Re: modbus TCP/IP ADU send problem [message #1752091 is a reply to message #1745002] Wed, 18 January 2017 17:30 Go to previous messageGo to next message
Bruno Vetter is currently offline Bruno VetterFriend
Messages: 8
Registered: November 2016
Junior Member
Hello,

is there any update on this issue? I am having similar issues with ESF 4.0.2. Is it fixed in the Kura Modbus implementation?

Kind regards
Bruno
Re: modbus TCP/IP ADU send problem [message #1752092 is a reply to message #1745002] Wed, 18 January 2017 17:31 Go to previous messageGo to next message
Bruno Vetter is currently offline Bruno VetterFriend
Messages: 8
Registered: November 2016
Junior Member
Hello,

is there any update on this issue? I am having similar issues with ESF 4.0.2. Is it fixed in the Kura Modbus implementation?

Kind regards
Bruno
Re: modbus TCP/IP ADU send problem [message #1752293 is a reply to message #1752092] Fri, 20 January 2017 16:45 Go to previous messageGo to next message
David Woodard is currently offline David WoodardFriend
Messages: 420
Registered: July 2014
Senior Member
Hello,

Are you referring to Modbus TCP/IP support instead of TCP RTU? If so, we have added this support in the main develop branch of Kura. It will be included in our next Kura release (due in March). If you need it sooner, you can grab the changes from the repository [1].

[1] https://github.com/eclipse/kura/tree/develop/kura/org.eclipse.kura.protocol.modbus

Thanks,
--Dave
Re: modbus TCP/IP ADU send problem [message #1752590 is a reply to message #1752293] Wed, 25 January 2017 13:04 Go to previous messageGo to next message
Bruno Vetter is currently offline Bruno VetterFriend
Messages: 8
Registered: November 2016
Junior Member
Thanks Dave,

I will try the development branch. Are you in contact with Eurotech by any chance? We are having this issue also with Eurotech's Modbus implementation and I have not received any reply on my support request there.

Kind regards
Bruno
Re: modbus TCP/IP ADU send problem [message #1752885 is a reply to message #1752590] Mon, 30 January 2017 11:00 Go to previous message
Bruno Vetter is currently offline Bruno VetterFriend
Messages: 8
Registered: November 2016
Junior Member
Hi,

I just got configuration from Eurotech that they are aware of the issue and the fix in Kura.

Bruno
Previous Topic:Add external Jar to Kura OSGI Bundle
Next Topic:Using Jetty server in Kura
Goto Forum:
  


Current Time: Thu Apr 25 00:32:13 GMT 2024

Powered by FUDForum. Page generated in 0.04128 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top