Unable to read meter using ciphering- India DLMS

9 posts / 0 new
Last post
aashishkul
Unable to read meter using ciphering- India DLMS

I am using the latest version of Android DLMS example app. I have updated the source code so that I am setting the appropriate values for the keys in ciphering options. However, when I try to read the meter, it fails during application association process. The error message is "parseApplicationAssociationResponse failed. Server to Client do no match."
Even after lot of debugging, I could not make it work on Android.
So, I installed Java and tried to use same settings as Android and test the program on PC using Java source code and it works. I also tried it with Python and it works too. Gurux DLMS director also works fine. But Android does not work.
When I tried to compare the style of the program, I found Java, Python and GX Director use very similar code style. But Android application seems a bit different (may be it is not upgraded to latest code style).

How can I debug the issue?

Here is the communication log:
<- 01:25:16.397 7E A0 07 03 21 93 0F 01 7E
-> 01:25:16.455 7E A0 1E 21 03 73 C3 7A 81 80 12 05 01 80 06 01 80 07 04 00 00 00 01 08 04 00 00 00 01 53 3B 7E
<- 01:25:16.463 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 40 1E 1D FF FF E7 25 7E
-> 01:25:16.581 7E A0 3A 21 03 30 E3 F7 E6 E7 00 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 02 30 00 07 F5 F1 7E
<- 01:25:16.586 7E A0 19 03 21 32 6F D8 E6 E6 00 C0 01 C1 00 01 00 00 2B 01 03 FF 01 00 D8 80 7E
-> 01:25:16.662 7E A0 18 21 03 52 D2 01 E6 E7 00 C4 01 C1 00 09 06 00 00 2B 01 03 FF CF 3B 7E
<- 01:25:16.662 7E A0 19 03 21 54 5F DE E6 E6 00 C0 01 C1 00 01 00 00 2B 01 03 FF 02 00 B0 AA 7E
-> 01:25:16.725 7E A0 15 21 03 74 69 CE E6 E7 00 C4 01 C1 00 06 00 00 06 B3 BD CB 7E
<- 01:25:16.727 7E A0 07 03 21 53 03 C7 7E
-> 01:25:16.774 7E A0 1E 21 03 73 C3 7A 81 80 12 05 01 80 06 01 80 07 04 00 00 00 01 08 04 00 00 00 01 53 3B 7E
<- 01:25:16.775 7E A0 07 03 61 93 69 47 7E
-> 01:25:16.822 7E A0 1E 61 03 73 B5 7C 81 80 12 05 01 80 06 01 80 07 04 00 00 00 01 08 04 00 00 00 01 53 3B 7E
<- 01:25:16.835 7E A0 6B 03 61 10 2A FF E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 47 55 52 55 58 31 32 33 8A 02 07 80 8B 07 60 85 74 05 08 02 02 AC 12 80 10 2A 25 3B 57 74 1D 72 62 3E 77 4B 74 25 57 12 2E BE 23 04 21 21 1F 30 00 00 06 B4 5A BC BF EB D5 B7 94 0F FE 9A BB 16 B9 0E 08 73 05 06 CC 08 77 B1 5E 60 93 18 47 48 7E
-> 01:25:17.095 7E A0 77 61 03 30 AD 6C E6 E7 00 61 69 A1 09 06 07 60 85 74 05 08 01 03 A2 03 02 01 00 A3 05 A1 03 02 01 0E A4 0A 04 08 4C 4E 54 4C 54 12 78 41 88 02 07 80 89 07 60 85 74 05 08 02 02 AA 12 80 10 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 BE 23 04 21 28 1F 30 00 00 06 6E 64 FD 5C 21 E5 DD 22 7E FD DC 82 B8 E2 5E A1 B2 6A 86 92 72 90 60 E9 B0 71 51 62 4B 7E
<- 01:25:17.116 7E A0 3E 03 61 32 7B 46 E6 E6 00 CB 30 30 00 00 06 B4 98 BD 7E EB DC E8 8B 23 FE DA 5A 0A 47 F8 E5 7C 8F D6 47 2D 48 D2 19 34 7E 9E 23 47 43 31 26 97 F1 36 46 F0 EA D3 CD 42 1A 49 34 E5 9C 7E
<- 01:25:27.163 7E A0 3E 03 61 32 7B 46 E6 E6 00 CB 30 30 00 00 06 B4 98 BD 7E EB DC E8 8B 23 FE DA 5A 0A 47 F8 E5 7C 8F D6 47 2D 48 D2 19 34 7E 9E 23 47 43 31 26 97 F1 36 46 F0 EA D3 CD 42 1A 49 34 E5 9C 7E
-> 01:25:27.257 7E A0 07 61 03 51 67 44 7E

Kurumi
Kurumi's picture

Hi,

Can you share the authentication and block cipher keys that you are using so I can check this?

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

aashishkul

Is there any way I can send the authentication and block cipher keys privately? As it may not be appropriate to share them publicly.

Kurumi
Kurumi's picture

Hi,

You can send an email to me. You find my email address information here:
https://www.gurux.fi/AboutUs

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

Kurumi
Kurumi's picture

Hi,

Your meter is using a frame counter. Example Arduino client was not reading frame counter and that was causing the error. An automatic frame counter read is now implemented. Get the latest version and update the Invocation Counter OBIS code from 0.0.43.1.0.255 to the correct one.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

aashishkul

I am using Android (not Arduino). I am using latest code available on GitHub (https://github.com/Gurux/Gurux.DLMS.Android).
I have already implemented reading of the frame counter by looking at the code in Java repository. The frame counter in this particular meter is 0.0.43.1.3.255. When read using GXDirector it works fine. But when reading using Android it causes problem.

Kurumi
Kurumi's picture

Hi,

I'm sorry for the confusion. I'll check this and let you know as soon as I have found out the reason.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

aashishkul

I did some further testing. This time using Gurux DLMS C library. I observed one more thing:
when the C library reads invocation counter, it sends following command:
7E A0 19 03 21 32 6F D8 E6 E6 00 C0 01 81 00 01 00 00 2B 01 03 FF 02 00 B5 67 7E
Important part is: Priority: HIGH ServiceClass: UN_CONFIRMED invokeID: 1.
It sends Service Class as UN_CONFIRMED.
When this command is sent, the meter does not respond.
I further checked the settings code and modified the code to use CONFIRMED Service class and reading using C library continued successfully.
Now, the Android library faces trouble at some other point in the communication, but I was just wondering if you remember anything which relates to such minor difference between other libraries and Android library when Application Association Request is sent. I think, it must be such minor difference which is causing the communication to stop between Android library and meter.

Thanks in advance.

Kurumi
Kurumi's picture

Hi,

Some meters require that the Confirmed flag is set and some meters report an error if it's set.
Newer meters usually can handle it.

C# and Andoid sets confirmed flag on as a default. For historical reasons ANSI C uses UN_CONFIRMED as a default. If you can read the meter with Android and GXDLMSDirector and add AARQ and AARE messages as a hex trace I can check the differences.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi