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. Com_read Returns Invalid Parameter

com_read returns Invalid Parameter

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 Mohanraj , 27 July, 2021
Forums
General discussion

Hi Mikko,

Hope you are doing good. We are observing strange problem in com_read function. At times com_read returns error code DLMS_ERROR_CODE_INVALID_PARAMETER i.e in decimal 258. I remember this problem was resolved in stack(https://www.gurux.fi/node/16144) and we are using the latest ANSCI C library only. could you please tell us what is the problem?

Below is the code snippet
read_data()
{
cosem_init()
com_read(&con, profile_obj, 3);
com_read(&con, profile_obj, 2);
}

Below is the trace of TX and RX.

TX : 7E A0 19 03 41 BA 7A B5 E6 E6 00 C0 01 81 00 07 01 00 5E 5B 00 FF 03 00 4C 96 7E
RX : 7E A8 89 41 03 DA 8B A4 E6 E7 00 C4 01 81 00 01 16 02 04 12 00 08 09 06 00 00 01 00 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 0C 07 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 0B 07 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 5B 07 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 0D 07 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 0E 07 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 09 07 25 5C 7E

TX : 7E A0 07 03 41 D1 4C 05 7E
RX : 7E A8 89 41 03 DC BD C1 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 01 07 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 01 08 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 09 08 00 FF 0F 02 12 00 00 02 04 12 00 04 09 06 01 00 01 06 00 FF 0F 02 12 00 00 02 04 12 00 04 09 06 01 00 01 06 00 FF 0F 05 12 00 00 02 04 12 00 04 09 06 01 00 09 06 00 FF 0F 02 12 00 00 02 04 12 00 04 09 06 01 00 09 06 00 FF 8C FE 7E

TX : 7E A0 07 03 41 F1 4E 24 7E
RX : 7E A8 89 41 03 DE AF E2 0F 05 12 00 00 02 04 12 00 03 09 06 00 00 5E 5B 0E FF 0F 02 12 00 00 02 04 12 00 01 09 06 00 00 5E 5B 00 FF 0F 02 12 00 00 02 04 12 00 01 09 06 00 00 00 01 00 FF 0F 02 12 00 00 02 04 12 00 01 09 06 00 00 60 02 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 02 08 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 0A 08 00 FF 0F 02 12 00 00 02 04 12 00 46 09 06 00 00 60 03 0A FF 0F 02 93 3D 7E

TX : 7E A0 07 03 41 11 40 C3 7E
RX : 7E A0 1E 41 03 D0 1F E8 12 00 00 02 04 12 00 47 09 06 00 00 11 00 00 FF 0F 03 12 00 00 52 B5 7E

**************************************************************************************************************************

TX : 7E A0 19 03 41 D6 10 1C E6 E6 00 C0 01 81 00 07 01 00 5E 5B 00 FF 03 00 4C 96 7E
RX : 7E A8 89 41 03 9C B9 83 E6 E7 00 C4 01 81 00 01 16 02 04 12 00 08 09 06 00 00 01 00 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 0C 07 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 0B 07 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 5B 07 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 0D 07 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 0E 07 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 09 07 25 5C 7E

TX : 7E A0 07 03 41 F1 4E 24 7E
RX : 7E A8 89 41 03 9E AB A0 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 01 07 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 01 08 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 09 08 00 FF 0F 02 12 00 00 02 04 12 00 04 09 06 01 00 01 06 00 FF 0F 02 12 00 00 02 04 12 00 04 09 06 01 00 01 06 00 FF 0F 05 12 00 00 02 04 12 00 04 09 06 01 00 09 06 00 FF 0F 02 12 00 00 02 04 12 00 04 09 06 01 00 09 06 00 FF 8C FE 7E

TX : 7E A0 07 03 41 11 40 C3 7E
RX : 7E A8 89 41 03 90 D5 49 0F 05 12 00 00 02 04 12 00 03 09 06 00 00 5E 5B 0E FF 0F 02 12 00 00 02 04 12 00 01 09 06 00 00 5E 5B 00 FF 0F 02 12 00 00 02 04 12 00 01 09 06 00 00 00 01 00 FF 0F 02 12 00 00 02 04 12 00 01 09 06 00 00 60 02 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 02 08 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 0A 08 00 FF 0F 02 12 00 00 02 04 12 00 46 09 06 00 00 60 03 0A FF 0F 02 93 3D 7E

TX : 7E A0 07 03 41 31 42 E2 7E
RX : 7E A0 1E 41 03 92 09 89 12 00 00 02 04 12 00 47 09 06 00 00 11 00 00 FF 0F 03 12 00 00 52 B5 7E

Thanks
Mohanraj

Profile picture for user Kurumi

Kurumi

5 years ago

Hi Mohanraj,

Hi Mohanraj,

What method returns this error?

BR,
Mikko

Mohanraj

5 years ago

In reply to Hi Mohanraj, by Kurumi

HiMikko,

HiMikko,

we are not able to go in details. but the return value of com_read is DLMS_ERROR_CODE_INVALID_PARAMETER. further any com_read returns the same error code.

Thanks
Mohanraj

Mohanraj

5 years ago

In reply to Hi Mohanraj, by Kurumi

Hi Mikko,

Hi Mikko,

Incase if stack returns DLMS_ERROR_CODE_INVALID_PARAMETER for com_read function how to recover it? please suggest workaround? and why stack should return that error code when data is correct?

Thanks
Mohanraj

Profile picture for user Kurumi

Kurumi

5 years ago

Hi,

Hi,

In your trace above you read attribute index #3 twice. Check why this is happening.
BR,
Mikko

Mohanraj

5 years ago

In reply to Hi, by Kurumi

Hi Mikko,

Hi Mikko,

for every time we are reading index #3 followed by index #2. is not recommended?
what do you suggest?
read index #3 once for profile generic object after that continuously we can read only index#2?

Thanks
Mohanraj

Profile picture for user Kurumi

Kurumi

4 years 12 months ago

Hi Mohanraj,

Hi Mohanraj,
You need to read capture objects before you read index #3, but in your trace, you have read index #3 twice and not read index #2 at all. Check your code. I believe that you have made medications for com_read -method.

BR,
Mikko

Mohanraj

4 years 12 months ago

In reply to Hi Mohanraj, by Kurumi

Hi Mikko,

Hi Mikko,

how to read capture objects before reading index#3 followed by index#2?
I assume that com_read(&con, profile_obj, 3) is reading capture object and com_read(&con, profile_obj, 2) is data
please correct and suggest.

Thanks
Mohanraj

Profile picture for user Kurumi

Kurumi

4 years 12 months ago

Hi Mohanraj,

Hi Mohanraj,

You are right. I suggest that you check that you haven't modified the source code. I believe that is the problem why you are reading capture objects twice or then your trace above is wrong.

BR,
Mikko

Mohanraj

4 years 12 months ago

In reply to Hi Mohanraj, by Kurumi

Hi Mikko,

Hi Mikko,
i have not modified the source. it was a mistake that we were referring wrong trace.
Thanks
Mohanraj

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701
  • Thu, 07/23/2026 - 16:19
    gurux.dlms.java 4.0.96
  • Thu, 07/09/2026 - 14:34
    Gurux.DLMS.Python 1.0.201
  • Fri, 06/26/2026 - 16:32
    Gurux.Service 3.0.2606.2601
  • Wed, 06/24/2026 - 08:36
    Gurux.DLMS.Python 1.0.200

New forum topics

  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
  • Connecting Meter to Agent via serial
  • Reading block profile with Compact array
  • DLMS server - serving multiple similar datasets gathered from multiple meters across distinct logical addresses
More

Who's new

  • Malcolmactig
  • mhliang
  • Kevinmug
  • mohanadalhweiti
  • dawnso11
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin