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. Forums
  3. Reading Kamstrup Meter With Python Example Reader Gives Invalid HDLC Frame

Reading Kamstrup meter with python example reader gives Invalid HDLC Frame

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By nothlev , 5 October, 2020
Forums
Gurux.DLMS

I try to read Kamstrup meter with a public association. Its works fine with GXDLMSDirector.
I try to read meter with python client example: Gurux.DLMS.Client.Example.python\main.py with parameters: -S COM3 -a None -s 1 -c 16 -C None -d DLMS -g 1.1.0.2.0.255:1

I have changed GXDLMSHdlcSetup.py to meet req. about max payload size:

self.maximumInfoLengthReceive = 1010 #128
self.maximumInfoLengthTransmit = 1010 #128

It says: Invalid HDLC Frame: 0x42 Expected: 0x52

Am I missing something?

It looks like this when running:

= RESTART: C:\Users\jno\Documents\Python scripts\Gurux.DLMS.Python-master\Gurux.DLMS.Client.Example.python\main.py
gurux_dlms version: 1.0.93
gurux_net version: 1.0.17
gurux_serial version: 1.0.14
Authentication: Authentication.NONE
ClientAddress: 0x10
ServerAddress: 0x1
Standard: Standard.DLMS
Invalid HDLC Frame: 0x42 Expected: 0x52
Data send failed. Try to resend 1/3
Traceback (most recent call last):
File "C:\Users\jno\Documents\Python scripts\Gurux.DLMS.Python-master\Gurux.DLMS.Client.Example.python\main.py", line 98, in main
reader.getAssociationView()
File "C:\Users\jno\Documents\Python scripts\Gurux.DLMS.Python-master\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 496, in getAssociationView
self.client.parseObjects(reply.data, True, False)
File "C:\Users\jno\AppData\Local\Programs\Python\Python38-32\lib\site-packages\gurux_dlms\GXDLMSClient.py", line 725, in parseObjects
raise Exception("Invalid parameter.")
Exception: Invalid parameter.
DisconnectRequest

Profile picture for user Kurumi

Kurumi

5 years 8 months ago

Hi,

Hi,

What is your meter model? Can you post a trace from this? I did try this as you described and it worked.

BR,
Mikko

nothlev

5 years 8 months ago

Hi,

Hi,
I try on OMNIPOWER v2 direct 3 phase meter.
gurux_dlms version: 1.0.93
gurux_net version: 1.0.17
gurux_serial version: 1.0.14
Authentication: Authentication.NONE
ClientAddress: 0x10
ServerAddress: 0x1
Standard: Standard.DLMS
TX: 09:17:24 7E A0 07 03 21 93 0F 01 7E
RX: 09:17:25 7E A0 20 21 03 73 73 98 81 80 14 05 02 00 80 06 02 00 80 07 04 00 00 00 01 08 04 00 00 00 01 CE 6A 7E
TX: 09:17:25 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 00 1E 1D FF FF C5 E4 7E
RX: 09:17:25 7E A0 39 21 03 30 2E D2 E6 E7 00 61 82 00 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 10 1D 03 EF 00 07 44 36 7E
TX: 09:17:25 7E A0 19 03 21 32 6F D8 E6 E6 00 C0 01 C1 00 0F 00 00 28 00 00 FF 02 00 91 53 7E
Invalid HDLC Frame: 0x42 Expected: 0x52
Data send failed. Try to resend 1/3
RX: 09:17:30 7E A8 89 21 03 42 07 B9 E6 E7 00 C4 02 C1 00 00 00 00 01 00 82 00 88 01 2B 02 04 12 00 0F 11 02 09 06 00 00 28 00 00 FF 02 02 01 0B 02 03 0F 01 16 01 00 02 03 0F 02 16 01 00 02 03 0F 03 16 01 00 02 03 0F 04 16 01 00 02 03 0F 05 16 01 00 02 03 0F 06 16 01 00 02 03 0F 07 16 00 00 02 03 0F 08 16 01 00 02 03 0F 09 16 01 00 02 03 0F 0A 16 01 00 02 03 0F 0B 16 01 00 01 06 02 02 0F 01 16 00 02 02 0F 02 16 00 02 EC 3F 7E 7E A0 07 21 03 51 11 42 7E
Traceback (most recent call last):
File "C:\Users\jno\Documents\Python scripts\Gurux.DLMS.Python-master\Gurux.DLMS.Client.Example.python\main.py", line 98, in main
reader.getAssociationView()
File "C:\Users\jno\Documents\Python scripts\Gurux.DLMS.Python-master\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 496, in getAssociationView
self.client.parseObjects(reply.data, True, False)
File "C:\Users\jno\AppData\Local\Programs\Python\Python38-32\lib\site-packages\gurux_dlms\GXDLMSClient.py", line 725, in parseObjects
raise Exception("Invalid parameter.")
Exception: Invalid parameter.
DisconnectRequest
TX: 09:17:30 7E A0 07 03 21 53 03 C7 7E
RX: 09:17:30 7E A0 07 21 03 73 01 40 7E

