Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Disconnect Mode Error While Using HDLC To Read

Disconnect Mode Error while using HDLC to read

By Rahuls , 29 August, 2024
Forums
Gurux.Net

Hey kurumi, getting this error message when trying to read from using hdlc cable

Gurux.DLMS.GXDLMSException: Disconnect mode.\r\n at MeterBaseSystem.DLMSHelper.ReadDLMSPacket(Byte[] data, GXReplyData reply)

works correclty with tcp mode, but getting error in HDLC mode

serial.PortName = GXSerial.GetPortNames()[0];
serial.BaudRate = 9600;
serial.DataBits = 8;
serial.Parity = System.IO.Ports.Parity.None;
serial.StopBits = System.IO.Ports.StopBits.One;

thanks in advance

Profile picture for user Kurumi

Kurumi

1 year 9 months ago

Hi, What kind of error are…

Hi,

What kind of error are you receiving? Can you add when hex trace what the meter is responding?

BR,
Mikko

Rahuls

1 year 9 months ago

Send 11:39:20 AM 7E A0 07 03…

Send 11:39:20 AM 7E A0 07 03 21 93 0F 01 7E
Recv 11:39:20 AM 7E A0 20 21 03 73 73 98 81 80 14 05 02 03 40 06 02 03 40 07 04 00 00 00 01 08 04 00 00 00 01 B7 29 7E
Send 11:39:20 AM 7E A0 2B 03 21 10 FB AF E6 E6 00 60 1D A1 09 06 07 60 85 74 05 08 01 01 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 62 1E 5D FF FF 88 55 7E
Recv 11:39:20 AM 7E A0 37 21 03 30 6C 7C E6 E7 00 61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 00 10 03 40 00 07 D1 F0 7E
Send 11:39:20 AM 7E A0 19 03 21 32 6F D8 E6 E6 00 C0 01 C1 00 01 00 00 2B 01 03 FF 02 00 B0 AA 7E
Recv 11:39:20 AM 7E A0 15 21 03 52 5D 8A E6 E7 00 C4 01 C1 00 06 00 00 00 15 51 5F 7E
Send 11:39:20 AM 7E A0 07 03 21 53 03 C7 7E
Recv 11:39:20 AM 7E A0 20 21 03 73 73 98 81 80 14 05 02 03 40 06 02 03 40 07 04 00 00 00 01 08 04 00 00 00 01 B7 29 7E
----------------------------------------New Read-------------------------------------------
Send 11:39:21 AM 7E A0 7C 03 61 10 AA 6B E6 E6 00 60 6E A1 09 06
07 60 85 74 05 08 01 03 A6 0A 04 08 4F 41 4B 30 30 30 30 31 8A 02 07 80 8B 07 60 85 74 05 08 02 02 AC 12 80 10 37 2C 5D 25 09 15 50 75 4A 27 4F 2E 2D 71 42 30 BE 34 04 32 21 30 30 00 00 00 16 CC 4B 43 CF 4A E5 32 D4 25 E4 E2 9A CB 51 DE 4E C6 1C 29 0D 22 76 18 D7 8A 57 7E 24 E2 87 96 8B 0D DC 7E 82 F7 E7 42 25 D7 9A 9C 54 20 7E
Recv 11:39:21 AM 7E A0 07 61 03 1F 1D EF 7E\n"

Profile picture for user Kurumi

Kurumi

1 year 9 months ago

Hi, You must send SNRM and…

Hi,

You must send SNRM and handle received UA before establishing the new ciphered connection.

BR,
Mikko

Rahuls

1 year 9 months ago

Yes I am doing that while…

Yes I am doing that

while reading innvocation counter, then disconnecting it.

Then new AArq request for profile read.

Profile picture for user Kurumi

Kurumi

1 year 9 months ago

Hi, OK. That was removed…

Hi,

OK. That was removed from the log you posted.

Try to connect with the client example. When you select the device, you can see the correct command line parameters in GXDLMSDirector.

https://github.com/Gurux/Gurux.DLMS.Python/tree/master/Gurux.DLMS.Clien…

BR,
Mikko

Rahuls

1 year 9 months ago

Hi mikko, a little update i…

Hi mikko, a little update

i tried running .net version of gurux console app but was getting dependency issue.

I tried in my app, I am able to read invocation counter using PC mode and able to set it, but i get Disconnect Mode error in making aarqrequest while reading anything in Us mode.

this.settings.client.UseLogicalNameReferencing = true;
this.settings.client.InterfaceType = read.mediaType == MediaType.TCP ? InterfaceType.WRAPPER : InterfaceType.HDLC;
this.settings.client.ClientAddress = read.ClientId;
this.settings.client.ServerAddress = read.ServerId;

this.settings.client.Password = ASCIIEncoding.ASCII.GetBytes(read.Password);
this.settings.client.Authentication = Authentication.High;
this.settings.client.Ciphering.Security = Security.AuthenticationEncryption;

this.settings.client.Ciphering.SystemTitle = GXCommon.HexToBytes(AsciiToHex(read.SystemTitle)); // assuming default
this.settings.client.Ciphering.SecuritySuite = Gurux.DLMS.Objects.Enums.SecuritySuite.Suite0;
this.settings.client.Ciphering.AuthenticationKey = GXCommon.HexToBytes(AsciiToHex(read.AuthenticationKey));
this.settings.client.Ciphering.BlockCipherKey = GXCommon.HexToBytes(AsciiToHex(read.BlockCipherKey));
this.settings.client.Ciphering.InvocationCounter = counter + 1;
if (!string.IsNullOrEmpty(read.DedicatedKey))
{
this.settings.client.Ciphering.DedicatedKey = GXCommon.HexToBytes(AsciiToHex(read.DedicatedKey));

}
this.settings.client.Standard = Standard.India; // changing default
this.settings.client.Plc.MacDestinationAddress = UInt16.Parse("0"); // dont know yet
this.settings.client.ServiceClass = ServiceClass.Confirmed;
InitializeMedia(read);

am i missing something?
and is intervaltimeout mandatory for hdlc?

thanks

Profile picture for user Kurumi

Kurumi

1 year 9 months ago

Hi, HDLC don't use PDC. You…

Hi,

HDLC don't use PDC. You can remove this line:

this.settings.client.Plc.MacDestinationAddress

Try to wait for two seconds before establishing the connection again. Some meters require that.

BR,
Mikko

Rahuls

1 year 9 months ago

Hey mikko, i added 2 sec…

Hey mikko, i added 2 sec delay, still same error

Profile picture for user Kurumi

Kurumi

1 year 9 months ago

Hi, Try to connect with…

Hi,

Try to connect with GXDLMSDirector. I believe it will help you to get the correct settings.

BR,
Mikko

Rahuls

1 year 9 months ago

Yes its wokring ccorreclty…

Yes its wokring ccorreclty on GXdlms director, and same settinngs are working correctly for tcp through my code. Only thing i am changing is interface type and media object with GXSerial settings.

In that also its working correctly for getting innvocation counter using HDLC, only US mode connection and reading is giving me this error

Profile picture for user Kurumi

Kurumi

1 year 9 months ago

Hi, Try with client example…

Hi,

Try with client example.
https://github.com/Gurux/Gurux.DLMS.Net/tree/master/Gurux.DLMS.Client.E…

You can see the correct command line arguments in the GXDLMSDirector.
In your previous post, you told that you have dependency issue. You need to install Nuget from https://www.nuget.org/. It will install all missing libraries.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin