AARQ HDLC packet

8 posts / 0 new
Last post
jan.kolar
AARQ HDLC packet

I am trying to communicate with Sanxing meter. This is communication log:

[06:58:27:767] - Open port COM11 (c:\elma\edex\dlms.exe)

[06:58:27:800] Written data (COM11)
2f 3f 21 0d 0a /?!..
[06:58:28:997] Read data (COM11)
2f 41 55 58 35 5c 32 53 58 35 41 32 53 45 4c 53 /AUX5\2SX5A2SELS
2d 30 47 50 30 31 34 0d 0a -0GP014..
[06:58:29:247] Written data (COM11)
06 32 35 32 0d 0a .252..
[06:58:29:794] Read data (COM11)
06 b2 35 b2 8d 0a .˛5˛Ť.
[06:58:29:794] Written data (COM11)
7e a0 0a 00 02 00 21 03 93 23 d4 7e ~ ....!.“#Ô~
[06:58:29:942] Read data (COM11)
7e a0 23 03 00 02 00 21 73 70 7b 81 80 14 05 02 ~ #....!sp{€...
00 72 06 02 01 e8 07 04 00 00 00 01 08 04 00 00 .r...č..........
00 01 0c b2 7e ...˛~
[06:58:29:942] Written data (COM11)
7e a0 4a 00 02 00 21 03 10 b6 a5 e6 e6 00 60 36 ~ J...!..¶Ąćć.`6
a1 09 06 07 60 85 74 05 08 01 01 8a 02 07 80 8b ˇ...`…t....Š..€‹
07 60 85 74 05 08 02 01 ac 0a 80 08 31 32 33 34 .`…t....¬.€.1234
35 36 37 38 be 10 04 0e 01 00 00 00 06 5f 1f 04 5678ľ........_..
00 00 1e 1d ff ff e6 e6 00 95 f9 7e ....˙˙ćć.•ů~

As you can see last packet is AARQ. What I do not understand when I copy this packet into your online DLMS translator (of course without ascii characters on the right) I get error "Message to XML failed. Invalid DLMS framing.". Also the meter doesnt response to AARQ packet with AARE. Can you please check if AARQ packet is correct ? I have parsed the above message and found no errors. All fields including CRC seems to be correct.

Kurumi
Kurumi's picture

Hi,

There are invalid data at the end of the packet (e6 e6 00). Remove them.
BR,

Mikko

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

jan.kolar

Is this a bug in Gurux.dlms.cpp library ? I see these bytes are added in int CGXDLMS::GetLNPdu method.

Best regards,
Ján Kolár

Kurumi
Kurumi's picture

Hi,

You are right we have broken this. I added an issue from this.
https://www.gurux.fi/node/13783

Then new version is on tests and it's released later today.

BR,

Mikko

BR,
Mikko

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

jan.kolar

Thank you. I have also found another small error in GuruxDLMSClientExample project in method CGXCommunication::Read. When the overlapped operation fails because of timeout, you dont cancel read operation. I changed it like this:

//Wait until data is actually read
if (::WaitForSingleObject(m_osReader.hEvent, m_WaitTime) != WAIT_OBJECT_0)
{
(!CancelIo(m_hComPort))
{
return DLMS_ERROR_CODE_RECEIVE_FAILED;
}

GetOverlappedResult(m_hComPort, &m_osReader, &bytesRead, TRUE);
return DLMS_ERROR_CODE_RECEIVE_FAILED;
}

Without calling CancelIo later write operation will cause that first byte received from meter will be swallowed by background overlapped read operation. GetOverlappedResult is needed because CancelIo itself is asynchronous.

Best regards,
Ján Kolár

Kurumi
Kurumi's picture

Hi Ján,

Thank you from this info. Is this happening in Linux or Windows?
We'll check this.

BR,

Mikko

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

jan.kolar

Windows.

Best regards,
Ján Kolár

Kurumi
Kurumi's picture

Hi Ján,

Thanks from this info. We'll make a test environment and test this. A new version was released yesterday.

BR,

Mikko

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