Profile picture for user Kurumi

Kurumi

5 years 8 months ago

Hi,

Hi,

Now I know the reason. You need to change values to GXDLMSLimits. That will do the trick.

BR,
Mikko

nothlev

5 years 8 months ago

Hi,

Hi,

Now I have changed GXDLMSHdlcSetup.py to:

self.maximumInfoLengthReceive = 128
self.maximumInfoLengthTransmit = 128

and GXDLMSLimits lokks like this:

class GXDLMSLimits:
DEFAULT_MAX_INFO_TX = 128
DEFAULT_MAX_INFO_RX = 128
DEFAULT_WINDOWS_SIZE_TX = 1
DEFAULT_WINDOWS_SIZE_RX = 1

But I still see the same error

TX: 10:02:19 7E A0 07 03 21 93 0F 01 7E
RX: 10:02:19 7E A0 20 21 03 73 73 98 81 80 14 05 02 00 80 06 02 00 80 07 04 00 00 00 01 08 04 00 00 00 01 CE 6A 7E
TX: 10:02:19 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 00 1E 1D FF FF C5 E4 7E
RX: 10:02:19 7E A0 39 21 03 30 2E D2 E6 E7 00 61 82 00 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 10 1D 03 EF 00 07 44 36 7E
TX: 10:02:19 7E A0 19 03 21 32 6F D8 E6 E6 00 C0 01 C1 00 0F 00 00 28 00 00 FF 02 00 91 53 7E
Invalid HDLC Frame: 0x42 Expected: 0x52
Data send failed. Try to resend 1/3
RX: 10:02:25 7E A8 89 21 03 42 07 B9 E6 E7 00 C4 02 C1 00 00 00 00 01 00 82 00 88 01 2B 02 04 12 00 0F 11 02 09 06 00 00 28 00 00 FF 02 02 01 0B 02 03 0F 01 16 01 00 02 03 0F 02 16 01 00 02 03 0F 03 16 01 00 02 03 0F 04 16 01 00 02 03 0F 05 16 01 00 02 03 0F 06 16 01 00 02 03 0F 07 16 00 00 02 03 0F 08 16 01 00 02 03 0F 09 16 01 00 02 03 0F 0A 16 01 00 02 03 0F 0B 16 01 00 01 06 02 02 0F 01 16 00 02 02 0F 02 16 00 02 EC 3F 7E 7E A0 07 21 03 51 11 42 7E
Traceback (most recent call last):
File "C:\Users\jno\Documents\Python scripts\Gurux.DLMS.Python-master\Gurux.DLMS.Client.Example.python\main.py", line 98, in main
reader.getAssociationView()
File "C:\Users\jno\Documents\Python scripts\Gurux.DLMS.Python-master\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 496, in getAssociationView
self.client.parseObjects(reply.data, True, False)
File "C:\Users\jno\AppData\Local\Programs\Python\Python38-32\lib\site-packages\gurux_dlms\GXDLMSClient.py", line 725, in parseObjects
raise Exception("Invalid parameter.")
Exception: Invalid parameter.
DisconnectRequest
TX: 10:02:25 7E A0 07 03 21 53 03 C7 7E
RX: 10:02:25 7E A0 07 21 03 73 01 40 7E

nothlev

5 years 8 months ago

FYI: I have been trying a lot

FYI: I have been trying a lot, before posting in this Forum. The values that I set in GXDLMSHdlcSetup.py (1010) was also set to 1010 in GXDLMSLimits.py. But still got the error. I am in doubt wheather I have understood you last post correctly? Should values also be changed in GXDLMSLimits. Or should values be restored to the default limits? (128) I tried both with no luck.

Profile picture for user Kurumi

Kurumi

5 years 8 months ago

Hi,

Hi,

The best way is if you change this in the client side code like this:

client = GXDLMSSecureClient(True)
client.limits.maxInfoTX = 1010
client.limits.maxInfoRX = 1010

You don't usually need to do this. OMNIPOWER is a special case.

BR,
Mikko

nothlev

5 years 8 months ago

Hi,

Hi,

This was much better :-)
Problem solved, thank you very much.

  • 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

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin