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. DLMS.c: Timeout When Reading ProfileGeneric

DLMS.c: Timeout when reading ProfileGeneric

By dvosp , 8 May, 2024
Forums
Gurux.DLMS

Hi,

I'm having an issue reading ProfileGeneric from Landis & Gyr ZMG405. The meter currently has 931 entries in 1.0.99.1.0.255. I read one entry at a time. My read loop is:
for (int i = 1; i <= pg.entriesInUse; i++)
{
printf("Reading index %d", i);
int ret = com_readRowsByEntry(&settings, &pg, i, 1);
if (ret == DLMS_ERROR_CODE_OK)
{
}
else
{
printf(TAG, "Error...");
break;
}
}
It reads up to index 124, after that it times out.

in readDLMSPacket I print out the result of cl_getData.
ret = cl_getData(settings, &frameData, reply);
printf("\ncl_getData %d, %d\n", ret, reply->complete);

After the entry is read I also print out the columns.

Reading index 124
->7E A0 2F 00 02 50 C1 21 76 94 3B E6 E6 00 C0 01 C1 00 07 01 00 63 01 00 FF 02 01 02 02 04 06 00 00 00 7C 06 00 00 00 7C 12 00 01 12 00 00 89 0A 7E
<-7E A0 34 21 00 02 50 C1 96 4E 5E E6 E7 00 C4 01 C1 00 01 01 02 04 09 0C 07 E1 0B 1C 02 0D 1E 00 FF 80 00 01 06 00 80 00 12 05 00 00 00 00 05 00 00 00 00 73 E3 7E
cl_getData 0, 1
dlms Row 0
dlms col 0, 25, -32768, 13:30:00
dlms col 1, 6, 8388626
dlms col 2, 5, 0
dlms col 3, 5, 0

dlms Reading index 125
->7E A0 2F 00 02 50 C1 21 98 E4 35 E6 E6 00 C0 01 C1 00 07 01 00 63 01 00 FF 02 01 02 02 04 06 00 00 00 7D 06 00 00 00 7D 12 00 01 12 00 00 09 10 7E
7E A0 34 21 00 02 50 C1 B8 32 96 E6 E7 00 C4 01 C1 00 01 01 02 04 09 0C 07 E1 0B 1C 02 0E 00 00 FF 80 00 01 06 00 80 00 12 05 00 00 00 00 05 00 00 00 00 6F 7E
cl_getData 0, 0

reply->complete = 0 when requesting index 125. Because of this readDLMSPacket waits for another packet, but the meter does not send one, causing the communication to time out.

If i change the loop to
for (int i = 124; i <= 124; i++)
it works

If i change the loop to
for (int i = 124; i <= 125; i++)
it reads 124, but gets stuck at 125.

Any idea why this happens?

Profile picture for user Kurumi

Kurumi

2 years 1 month ago

Hi, One CRC byte is missing…

Hi,
One CRC byte is missing from the meter reply and packet is not complete.

The meter reply:
7E A0 34 21 00 02 50 C1 B8 32 96 E6 E7 00 C4 01 C1 00 01 01 02 04 09 0C 07 E1 0B 1C 02 0E 00 00 FF 80 00 01 06 00 80 00 12 05 00 00 00 00 05 00 00 00 00
6F //Other CRC byte is missing.
7E

Check why this CRC byte is missing. It might be because the bad connection or there is an issue with UART/RS-232 reading.

BR,
Mikko

dvosp

2 years 1 month ago

Hi Mikko, I can continuously…

Hi Mikko,

I can continuously read record 124 successfully, while 125 fails every time but I'll check.

dvosp

2 years 1 month ago

Hi Mikko, I captured the raw…

Hi Mikko,

I captured the raw serial data
TX: 7E A0 2F 00 02 76 DD 03 52 CE A8 E6 E6 00 C0 01 C1 00 07 01 00 63 01 00 FF 02 01 02 02 04 06 00 00 00 11 06 00 00 00 11 12 00 01 12 00 00 5C 76 7E

RX: 7E A0 4A 03 00 02 76 DD 54 D8 48 E6 E7 00 C4 01 C1 00 01 01 02 09 09 0C 07 E8 01 16 01 10 00 00 00 00 78 00 11 00 06 00 00 00 00 06 00 00 00 00 06 00 00 00 00 06 00 00 00 00 06 00 00 00 00 06 00 00 00 00 06 00 00 00 00 7E 4D 7E

As you can see the received frame ends with 7E 4D 7E.

The current int com_readSerialPort(unsigned char eop) from your examples will not handle this correctly.

The translator DLMSDirector seems to handle it OK.

Profile picture for user Kurumi

Kurumi

2 years 1 month ago

Hi, I don't know if the…

Hi,

I don't know if the problem is on the meter or the connection, but it's clear that the one byte is missing from the HDLC frame. You can try to repeat this with the GXDLMSDirector and if you face the same issue, check if there is a firmware update available for your meter.

BR,
Mikko

dvosp

2 years 1 month ago

Hi Mikko, Found the issue. …

Hi Mikko,

Found the issue. It was in my code, probably happened when I translated your examples to my platform. For the frame in question the first byte of the CRC is 0x7E (the same as the flag character). This was not handled properly.

Thanks for the trouble.

  • 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