I set them based on the meter codes.
I did not understand what you said??????????
void setup() {
GXTRACE(GET_STR_FROM_EEPROM("Start application"), NULL);
BYTE_BUFFER_INIT(&frameData);
//Set frame capacity.
bb_capacity(&frameData, 128);
// Client.init(true, 16, Client.GetServerAddress(1,0x157D,2), DLMS_AUTHENTICATION_NONE, NULL, DLMS_INTERFACE_TYPE_HDLC);
////Un-comment this if you want to set system title, block cipher key or authentication key.
//
Client.SetSecurity(DLMS_SECURITY_AUTHENTICATION_ENCRYPTION);
//TODO: Change logical name of the frame counter if it's used to com_readAllObjects.
gxByteBuffer bb;
bb_init(&bb);
bb_addHexString(&bb, "31 32 33 34 35 36 37 38");
Client.SetSystemTitle(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF");
Client.SetAuthenticationKey(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
Client.SetBlockCipherKey(&bb);
bb_clear(&bb);
Client.SetInvocationCounter(0x59c);
// //Serial 1 is used to send trace.
Client.init(true, 1, Client.GetServerAddress(1,0x157D,0), DLMS_AUTHENTICATION_HIGH_GMAC, NULL, DLMS_INTERFACE_TYPE_HDLC);
Serial1.begin(9600);
// start serial port at 9600 bps:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
}
Can you get a hex trace from the messages that you are sending and receiving in Arduino?
There are several different parameters in DLMS and if one is different then the meter expects the connection fails.
hi
hex sent code to meter----
com_initializeConnection failed 279
recieve of meter:
:com_initializeConnection failed 279<HT> :Start reading<HT> :com_initializeConnection failed 279<HT> :Start reading<HT>
------------------------------
sent hex to meter:
7E A0 00 02 54 FB 03 10 25 D4 E6 E6 00 60 4A A1 09 06 07 60 85 74 05 08 01 01 A6 0A 04 08 41 42 43 44 45 46 47 48 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 C0 E0 70 B8 DC EE 77 3B 9D 4E A7 D3 69 34 9A CD BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 1D FF FF 7A 5A 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 5B 00 02 54 FB 03 10 25 D4 E6 E6 00 60 4A A1 09 06 07 60 85 74 05 08 01 01 A6 0A 04 08 41 42 43 44 45 46 47 48 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 E6 F3 79 BC DE EF 77 BB DD 6E 37 9B CD 66 33 99 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 1D FF FF F9 82 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 5B 00 02 54 FB 03 10 25 D4 E6 E6 00 60 4A A1 09 06 07 60 85 74 05 08 01 01 A6 0A 04 08 41 42 43 44 45 46 47 48 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 CC E6 F3 F9 7C BE 5F 2F 17 0B 05 02 81 C0 E0 F0 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 1D FF FF D3 89 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E
----------------
my code arduino
void setup() {
GXTRACE(GET_STR_FROM_EEPROM("Start application"), NULL);
BYTE_BUFFER_INIT(&frameData);
//Set frame capacity.
bb_capacity(&frameData, 128);
// Client.init(true, 16, Client.GetServerAddress(1,0x157D,2), DLMS_AUTHENTICATION_NONE, NULL, DLMS_INTERFACE_TYPE_HDLC);
////Un-comment this if you want to set system title, block cipher key or authentication key.
Client.SetSecurity(DLMS_SECURITY_AUTHENTICATION_ENCRYPTION);
//TODO: Change logical name of the frame counter if it's used to com_readAllObjects.
gxByteBuffer bb;
bb_init(&bb);
bb_addHexString(&bb, "31 32 33 34 35 36 37 38");
Client.SetSystemTitle(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF");
Client.SetAuthenticationKey(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
Client.SetBlockCipherKey(&bb);
bb_clear(&bb);
//Client.SetInvocationCounter(0x1699);
Client.init(true,1, Client.GetServerAddress(0x1,0x157D,2), DLMS_AUTHENTICATION_HIGH_GMAC,NULL, DLMS_INTERFACE_TYPE_HDLC);
Serial1.begin(9600);
// start serial port at 9600 bps:
Serial2.begin(9600);
while (!Serial2) {
; // wait for serial port to connect. Needed for native USB port only
}
}
void loop() {
int ret;
if (millis() - runTime > 5000)
{
runTime = millis();
GXTRACE(GET_STR_FROM_EEPROM("Start reading"), NULL);
//TODO: Change logical name of the frame counter if it's used.
ret = com_readAllObjects("0.0.43.1.0.255");
//
com_close();
}
}
--------------------------------------
image gxdlms director
Hello, thank you for your answer. I have used it once, and if I do not use it, how should I set the client and server address, and in the upper part of it, there is a comment command.
The problem is that init will clear all the settings that you have set before calling it. You can use it like this.
BR,
Mikko
Client.init(true,1, Client.GetServerAddress(0x1,0x157D,2), DLMS_AUTHENTICATION_HIGH_GMAC,NULL, DLMS_INTERFACE_TYPE_HDLC);
Client.SetSecurity(DLMS_SECURITY_AUTHENTICATION_ENCRYPTION);
//TODO: Change logical name of the frame counter if it's used to com_readAllObjects.
gxByteBuffer bb;
bb_init(&bb);
bb_addHexString(&bb, "31 32 33 34 35 36 37 38");
Client.SetSystemTitle(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF");
Client.SetAuthenticationKey(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
Client.SetBlockCipherKey(&bb);
bb_clear(&bb);
//Client.SetInvocationCounter(0x1699);
Reject all the changes and start with the initial project. Change this code and add hex trace here:
I changed the last byte of the client system title, so we can see that your code is the correct one from the hex trace.
BR,
Mikko
Client.init(true,1, Client.GetServerAddress(0x1,0x157D,2), DLMS_AUTHENTICATION_HIGH_GMAC,NULL, DLMS_INTERFACE_TYPE_HDLC);
Client.SetSecurity(DLMS_SECURITY_AUTHENTICATION_ENCRYPTION);
//TODO: Change logical name of the frame counter if it's used to com_readAllObjects.
gxByteBuffer bb;
bb_init(&bb);
bb_addHexString(&bb, "31 32 33 34 35 36 37 39");
Client.SetSystemTitle(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF");
Client.SetAuthenticationKey(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
Client.SetBlockCipherKey(&bb);
bb_clear(&bb);
This hex trace looks good. Now the ciphering is used.
The meter doesn't allow to read invocation counter without authentication.
You need to change the client address from 16 to something else in com_updateInvocationCounter.
Or then set invocation counter manually and change:
com_readAllObjects("0.0.43.1.0.255");
to:
com_readAllObjects(NULL);
I can read it with the address of client 16 with the following command:
Client.init(true,16, Client.GetServerAddress(0x1,0x157D,2), DLMS_AUTHENTICATION_NONE,NULL, DLMS_INTERFACE_TYPE_HDLC);
The client sends a challenge that is authenticated and encrypted, but the meter returns a challenge that is only authenticated. Encryption should be applied, but now it is missing and I believe that is causing the problem here.
You can make an ad-hoc fix for this if you want to.
Find ParseApplicationAssociationResponse and uncomment it. Now the client is not checking the server challenge and the connection succeeds.
if (Client.GetAuthentication() > DLMS_AUTHENTICATION_LOW)
{
if ((ret = Client.GetApplicationAssociationRequest(&messages)) != 0 ||
(ret = com_readDataBlock(&messages, &reply)) != 0)
// ||(ret = Client.ParseApplicationAssociationResponse(&reply.data)) != 0)
{
mes_clear(&messages);
reply_clear(&reply);
return ret;
}
I commented on that part, the problem was not solved, I think the problem is that we do not save a part:
int com_updateInvocationCounter(const char* invocationCounter)
{
int ret = DLMS_ERROR_CODE_OK;
//Read frame counter if security is used.
if (invocationCounter != NULL && Client.GetSecurity() != DLMS_SECURITY_NONE)
{
uint32_t ic = 0;
message messages;
gxReplyData reply;
unsigned short add = Client.GetClientAddress();
DLMS_AUTHENTICATION auth = Client.GetAuthentication();
DLMS_SECURITY security = Client.GetSecurity();
We don't have any meter that is working like this. If you send a hex trace from the sent and received bytes we can make a simulated meter next week and try to solve this.
I connect with the software without any problem. Is the problem in another part? Can I find the part you عuncomment ParseApplicationAssociationResponse? Where can I send it hex trace to you?
I think because this part is not set(CGXByteBuffer challenge = m_Parser->GetCtoSChallenge();), it will cause an error that is related to this error in this file?
if (m_Parser->GetAuthentication() > DLMS_AUTHENTICATION_LOW)
{
if ((ret = m_Parser->GetApplicationAssociationRequest(data)) != 0 ||
(ret = ReadDataBlock(data, reply)) != 0 ||
(ret = m_Parser->ParseApplicationAssociationResponse(reply.GetData())) != 0)
{
printf("Authentication failed (%d) %s\n", ret, CGXDLMSConverter::GetErrorMessage(ret));
return ret;
}
}
what is your opinion Sir?
But in Arduino it is different Sir?
int com_updateInvocationCounter(const char* invocationCounter)
{
int ret = DLMS_ERROR_CODE_OK;
//Read frame counter if security is used.
if (invocationCounter != NULL && Client.GetSecurity() != DLMS_SECURITY_NONE)
{
uint32_t ic = 0;
message messages;
gxReplyData reply;
unsigned short add = Client.GetClientAddress();
DLMS_AUTHENTICATION auth = Client.GetAuthentication();
DLMS_SECURITY security = Client.GetSecurity();
I also looked in the files you posted client example c and they are different from Arduino in this part?
//Read Invocation counter (frame counter) from the meter and update it.
int com_updateInvocationCounter(
connection* connection,
const char* invocationCounter)
{
int ret = DLMS_ERROR_CODE_OK;
//Read frame counter if GeneralProtection is used.
if (invocationCounter != NULL && connection->settings.cipher.security != DLMS_SECURITY_NONE)
{
message messages;
gxReplyData reply;
unsigned short add = connection->settings.clientAddress;
DLMS_AUTHENTICATION auth = connection->settings.authentication;
DLMS_SECURITY security = connection->settings.cipher.security;
gxByteBuffer challenge;
bb_init(&challenge);
bb_set(&challenge, connection->settings.ctoSChallenge.data, connection->settings.ctoSChallenge.size);
connection->settings.clientAddress = 16;
hi sir
I also run the GuruxDLMSClientExamplefile, but unfortunately it has this problem, it reads the counter correctly, but it encounters this problem.
GuruxDLMSClientExample.exe -S COM8 -c 1 -s 21885 -a HighGMAC -C AuthenticationEncryption -T 3132333435363738 -A D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF -B 000102030405060708090A0B0C0D0E0F -v 0.0.43.1.0.255
updateInvocationCounter
Invocation counter: -28671 (0xFFFF9001)
InitializeConnection
OperationNotPossible
This has been tested now with a few different meters and it works every time.
Can you add the hex trace from GuruxDLMSClientExample so I can check the bytes?
If you can read the meter with GuruxDLMSClientExample I can compare what is the difference between the bytes and tell what settings you need to change.
Hello, according to you. I run the GuruxDLMSClientExample.exe and got the values from the Gxdlsdirector, but it gives the answer
C:\Users\Benyamin\Documents\stm32\stm32f429\arduino gurux c\GuruxDLMS.c-master\GuruxDLMSClientExample\VS\x64\Release>GuruxDLMSClientExample.exe -S COM11 -c 1 -s 21885 -a HighGmac -C AuthenticationEncryption -T 3132333435363738 -A D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF -B 000102030405060708090A0B0C0D0E0F -v 0.0.43.1.0.255 -t Verbose
updateInvocationCounter
Are you sure that your meter is supporting HighGMAC authentication level? The meter is returning AuthenticationRequired. Can you ask this from the meter manufacturer or try to connect using Low or High authentication?
Hello, sir
I connected with Python and the software with the same device and there is no problem, but with this example client C this problem occurs!???
I'm sorry. I was wrong. There are a few differences in the bytes. I'll check what might cause that and get back to this. I'll remove my previous comment so it doesn't cause misunderstanding if I'm reading this topic again.
There is something strange in this, but I don't know the reason yet.
There are four bytes missing in your client to server challenge, but when I tested this with Android Mega, bytes are there and everything works like expected.
Are you getting any warnings when you compile this?
If you select "File" and "Preferences" is your "Additional Boards Manager URDs:" empty or are you using some additional board manager?
------------------------
Hi, the first part is for example GuruxDLMS.c/GuruxDLMSClientExample, which has a problemOperationNotPossible I put the code hex in it. the second part with Python, which is successful. I think the problem is that the size glo_ActionRequest is different.
Hi,
Hi,
You need to update authentication and block cipher keys to the same as your meter is using.
Now you are using the default keys.
BR,
Mikko
I set them based on the meter
I set them based on the meter codes.
I did not understand what you said??????????
void setup() {
GXTRACE(GET_STR_FROM_EEPROM("Start application"), NULL);
BYTE_BUFFER_INIT(&frameData);
//Set frame capacity.
bb_capacity(&frameData, 128);
// Client.init(true, 16, Client.GetServerAddress(1,0x157D,2), DLMS_AUTHENTICATION_NONE, NULL, DLMS_INTERFACE_TYPE_HDLC);
////Un-comment this if you want to set system title, block cipher key or authentication key.
//
Client.SetSecurity(DLMS_SECURITY_AUTHENTICATION_ENCRYPTION);
//TODO: Change logical name of the frame counter if it's used to com_readAllObjects.
gxByteBuffer bb;
bb_init(&bb);
bb_addHexString(&bb, "31 32 33 34 35 36 37 38");
Client.SetSystemTitle(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF");
Client.SetAuthenticationKey(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
Client.SetBlockCipherKey(&bb);
bb_clear(&bb);
Client.SetInvocationCounter(0x59c);
// //Serial 1 is used to send trace.
Client.init(true, 1, Client.GetServerAddress(1,0x157D,0), DLMS_AUTHENTICATION_HIGH_GMAC, NULL, DLMS_INTERFACE_TYPE_HDLC);
Serial1.begin(9600);
// start serial port at 9600 bps:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
}
gxdlms director
gxdlms director
gxdlms director
gxdlms director
Hi,
Hi,
Have you updated the Invocation Counter to 91?
Can you get a hex trace from the messages that you are sending and receiving in Arduino?
There are several different parameters in DLMS and if one is different then the meter expects the connection fails.
BR,
Mikko
Hi, I am not able to do this,
Hi, I am not able to do this, but I read it in the software, the number is 435, and one added cream to it, and I updated it in the code.
my code
my code
Hi,
Hi,
Please, don't add code as a picture. It's hard to read. Plain text is better.
The invocation counter is increased with every reading. Have you tried to read it automatically using Logical Name 0.0.43.1.0.255?
There is nothing that I can do if I don't have a hex trace from the send and received bytes.
BR,
Mikko
hi
hi
hex sent code to meter----
com_initializeConnection failed 279
recieve of meter:
:com_initializeConnection failed 279<HT> :Start reading<HT> :com_initializeConnection failed 279<HT> :Start reading<HT>
------------------------------
sent hex to meter:
7E A0 00 02 54 FB 03 10 25 D4 E6 E6 00 60 4A A1 09 06 07 60 85 74 05 08 01 01 A6 0A 04 08 41 42 43 44 45 46 47 48 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 C0 E0 70 B8 DC EE 77 3B 9D 4E A7 D3 69 34 9A CD BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 1D FF FF 7A 5A 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 5B 00 02 54 FB 03 10 25 D4 E6 E6 00 60 4A A1 09 06 07 60 85 74 05 08 01 01 A6 0A 04 08 41 42 43 44 45 46 47 48 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 E6 F3 79 BC DE EF 77 BB DD 6E 37 9B CD 66 33 99 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 1D FF FF F9 82 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 5B 00 02 54 FB 03 10 25 D4 E6 E6 00 60 4A A1 09 06 07 60 85 74 05 08 01 01 A6 0A 04 08 41 42 43 44 45 46 47 48 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 CC E6 F3 F9 7C BE 5F 2F 17 0B 05 02 81 C0 E0 F0 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 1D FF FF D3 89 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E
----------------
my code arduino
void setup() {
GXTRACE(GET_STR_FROM_EEPROM("Start application"), NULL);
BYTE_BUFFER_INIT(&frameData);
//Set frame capacity.
bb_capacity(&frameData, 128);
// Client.init(true, 16, Client.GetServerAddress(1,0x157D,2), DLMS_AUTHENTICATION_NONE, NULL, DLMS_INTERFACE_TYPE_HDLC);
////Un-comment this if you want to set system title, block cipher key or authentication key.
Client.SetSecurity(DLMS_SECURITY_AUTHENTICATION_ENCRYPTION);
//TODO: Change logical name of the frame counter if it's used to com_readAllObjects.
gxByteBuffer bb;
bb_init(&bb);
bb_addHexString(&bb, "31 32 33 34 35 36 37 38");
Client.SetSystemTitle(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF");
Client.SetAuthenticationKey(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
Client.SetBlockCipherKey(&bb);
bb_clear(&bb);
//Client.SetInvocationCounter(0x1699);
Client.init(true,1, Client.GetServerAddress(0x1,0x157D,2), DLMS_AUTHENTICATION_HIGH_GMAC,NULL, DLMS_INTERFACE_TYPE_HDLC);
Serial1.begin(9600);
// start serial port at 9600 bps:
Serial2.begin(9600);
while (!Serial2) {
; // wait for serial port to connect. Needed for native USB port only
}
}
void loop() {
int ret;
if (millis() - runTime > 5000)
{
runTime = millis();
GXTRACE(GET_STR_FROM_EEPROM("Start reading"), NULL);
//TODO: Change logical name of the frame counter if it's used.
ret = com_readAllObjects("0.0.43.1.0.255");
//
com_close();
}
}
--------------------------------------
image gxdlms director
When I successfully connect
When I successfully connect to the dlms director, the following messages are generated, which is different from Ardino connection messages?
00:38:30 Send SNRM request.
TX: 7E A0 0A 00 02 54 FB 21 93 2F 9F 7E
00:38:30
RX: 7E A0 23 21 00 02 54 FB 73 8F B4 81 80 14 05 02 01 00 06 02 01 00 07 04 00 00 00 01 08 04 00 00 00 01 69 6D 7E
00:38:30 Send AARQ request.
TX: 7E A0 2E 00 02 54 FB 21 10 49 25 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
00:38:30
RX: 7E A0 3A 21 00 02 54 FB 30 E0 30 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 10 10 05 00 00 07 8D FF 7E
00:38:30
RX: 7E A0 18 21 00 02 54 FB 52 CC 24 E6 E7 00 C4 01 C1 00 06 00 00 06 A3 3C DB 7E
00:38:30 Disconnect request
TX: 7E A0 0A 00 02 54 FB 21 53 23 59 7E
00:38:30
RX: 7E A0 0A 21 00 02 54 FB 73 35 96 7E
00:38:30 Send SNRM request.
TX: 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E
00:38:30
RX: 7E A0 23 03 00 02 54 FB 73 B9 39 81 80 14 05 02 01 00 06 02 01 00 07 04 00 00 00 01 08 04 00 00 00 01 69 6D 7E
00:38:30 Send AARQ request.
TX: 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 73 08 1A 74 75 32 2D 4C 24 1E 60 5E 2C 3A 3B 73 BE 23 04 21 21 1F 30 00 00 06 A4 D0 37 8E 8C EB 28 D0 36 15 3B D9 12 BF 2A 61 45 73 AB 6C 0A EF 17 43 37 B6 EE C3 F3 7E
00:38:31
RX: 7E A0 72 03 00 02 54 FB 30 3C A4 E6 E7 00 61 61 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 45 41 41 07 00 2D 8A 35 88 02 07 80 89 07 60 85 74 05 08 02 05 AA 0A 80 08 07 6E B0 B8 CA D2 1A 0E BE 23 04 21 28 1F 30 00 00 00 40 09 6C 1B 11 23 BA A8 7E 0D 91 1D 1A 6A A4 55 8F C2 5F F0 C9 32 F4 26 61 40 84 09 60 7E
00:38:31 Authenticating.
TX: 7E A0 42 00 02 54 FB 03 32 C5 22 E6 E6 00 CB 31 30 00 00 06 A5 3D CE EC B2 A1 82 29 D1 98 49 45 62 69 84 EE B8 F2 42 DD 8C AC 1A CD DE 79 B2 9A E5 0A 28 63 C7 57 93 E9 61 C5 F4 44 5E 46 44 D7 92 0E AF 7E
00:38:31
RX: 7E A0 3B 03 00 02 54 FB 52 17 62 E6 E7 00 CF 2A 30 00 00 00 41 11 88 67 40 7F 15 04 5F B0 DA D1 31 C8 7C 87 FF 4B 88 D0 03 BD DB 31 AA 45 6B CD 24 29 97 13 25 C5 A3 05 25 12 96 9A 7E
00:39:21 Send Keep Alive
TX: 7E A0 2F 00 02 54 FB 03 54 3F AE E6 E6 00 C8 1E 30 00 00 06 A6 8D A2 CA AB A2 C4 8D 11 32 8F 67 BD 14 FE 83 94 42 6B 71 23 18 B6 53 C6 55 8A 7F 7E
00:39:21
RX: 7E A0 2E 03 00 02 54 FB 74 49 63 E6 E7 00 CC 1D 30 00 00 00 42 08 74 BE C0 DA 01 33 A8 FE F5 08 F8 31 EE D5 3A B4 FE EB 8B A1 E6 76 5C 43 29 7E
00:40:11 Send Keep Alive
TX: 7E A0 2F 00 02 54 FB 03 76 2F AC E6 E6 00 C8 1E 30 00 00 06 A7 3F 1B AD F8 A8 C0 B1 58 A2 75 31 89 59 E3 57 5B 8C C7 CE D7 29 BB 5A 5B 3A 2A 98 7E
00:40:11
RX: 7E A0 2E 03 00 02 54 FB 96 55 A7 E6 E7 00 CC 1D 30 00 00 00 43 B8 87 33 6E E1 8C AE E0 23 36 2B E5 A7 25 37 37 46 A2 B8 13 DF 84 7A 5B 23 3E 7E
00:41:01 Send Keep Alive
TX: 7E A0 2F 00 02 54 FB 03 98 5F A2 E6 E6 00 C8 1E 30 00 00 06 A8 09 4A 35 7A B8 E9 8E EB BD DC 71 1B 1E A6 02 DD 5D 07 99 53 4E 32 0A C7 A7 85 64 7E
00:41:01
RX: 7E A0 2E 03 00 02 54 FB B8 29 6F E6 E7 00 CC 1D 30 00 00 00 44 59 34 EA B0 C5 DB A4 39 7E 58 93 70 D4 15 67 A9 E9 51 37 77 5A 7A 30 F1 C4 F8 7E
00:41:51 Send Keep Alive
TX: 7E A0 2F 00 02 54 FB 03 BA 4F A0 E6 E6 00 C8 1E 30 00 00 06 A9 CF 61 56 43 EE C5 4E 5A 2C 52 EE 3B 56 3F 75 DA 99 C8 C0 9E 7F 35 B7 EE 9E 4C A7 7E
00:41:51
RX: 7E A0 2E 03 00 02 54 FB DA 3D 2F E6 E7 00 CC 1D 30 00 00 00 45 46 B3 6E 02 7D 23 ED 07 4A F3 1F 7D CF 08 BC 2F 25 58 2E 31 EA F0 C3 38 2C 25 7E
00:42:41 Send Keep Alive
TX: 7E A0 2F 00 02 54 FB 03 DC 7F A6 E6 E6 00 C8 1E 30 00 00 06 AA CE 27 8C 3E EF 3C BF 82 D8 D4 44 38 5A 15 D4 AB 58 95 23 A2 E8 28 25 3A 9A 52 A5 7E
00:42:41
RX: 7E A0 2E 03 00 02 54 FB FC 09 6B E6 E7 00 CC 1D 30 00 00 00 46 E5 7B A7 C6 AE AE 85 EF E5 12 42 22 98 FF E7 EF 7B E1 52 23 E4 5F F6 2C 10 3B 7E
Hi,
Hi,
You call Client.init twice. The last init will clear the security settings and a secured connection is not used. Remove the last init call.
BR,
Mikko
Hello, thank you for your
Hello, thank you for your answer. I have used it once, and if I do not use it, how should I set the client and server address, and in the upper part of it, there is a comment command.
Hi,
Hi,
The problem is that init will clear all the settings that you have set before calling it. You can use it like this.
BR,
Mikko
Client.init(true,1, Client.GetServerAddress(0x1,0x157D,2), DLMS_AUTHENTICATION_HIGH_GMAC,NULL, DLMS_INTERFACE_TYPE_HDLC);
Client.SetSecurity(DLMS_SECURITY_AUTHENTICATION_ENCRYPTION);
//TODO: Change logical name of the frame counter if it's used to com_readAllObjects.
gxByteBuffer bb;
bb_init(&bb);
bb_addHexString(&bb, "31 32 33 34 35 36 37 38");
Client.SetSystemTitle(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF");
Client.SetAuthenticationKey(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
Client.SetBlockCipherKey(&bb);
bb_clear(&bb);
//Client.SetInvocationCounter(0x1699);
BR,
Mikko
sent hex to meter:
sent hex to meter:
7E A0 0A 00 02 54 FB 15 93 ED 4E 7E 7E A0 2E 00 02 54 FB 15 10 8B F4 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 7E A0 2E 00 02 54 FB 15 10 8B F4 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 7E A0 2E 00 02 54 FB 15 10 8B F4 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 7E A0 2E 00 02 54 FB 15 10 8B F4 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 7E A0 0A 00 02 54 FB 15 53 E1 88 7E 7E A0 0A 00 02 54 FB 15 93 ED 4E 7E 7E A0 2E 00 02 54 FB 15 10 8B F4 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 7E A0 2E 00 02 54 FB 15 10 8B F4 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 7E A0 2E 00 02 54 FB 15 10 8B F4 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
----------------
n<HT> :Start reading<HT> :Received bytes: <LF>
0<HT> :Data send failed. Try to resend. 1<HT> :Received bytes: <LF>
0<HT> :Data send failed. Try to resend. 2<HT> :Received bytes: <LF>
0<HT> :Data send failed. Try to resend. 3<HT> :Received bytes: <LF>
0<HT> :Start reading<HT> :Received bytes: <LF>
0<HT> :Data send failed. Try to resend. 1
-----------------
my code
void setup() {
GXTRACE(GET_STR_FROM_EEPROM("Start application"), NULL);
BYTE_BUFFER_INIT(&frameData);
//Set frame capacity.
bb_capacity(&frameData, 128);
///////////////////////////////////////////Client.init(true, 16, Client.GetServerAddress(1,0x157D,2), DLMS_AUTHENTICATION_NONE, NULL, DLMS_INTERFACE_TYPE_HDLC);
Client.init(true,1, Client.GetServerAddress(1,0x157D,2), DLMS_AUTHENTICATION_HIGH_GMAC,NULL, DLMS_INTERFACE_TYPE_HDLC);
////Un-comment this if you want to set system title, block cipher key or authentication key.
Client.SetSecurity(DLMS_SECURITY_AUTHENTICATION_ENCRYPTION);
//TODO: Change logical name of the frame counter if it's used to com_readAllObjects.
gxByteBuffer bb;
bb_init(&bb);
bb_addHexString(&bb, "31 32 33 34 35 36 37 38 ");
Client.SetSystemTitle(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF");
Client.SetAuthenticationKey(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
Client.SetBlockCipherKey(&bb);
bb_clear(&bb);
//Client.SetInvocationCounter(0x169A);
Serial1.begin(9600);
// start serial port at 9600 bps:
Serial2.begin(9600);
while (!Serial2) {
; // wait for serial port to connect. Needed for native USB port only
}
}
void loop() {
int ret;
if (millis() - runTime > 5000)
{
runTime = millis();
GXTRACE(GET_STR_FROM_EEPROM("Start reading"), NULL);
//TODO: Change logical name of the frame counter if it's used.
ret = com_readAllObjects("0.0.43.1.0.255");
//
com_close();
}
}
Hi,
Hi,
Are you sure that you haven't modified the source files? I did try with the code that I added and signing was used without problems.
BR,
Mikko
I have not changed the source
I have not changed the source code
hex sent:
hex sent:
79 0A DE 83 F9 9A 31 DB FF 8F 89 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 21 93 2F 9F 7E 7E A0 2E 00 02 54 FB 21 10 49 25 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 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E 7E A0 0A 00 02 54 FB 21 53 23 59 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 4B 25 12 09 84 42 A1 D0 E8 74 BA 5D 2E 97 4B 25 BE 23 04 21 21 1F 30 00 00 07 D6 E8 EC D3 A8 C9 34 2A E6 51 12 B1 FE 6D 48 2A 78 31 E4 AC 7A 3C 34 E0 A1 F4 E5 8E D7 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 07 D7 53 87 A7 95 A1 48 4C A8 4F 48 E3 30 B7 BB DB 1D F7 8B 94 11 B9 2B 04 45 A7 73 C4 C3 CF 6D EE EF 02 BD 66 61 8F 98 D7 3F 21 66 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 21 93 2F 9F 7E 7E A0 2E 00 02 54 FB 21 10 49 25 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 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E 7E A0 0A 00 02 54 FB 21 53 23 59 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 12 09 04 02 81 C0 60 30 98 4C 26 93 49 A4 52 A9 BE 23 04 21 21 1F 30 00 00 07 D9 A1 7F F5 A3 95 15 3E 1B 6E 51 F9 71 9C 58 74 3D BF D7 4D F5 02 90 33 DA 4E D1 97 28 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 07 DA 1A 51 88 80 29 17 E4 37 3B 33 10 52 A0 F6 2A 6C 94 00 99 D8 38 E0 12 60 35 1A D2 C2 12 79 8D 0B 8E ED BC B7 DB E5 6C 54 A2 34 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 21 93 2F 9F 7E 7E A0 2E 00 02 54 FB 21 10 49 25 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 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E 7E A0 0A 00 02 54 FB 21 53 23 59 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 D4 EA 75 3A 9D 4E 27 13 89 C4 62 B1 58 AC 56 AB BE 23 04 21 21 1F 30 00 00 07 DC A8 B5 D1 71 46 DF 4C A1 CA 08 58 50 7A 19 F3 84 92 32 D5 0E 2B 50 4E E8 7D 5D B4 2D 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 07 DD 4E 42 FB 7F 51 06 0D 70 D2 DC 57 9C AD C2 BA 31 82 A5 86 61 5D 81 70 1C 5C 9F 75 47 5A B5 B1 10 DE D0 EB 4E 51 E4 CE 67 36 51 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E
------------------------------
recieve serial monitor:
n<HT> :Start reading<HT> :Received bytes: <LF>
0<HT> :Data send failed. Try to resend. 1<HT> :Received bytes: <LF>
0<HT> :Data send failed. Try to resend. 2<HT> :Received bytes: <LF>
0<HT> :Data send failed. Try to resend. 3<HT> :Received bytes: <LF>
0<HT> :Start reading<HT> :Invocation Counter: 1969<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 1972<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 1975<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 1978<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 1981<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 1984<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 1987<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 1990<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 1993<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 1996<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 1999<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 2002<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 2005<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 2008<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 2011<HT> :com_initializeConnection failed 258
--------------------
I downloaded the code from Github again
Hi,
Hi,
Reject all the changes and start with the initial project. Change this code and add hex trace here:
I changed the last byte of the client system title, so we can see that your code is the correct one from the hex trace.
BR,
Mikko
Client.init(true,1, Client.GetServerAddress(0x1,0x157D,2), DLMS_AUTHENTICATION_HIGH_GMAC,NULL, DLMS_INTERFACE_TYPE_HDLC);
Client.SetSecurity(DLMS_SECURITY_AUTHENTICATION_ENCRYPTION);
//TODO: Change logical name of the frame counter if it's used to com_readAllObjects.
gxByteBuffer bb;
bb_init(&bb);
bb_addHexString(&bb, "31 32 33 34 35 36 37 39");
Client.SetSystemTitle(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF");
Client.SetAuthenticationKey(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
Client.SetBlockCipherKey(&bb);
bb_clear(&bb);
Hi,
Hi,
This hex trace looks good. Now the ciphering is used.
The meter doesn't allow to read invocation counter without authentication.
You need to change the client address from 16 to something else in com_updateInvocationCounter.
Or then set invocation counter manually and change:
com_readAllObjects("0.0.43.1.0.255");
to:
com_readAllObjects(NULL);
BR,
Mikko
I applied these settings
I applied these settings
void setup() {
GXTRACE(GET_STR_FROM_EEPROM("Start application"), NULL);
BYTE_BUFFER_INIT(&frameData);
//Set frame capacity.
bb_capacity(&frameData, 128);
Client.init(true,1, Client.GetServerAddress(0x1,0x157D,2), DLMS_AUTHENTICATION_HIGH_GMAC,NULL, DLMS_INTERFACE_TYPE_HDLC);
Client.SetSecurity(DLMS_SECURITY_AUTHENTICATION_ENCRYPTION);
//TODO: Change logical name of the frame counter if it's used to com_readAllObjects.
gxByteBuffer bb;
bb_init(&bb);
bb_addHexString(&bb, "31 32 33 34 35 36 37 39");
Client.SetSystemTitle(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF");
Client.SetAuthenticationKey(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
Client.SetBlockCipherKey(&bb);
bb_clear(&bb);
//Serial 1 is used to send trace.
Serial1.begin(115200);
// start serial port at 9600 bps:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
}
void loop() {
int ret;
if (millis() - runTime > 5000)
{
runTime = millis();
GXTRACE(GET_STR_FROM_EEPROM("Start reading"), NULL);
//TODO: Change logical name of the frame counter if it's used.
ret = com_readAllObjects("0.0.43.1.0.255");
com_close();
}
}
----------------------------------
sent hex:
7E A0 0A 00 02 54 FB 21 93 2F 9F 7E 7E A0 2E 00 02 54 FB 21 10 49 25 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 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E 7E A0 0A 00 02 54 FB 21 53 23 59 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 39 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 70 38 9C CE 67 B3 59 AC 56 AB 55 2A 15 8A 45 22 BE 23 04 21 21 1F 30 00 00 09 4D C7 93 A0 28 2D 75 91 9E F7 72 38 C9 8B 89 BA 94 5B A8 08 4C F7 FF 7F AB 0D BC C4 7E 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 09 4E 77 DA DD FE 49 29 C2 0D 2A 92 60 42 C2 FE D3 4B FB 5F 54 06 0A E5 A8 37 BA 30 15 31 F4 8F 90 ED 8D EB 92 49 1C 0A AD 1D 98 4A 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E
--------
serial monitor
<HT> :Start reading<HT> :Invocation Counter: 2380<HT> :com_initializeConnection failed 258
I can read it with the
I can read it with the address of client 16 with the following command:
Client.init(true,16, Client.GetServerAddress(0x1,0x157D,2), DLMS_AUTHENTICATION_NONE,NULL, DLMS_INTERFACE_TYPE_HDLC);
258<HT> :Start reading<HT>
1/7/2022 14:43:12.334 [RX] - Counter: 3232<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 3235<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 3238<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 3241<HT> :com_initializeConnection failed 258
-------------------------
sent hex code
1/7/2022 14:43:13.517 [RX] - 7E A0 0A 00 00 02 54 FB 03 53 A0 49 7E 82 C1 E0 70 38 9C CE 67 33 19 8C C6 BE 23 04 21 21 1F 30 00 00 0C A1 0A 73 48 93 66 60 C4 0E F1 83 E3 B2 2E 9B 75 83 C0 97 38 C0 11 A0 1A 2E 55 5F AA 72 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 0C A2 18 5E 2D 46 2B 39 B6 A8 BC BE CE 24 6C E2 A3 ED 4D F6 AC 07 04 1A 6C 6C 01 0C 03 75 CF 08 26 E4 CC CE 3F 5F D4 0C B5 FA C7 2B 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 82 C1 E0 70 38 9C CE 67 33 19 8C C6 BE 23 04 21 21 1F 30 00 00 0C A1 0A 73 48 93 66 60 C4 0E F1 83 E3 B2 2E 9B 75 83 C0 97 38 C0 11 A0 1A 2E 55 5F AA 72 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 0C A2 18 5E 2D 46 2B 39 B6 A8 BC BE CE 24 6C E2 A3 ED 4D F6 AC 07 04 1A 6C 6C 01 0C 03 75 CF 08 26 E4 CC CE 3F 5F D4 0C B5 FA C7 2B 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 21 93 2F 9F 7E 7E A0 2E 00 02 54 FB 21 10 49 25 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 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E 7E A0 0A 00 02 54 FB 21 53 23 59 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 E3 71 38 1C 8E 47 23 11 88 44 22 11 08 04 02 01 BE 23 04 21 21 1F 30 00 00 0C A4 BF DA 89 81 81 B5 C1 0C A0 47 24 57 41 47 F5 DA 8B F0 CA 50 04 2A E9 28 70 5A 3C 41 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 0C A5 A8 4F 6A 42 4B 04 7C 12 77 EF 9B C4 86 82 B3 53 44 BA 0B 6F F5 EB 5B 39 91 D5 59 72 3F 5A D8 3D 23 F9 0D 7C FA 41 B6 8A DA C6 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 21 93 2F 9F 7E 7E A0 2E 00 02 54 FB 21 10 49 25 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 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E 7E A0 0A 00 02 54 FB 21 53 23 59 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 80 C0 E0 F0 F8 FC FE 7F BF 5F 2F 97 CB 65 B2 D9 BE 23 04 21 21 1F 30 00 00 0C A7 53 82 F0 0E 4F 66 90 42 F9 DB D5 CB A6 E3 EE F0 BA 46 0A 86 91 18 93 4E 46 89 FE 9E 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 0C A8 13 8C CD EC 8A 3C 98 82 E8 CE 1E F2 49 D9 0C 87 E7 71 CF 92 A9 8C 81 DE 7C AC 9E BB 10 5E 30 46 FA C0 82 BD CA B9 CD D4 17 7F 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 21 93 2F 9F 7E 7E A0 2E 00 02 54 FB 21 10 49 25 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 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E 7E A0 0A 00 02 54 FB 21 53 23 59 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 6C 36 9B 4D 26 13 89 C4 62 B1 58 2C 96 4B A5 52 BE 23 04 21 21 1F 30 00 00 0C AA E3 41 42 03 1D 5E 07 57 77 EC 19 AC A6 52 D5 55 BB 1C 17 17 4B 36 03 39 49 6B 98 07 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 0C AB 3F BC CA 7C DD A9 B8 17 B5 2C 72 14 6C 98 B2 23 59 FA 21 81 BB 36 74 2E 7F 04 9F 2F F3 7E FE C6 4E FF 74 F8 12 45 E3 90 53 4C 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E
Hi,
Hi,
The client sends a challenge that is authenticated and encrypted, but the meter returns a challenge that is only authenticated. Encryption should be applied, but now it is missing and I believe that is causing the problem here.
You can make an ad-hoc fix for this if you want to.
Find ParseApplicationAssociationResponse and uncomment it. Now the client is not checking the server challenge and the connection succeeds.
BR,
Mikko
if (Client.GetAuthentication(
if (Client.GetAuthentication() > DLMS_AUTHENTICATION_LOW)
{
if ((ret = Client.GetApplicationAssociationRequest(&messages)) != 0 ||
(ret = com_readDataBlock(&messages, &reply)) != 0)
// ||(ret = Client.ParseApplicationAssociationResponse(&reply.data)) != 0)
{
mes_clear(&messages);
reply_clear(&reply);
return ret;
}
I commented on that part, the problem was not solved, I think the problem is that we do not save a part:
int com_updateInvocationCounter(const char* invocationCounter)
{
int ret = DLMS_ERROR_CODE_OK;
//Read frame counter if security is used.
if (invocationCounter != NULL && Client.GetSecurity() != DLMS_SECURITY_NONE)
{
uint32_t ic = 0;
message messages;
gxReplyData reply;
unsigned short add = Client.GetClientAddress();
DLMS_AUTHENTICATION auth = Client.GetAuthentication();
DLMS_SECURITY security = Client.GetSecurity();
block cipher not save?
Hi,
Hi,
Block cipher or authentication keys are not saved because they aren't changed.
So, there is no need to save them.
BR,
Mikko
126 / 5,000
What should I do about this problem now?
ParseApplicationAssociationResponse I have to find this in uncomment on it
Hi,
Hi,
We don't have any meter that is working like this. If you send a hex trace from the sent and received bytes we can make a simulated meter next week and try to solve this.
BR,
Mikko
I connect with the software
I connect with the software without any problem. Is the problem in another part? Can I find the part you عuncomment ParseApplicationAssociationResponse? Where can I send it hex trace to you?
recive hex serial manitor:
recive hex serial manitor:
09 3A 53 74 61 72 74 20 72 65 61 64 69 6E 67 09 3A 49 6E 76 6F 63 61 74 69 6F 6E 20 43 6F 75 6E 74 65 72 3A 20 31 38 36 31 39 09 3A 63 6F 6D 5F 69 6E 69 74 69 61 6C 69 7A 65 43 6F 6E 6E 65 63 74 69 6F 6E 20 66 61 69 6C 65 64 20 32 35 38 09 3A 53 74 61 72 74 20 72 65 61 64 69 6E 67 09 3A 49 6E 76 6F 63 61 74 69 6F 6E 20 43 6F 75 6E 74 65 72 3A 20 31 38 36 32 32 09 3A 63 6F 6D 5F 69 6E 69 74 69 61 6C 69 7A 65 43 6F 6E 6E 65 63 74 69 6F 6E 20 66 61 69 6C 65 64 20 32 35 38 09 3A 53 74 61 72 74 20 72 65 61 64 69 6E 67 09 3A 49 6E 76 6F 63 61 74 69 6F 6E 20 43 6F 75 6E 74 65 72 3A 20 31 38 36 32 35 09 3A 63 6F 6D 5F 69 6E 69 74 69 61 6C 69 7A 65 43 6F 6E 6E 65 63 74 69 6F 6E 20 66 61 69 6C 65 64 20 32 35 38 09 3A 53 74 61 72 74 20 72 65 61 64 69 6E 67 09 3A 49 6E 76 6F 63 61 74 69 6F 6E 20 43 6F 75 6E 74 65 72 3A 20 31 38 36 32 38 09 3A 63 6F 6D 5F 69 6E 69 74 69 61 6C 69 7A 65 43 6F 6E 6E 65 63 74 69 6F 6E 20 66 61 69 6C 65 64 20 32 35 38
-ascii recieve serial monitor:
<HT> :Start reading<HT> :Invocation Counter: 18619<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 18622<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 18625<HT> :com_initializeConnection failed 258<HT> :Start reading<HT> :Invocation Counter: 18628<HT> :com_initializeConnection failed 258
----------------------
sent hex
7E A0 0A 00 02 54 FB 21 93 2F 9F 7E 7E A0 2E 00 02 54 FB 21 10 49 25 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 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E 7E A0 0A 00 02 54 FB 21 53 23 59 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 70 38 9C CE 67 B3 59 AC 56 AB 55 2A 15 8A 45 22 BE 23 04 21 21 1F 30 00 00 48 BC 56 3D 5D C5 36 6E 27 B5 60 24 95 F5 B2 E4 CE 7F 87 FB 0A D0 81 CA 6C CB 4A F7 F2 B5 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 48 BD 72 C0 4F 4D A1 67 9B 9E AA D4 10 FD 41 A6 C5 87 87 8A 01 12 B3 6C A6 09 FA 79 71 24 6A C0 29 58 45 95 F4 C3 A9 0C 6E AD 40 DF 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 21 93 2F 9F 7E 7E A0 2E 00 02 54 FB 21 10 49 25 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 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E 7E A0 0A 00 02 54 FB 21 53 23 59 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 91 C8 E4 72 39 1C 8E 47 A3 D1 E8 74 BA DD 6E 37 BE 23 04 21 21 1F 30 00 00 48 BF 39 A8 96 42 A3 1F E0 36 36 90 22 44 16 AB 23 7A 22 8D 26 47 0B 3A E9 AD F8 7C E9 3E 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 48 C0 D0 A4 46 5B C9 55 92 1E 3D A8 15 70 80 56 0E 2D 5A 46 71 2E 2C 20 80 13 03 87 4B 8A 6D 1B 49 20 01 A3 28 CB AA 43 CB 8C A8 64 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 21 93 2F 9F 7E 7E A0 2E 00 02 54 FB 21 10 49 25 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 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E 7E A0 0A 00 02 54 FB 21 53 23 59 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 1B 0D 86 43 21 10 88 C4 E2 71 B8 DC EE 77 3B 9D BE 23 04 21 21 1F 30 00 00 48 C2 D9 2F 2C 46 C3 62 89 5C 25 4A 46 9D 4B 7F D7 05 6C C7 A5 54 60 47 AD DA F5 A2 8B 86 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 48 C3 A8 6E 36 1D 81 36 C6 59 D9 C7 9F F3 14 43 45 B6 31 51 53 91 55 A8 C7 D3 18 0D 3C 74 F6 17 98 5B CA CB 87 6E 50 4F B8 52 6D 39 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E 7E A0 0A 00 02 54 FB 21 93 2F 9F 7E 7E A0 2E 00 02 54 FB 21 10 49 25 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 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E 7E A0 0A 00 02 54 FB 21 53 23 59 7E 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 CE E7 73 39 1C 8E C7 E3 F1 78 BC 5E AF 57 2B 15 BE 23 04 21 21 1F 30 00 00 48 C5 AC 81 61 3F 27 EF D7 2D 5C BC A9 BC 6A 3B 9D 68 B8 31 DB 8F 3E 93 79 13 A4 94 81 BB 7E 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 00 00 48 C6 8C D5 61 6E 75 C5 37 B6 0B E8 4A 47 6C 9F EF A9 84 01 4C E4 9C B7 74 55 1F 6C DD FE E5 24 34 8A E6 1A 02 BD 41 0E 82 4F 42 EF 7E 7E A0 0A 00 02 54 FB 03 53 A0 49 7E
---------------
thanks
hi Sir
hi Sir
https://github.com/Gurux/Gurux.DLMS.cpp/blob/master/GuruxDLMSClientExam…
int CGXCommunication::UpdateFrameCounter()
{
int ret = 0;
//Read frame counter if GeneralProtection is used.
if (m_InvocationCounter != NULL && m_Parser->GetCiphering() != NULL && m_Parser->GetCiphering()->GetSecurity() != DLMS_SECURITY_NONE)
{
if (m_Trace > GX_TRACE_LEVEL_WARNING)
{
printf("UpdateFrameCounter\n");
}
m_Parser->SetProposedConformance((DLMS_CONFORMANCE)(m_Parser->GetProposedConformance() | DLMS_CONFORMANCE_GENERAL_PROTECTION));
unsigned long add = m_Parser->GetClientAddress();
DLMS_AUTHENTICATION auth = m_Parser->GetAuthentication();
DLMS_SECURITY security = m_Parser->GetCiphering()->GetSecurity();
CGXByteBuffer challenge = m_Parser->GetCtoSChallenge();
std::vector<CGXByteBuffer> data;
CGXReplyData reply;
----
but in arduino client
int com_updateInvocationCounter(const char* invocationCounter)
{
int ret = DLMS_ERROR_CODE_OK;
//Read frame counter if security is used.
if (invocationCounter != NULL && Client.GetSecurity() != DLMS_SECURITY_NONE)
{
uint32_t ic = 0;
message messages;
gxReplyData reply;
unsigned short add = Client.GetClientAddress();
DLMS_AUTHENTICATION auth = Client.GetAuthentication();
DLMS_SECURITY security = Client.GetSecurity();
Client.SetClientAddress(16);
Doesn't this difference cause this error????
I think because this part is
I think because this part is not set(CGXByteBuffer challenge = m_Parser->GetCtoSChallenge();), it will cause an error that is related to this error in this file?
if (m_Parser->GetAuthentication() > DLMS_AUTHENTICATION_LOW)
{
if ((ret = m_Parser->GetApplicationAssociationRequest(data)) != 0 ||
(ret = ReadDataBlock(data, reply)) != 0 ||
(ret = m_Parser->ParseApplicationAssociationResponse(reply.GetData())) != 0)
{
printf("Authentication failed (%d) %s\n", ret, CGXDLMSConverter::GetErrorMessage(ret));
return ret;
}
}
what is your opinion Sir?
and in part:
and in part:
https://github.com/Gurux/Gurux.DLMS.Net/blob/master/Gurux.DLMS.Client.E…
private void UpdateFrameCounter()
{
//Read frame counter if GeneralProtection is used.
if (!string.IsNullOrEmpty(InvocationCounter) && Client.Ciphering != null && Client.Ciphering.Security != Security.None)
{
InitializeOpticalHead();
byte[] data;
GXReplyData reply = new GXReplyData();
Client.ProposedConformance |= Conformance.GeneralProtection;
int add = Client.ClientAddress;
Authentication auth = Client.Authentication;
Security security = Client.Ciphering.Security;
Signing signing = Client.Ciphering.Signing;
byte[] challenge = Client.CtoSChallenge;
But in Arduino it is different Sir?
int com_updateInvocationCounter(const char* invocationCounter)
{
int ret = DLMS_ERROR_CODE_OK;
//Read frame counter if security is used.
if (invocationCounter != NULL && Client.GetSecurity() != DLMS_SECURITY_NONE)
{
uint32_t ic = 0;
message messages;
gxReplyData reply;
unsigned short add = Client.GetClientAddress();
DLMS_AUTHENTICATION auth = Client.GetAuthentication();
DLMS_SECURITY security = Client.GetSecurity();
Client.SetClientAddress(16);
I also looked in the files
I also looked in the files you posted client example c and they are different from Arduino in this part?
//Read Invocation counter (frame counter) from the meter and update it.
int com_updateInvocationCounter(
connection* connection,
const char* invocationCounter)
{
int ret = DLMS_ERROR_CODE_OK;
//Read frame counter if GeneralProtection is used.
if (invocationCounter != NULL && connection->settings.cipher.security != DLMS_SECURITY_NONE)
{
message messages;
gxReplyData reply;
unsigned short add = connection->settings.clientAddress;
DLMS_AUTHENTICATION auth = connection->settings.authentication;
DLMS_SECURITY security = connection->settings.cipher.security;
gxByteBuffer challenge;
bb_init(&challenge);
bb_set(&challenge, connection->settings.ctoSChallenge.data, connection->settings.ctoSChallenge.size);
connection->settings.clientAddress = 16;
hi sir
hi sir
I also run the GuruxDLMSClientExamplefile, but unfortunately it has this problem, it reads the counter correctly, but it encounters this problem.
GuruxDLMSClientExample.exe -S COM8 -c 1 -s 21885 -a HighGMAC -C AuthenticationEncryption -T 3132333435363738 -A D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF -B 000102030405060708090A0B0C0D0E0F -v 0.0.43.1.0.255
updateInvocationCounter
Invocation counter: -28671 (0xFFFF9001)
InitializeConnection
OperationNotPossible
Hi
Hi
Do you have any comments or answers about this? I am waiting for your answer
Hi,
Hi,
This has been tested now with a few different meters and it works every time.
Can you add the hex trace from GuruxDLMSClientExample so I can check the bytes?
BR,
Mikko
Hello dear friend, thank you
Hello dear friend, thank you for your answer. I have a problem with my Ardino client, which does not answer. Can you help me there, what should I do?
Hello,
Hello,
If you can read the meter with GuruxDLMSClientExample I can compare what is the difference between the bytes and tell what settings you need to change.
BR,
Mikko
im read client example c
im read client example c
C:\Users\Benyamin\Documents\stm32\stm32f429\arduino gurux c\GuruxDLMS.c-master\GuruxDLMSClientExample\VS\x64\Release>GuruxDLMSClientExample.exe -S COM11 -c 1 -s 21885 -a HighGmac -C AuthenticationEncryption -T 3132333435363738 -A D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF -B 000102030405060708090A0B0C0D0E0F -v 0.0.43.1.0.255 -t Verbose
updateInvocationCounter
TX: 7E A0 0A 00 02 54 FB 21 93 2F 9F 7E
RX: 7E A0 23 21 00 02 54 FB 73 8F B4 81 80 14 05 02 01 00 06 02 01 00 07 04 00 00 00 01 08 04 00 00 00 01 69 6D 7E
TX: 7E A0 2E 00 02 54 FB 21 10 49 25 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: 7E A0 3A 21 00 02 54 FB 30 E0 30 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 10 10 05 00 00 07 8D FF 7E
TX: 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E
RX: 7E A0 18 21 00 02 54 FB 52 CC 24 E6 E7 00 C4 01 81 00 06 FF FF B0 DE C7 D9 7E
Invocation counter: -20257 (0xFFFFB0DF)
TX: 7E A0 0A 00 02 54 FB 21 53 23 59 7E
RX: 7E A0 0A 21 00 02 54 FB 73 35 96 7E
InitializeConnection
TX: 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E
RX: 7E A0 23 03 00 02 54 FB 73 B9 39 81 80 14 05 02 01 00 06 02 01 00 07 04 00 00 00 01 08 04 00 00 00 01 69 6D 7E
TX: 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 70 38 9C CE 67 B3 59 AC 56 AB 55 2A 15 8A 45 22 BE 23 04 21 21 1F 30 FF FF B0 DF 0E 00 F2 E5 0C 32 F9 24 E1 5E B1 DF CE 45 26 6E FB 83 28 9E B8 A6 56 A5 3E FA D0 DC 7E
RX: 7E A0 72 03 00 02 54 FB 30 3C A4 E6 E7 00 61 61 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 45 41 41 07 00 2D 8A 35 88 02 07 80 89 07 60 85 74 05 08 02 05 AA 0A 80 08 FB BF 83 D0 23 B3 84 C0 BE 23 04 21 28 1F 30 00 00 00 03 CA 43 A7 44 3B 86 D1 BD 91 A7 12 38 00 2C 53 E7 D1 EB 35 9F 05 03 9F 08 30 D4 97 47 7E
TX: 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 FF FF B0 E0 0A 9A 39 E7 B6 3B B8 53 67 E7 39 C1 AB DE 67 BD D3 5D FD 1D 86 F4 5D 8D CD A6 51 A3 A6 E9 75 84 34 AF D3 C1 D4 DB F2 0E D5 1F 7E
RX: 7E A0 12 03 00 02 54 FB 52 AD 40 E6 E7 00 D8 01 01 3C 43 7E
TX: 7E A0 0A 00 02 54 FB 03 53 A0 49 7E
RX: 7E A0 0A 03 00 02 54 FB 73 03 1B 7E
OperationNotPossible
Hello, according to you. I
Hello, according to you. I run the GuruxDLMSClientExample.exe and got the values from the Gxdlsdirector, but it gives the answer
C:\Users\Benyamin\Documents\stm32\stm32f429\arduino gurux c\GuruxDLMS.c-master\GuruxDLMSClientExample\VS\x64\Release>GuruxDLMSClientExample.exe -S COM11 -c 1 -s 21885 -a HighGmac -C AuthenticationEncryption -T 3132333435363738 -A D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF -B 000102030405060708090A0B0C0D0E0F -v 0.0.43.1.0.255 -t Verbose
updateInvocationCounter
TX: 7E A0 0A 00 02 54 FB 21 93 2F 9F 7E
RX: 7E A0 23 21 00 02 54 FB 73 8F B4 81 80 14 05 02 01 00 06 02 01 00 07 04 00 00 00 01 08 04 00 00 00 01 69 6D 7E
TX: 7E A0 2E 00 02 54 FB 21 10 49 25 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: 7E A0 3A 21 00 02 54 FB 30 E0 30 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 10 10 05 00 00 07 8D FF 7E
TX: 7E A0 1C 00 02 54 FB 21 32 A8 C6 E6 E6 00 C0 01 81 00 01 00 00 2B 01 00 FF 02 00 78 42 7E
RX: 7E A0 18 21 00 02 54 FB 52 CC 24 E6 E7 00 C4 01 81 00 06 FF FF B0 DE C7 D9 7E
Invocation counter: -20257 (0xFFFFB0DF)
TX: 7E A0 0A 00 02 54 FB 21 53 23 59 7E
RX: 7E A0 0A 21 00 02 54 FB 73 35 96 7E
InitializeConnection
TX: 7E A0 0A 00 02 54 FB 03 93 AC 8F 7E
RX: 7E A0 23 03 00 02 54 FB 73 B9 39 81 80 14 05 02 01 00 06 02 01 00 07 04 00 00 00 01 08 04 00 00 00 01 69 6D 7E
TX: 7E A0 6E 00 02 54 FB 03 10 CC F2 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 31 32 33 34 35 36 37 38 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 70 38 9C CE 67 B3 59 AC 56 AB 55 2A 15 8A 45 22 BE 23 04 21 21 1F 30 FF FF B0 DF 0E 00 F2 E5 0C 32 F9 24 E1 5E B1 DF CE 45 26 6E FB 83 28 9E B8 A6 56 A5 3E FA D0 DC 7E
RX: 7E A0 72 03 00 02 54 FB 30 3C A4 E6 E7 00 61 61 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 45 41 41 07 00 2D 8A 35 88 02 07 80 89 07 60 85 74 05 08 02 05 AA 0A 80 08 FB BF 83 D0 23 B3 84 C0 BE 23 04 21 28 1F 30 00 00 00 03 CA 43 A7 44 3B 86 D1 BD 91 A7 12 38 00 2C 53 E7 D1 EB 35 9F 05 03 9F 08 30 D4 97 47 7E
TX: 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 FF FF B0 E0 0A 9A 39 E7 B6 3B B8 53 67 E7 39 C1 AB DE 67 BD D3 5D FD 1D 86 F4 5D 8D CD A6 51 A3 A6 E9 75 84 34 AF D3 C1 D4 DB F2 0E D5 1F 7E
RX: 7E A0 12 03 00 02 54 FB 52 AD 40 E6 E7 00 D8 01 01 3C 43 7E
TX: 7E A0 0A 00 02 54 FB 03 53 A0 49 7E
RX: 7E A0 0A 03 00 02 54 FB 73 03 1B 7E
OperationNotPossible
Hi,
Hi,
Are you sure that your meter is supporting HighGMAC authentication level? The meter is returning AuthenticationRequired. Can you ask this from the meter manufacturer or try to connect using Low or High authentication?
BR,
Mikko
Hello, sir
Hello, sir
I connected with Python and the software with the same device and there is no problem, but with this example client C this problem occurs!???
Hi,
Hi,
I'm sorry. I was wrong. There are a few differences in the bytes. I'll check what might cause that and get back to this. I'll remove my previous comment so it doesn't cause misunderstanding if I'm reading this topic again.
BR,
Mikko
I am waiting for your answer,
I am waiting for your answer, sir
Thank you very much for your kindness in answering
Hi,
Hi,
There is something strange in this, but I don't know the reason yet.
There are four bytes missing in your client to server challenge, but when I tested this with Android Mega, bytes are there and everything works like expected.
Are you getting any warnings when you compile this?
If you select "File" and "Preferences" is your "Additional Boards Manager URDs:" empty or are you using some additional board manager?
BR,
Mikko
Hi, when I compile there is
Hi, when I compile there is no warning and I use Ardino Mega and that part is empty.
image arduino compile
image arduino compile
image preferences
image preferences
GuruxDLMS.c-master\GuruxDLMS
GuruxDLMS.c-master\GuruxDLMS.c-master\GuruxDLMSClientExample\VS\x64\Release>GuruxDLMSClientExample.exe -S COM11 -a HighGmac -c 1 -s 21885 -g "0.0.1.0.0.255:1; 0.0.1.0.0.255:2;0.0.43.1.0.255:1;0.0.43.1.0.255:2" -C AuthenticationEncryption -T 3132333435363738 -A D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF -B 000102030405060708090A0B0C0D0E0F -v 0.0.43.1.0.255 -t Verbose
BlockCipher key: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Authentication Key:D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
1: 7E A0 3E 00 02 54 FB 03 32 13 82 E6 E6 00 CB 2D 30 FF FF B9 F4 C0 EE 8A 8D 94 D1 EB CF C7 CF 5B 67 C0 91 4E D6 1B C0 1A EE C9 18 CC 72 C6 D6 C7 FE A5 95 F5 71 A2 88 27 B2 7E 23 AD EC 7D 11 7E
<HDLC len="3D" >
<!-- Logical address:1, Physical address:5501 -->
<TargetAddress Value="557D" />
<SourceAddress Value="1" />
<FrameType Value="32" />
<PDU>
<!-- Invocation Counter: 4294949364 -->
<!-- Decrypt data: C3 01 81 00 0F 00 00 28 00 00 FF 01 01 09 0D 10 FF FF B9 F4 85 04 C4 2F A1 39 29 2E
<ActionRequest>
<ActionRequestNormal>
# Priority: High, ServiceClass: UnConfirmed, Invoke ID: 1
<InvokeIdAndPriority Value="81" />
<MethodDescriptor>
# AssociationLogicalName
<ClassId Value="000F" />
# 0.0.40.0.0.255
<InstanceId Value="0000280000FF" />
# Reply to HLS authentication
<MethodId Value="01" />
</MethodDescriptor>
<MethodInvocationParameters>
<OctetString Value="10FFFFB9F48504C42FA139292E" />
</MethodInvocationParameters>
</ActionRequestNormal>
</ActionRequest>
-->
<glo_ActionRequest Value="30FFFFB9F4C0EE8A8D94D1EBCFC7CF5B67C0914ED61BC01AEEC918CC72C6D6C7FEA595F571A28827B27E23ADEC" />
</PDU>
</HDLC>
-----------------------------------------------------------------
Gurux.DLMS.Python-master/Gurux.DLMS.Client.Example.python
$ python main.py -S COM11 -a HighGMac -c 1 -s 21885 -g "0.0.1.0.0.255:1; 0.0.1.0.0.255:2;0.0.43.1.0.255:1;0.0.43.1.0.255:2" -C AuthenticationEncryption -T 3132333435363738 -A D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF -B 000102030405060708090A0B0C0D0E0F -v 0.0.43.1.0.255 -t Verbose
2: 7E A0 42 00 02 54 FB 03 32 C5 22 E6 E6 00 CB 31 30 FF FF B9 F7 0E 77 1A 19 7E 56 AA 2F D0 E6 57 C6 4A BB D3 D8 55 6D 4F 15 F8 9B 19 C2 11 10 7F E3 8D 80 FD 65 6B 40 28 03 B3 EA 49 F1 A9 CF 25 D9 95 B6 7E
<HDLC len="41" >
<!-- Logical address:1, Physical address:5501 -->
<TargetAddress Value="557D" />
<SourceAddress Value="1" />
<FrameType Value="32" />
<PDU>
<!-- Invocation Counter: 4294949367 -->
<!-- Decrypt data: C3 01 C1 00 0F 00 00 28 00 00 FF 01 01 09 11 10 FF FF B9 F6 43 6F 2B 9F 58 3D 6C 51 EB B3 09 C1
<ActionRequest>
<ActionRequestNormal>
# Priority: High, ServiceClass: Confirmed, Invoke ID: 1
<InvokeIdAndPriority Value="C1" />
<MethodDescriptor>
# AssociationLogicalName
<ClassId Value="000F" />
# 0.0.40.0.0.255
<InstanceId Value="0000280000FF" />
# Reply to HLS authentication
<MethodId Value="01" />
</MethodDescriptor>
<MethodInvocationParameters>
<OctetString Value="10FFFFB9F6436F2B9F583D6C51EBB309C1" />
</MethodInvocationParameters>
</ActionRequestNormal>
</ActionRequest>
-->
<glo_ActionRequest Value="30FFFFB9F70E771A197E56AA2FD0E657C64ABBD3D8556D4F15F89B19C211107FE38D80FD656B402803B3EA49F1A9CF25D9" />
</PDU>
</HDLC>
------------------------
Hi, the first part is for example GuruxDLMS.c/GuruxDLMSClientExample, which has a problemOperationNotPossible I put the code hex in it. the second part with Python, which is successful. I think the problem is that the size glo_ActionRequest is different.
warning arduino compile
warning arduino compile
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Benyamin\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -ide-version=10815 -build-path C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714 -warnings=all -build-cache C:\Users\Benyamin\AppData\Local\Temp\arduino_cache_457546 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Benyamin\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -ide-version=10815 -build-path C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714 -warnings=all -build-cache C:\Users\Benyamin\AppData\Local\Temp\arduino_cache_457546 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino
Using board 'mega' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\mega" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\client.ino.cpp" -o nul
Alternatives for LibPrintf.h: [LibPrintf@1.1.3]
ResolveLibrary(LibPrintf.h)
-> candidates: [LibPrintf@1.1.3]
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Users\\Benyamin\\Documents\\Arduino\\libraries\\LibPrintf\\src" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\client.ino.cpp" -o nul
Alternatives for EEPROM.h: [EEPROM@2.0]
ResolveLibrary(EEPROM.h)
-> candidates: [EEPROM@2.0]
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Users\\Benyamin\\Documents\\Arduino\\libraries\\LibPrintf\\src" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\EEPROM\\src" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\client.ino.cpp" -o nul
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\GXDLMSClient.cpp
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\apdu.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\bitarray.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\bytebuffer.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\ciphering.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\client.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\converters.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\cosem.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\datainfo.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\date.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\dlms.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\dlmsSettings.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxaes.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxarray.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxget.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxinvoke.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxkey.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxmd5.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxobjects.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxserializer.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxset.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxsetignoremalloc.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxsetmalloc.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxsha1.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxsha256.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxvalueeventargs.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\helpers.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\message.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\notify.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\objectarray.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\parameters.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\replydata.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\server.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\serverevents.c
Using cached library dependencies for file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\variant.c
Using cached library dependencies for file: C:\Users\Benyamin\Documents\Arduino\libraries\LibPrintf\src\LibPrintf.cpp
Generating function prototypes...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Users\\Benyamin\\Documents\\Arduino\\libraries\\LibPrintf\\src" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\EEPROM\\src" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\client.ino.cpp" -o "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\apdu.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\ciphering.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\bytebuffer.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\bitarray.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\client.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\datainfo.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\cosem.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\date.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\converters.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxarray.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\dlms.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxaes.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxinvoke.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\dlmsSettings.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxget.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxmd5.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxkey.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxsetignoremalloc.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxset.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxsha1.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxsha256.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxsetmalloc.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxserializer.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxobjects.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\helpers.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\message.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\gxvalueeventargs.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\parameters.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\objectarray.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\replydata.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\serverevents.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\notify.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\server.c.o
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\variant.c.o
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Users\\Benyamin\\Documents\\Arduino\\libraries\\LibPrintf\\src" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\EEPROM\\src" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\client.ino.cpp" -o "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\client.ino.cpp.o"
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\sketch\GXDLMSClient.cpp.o
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino: In function 'int readDLMSPacket(gxByteBuffer*, gxReplyData*)':
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino:188:53: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((ret = Serial2.write(data->data, data->size)) != data->size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino:204:57: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((ret = Serial2.write(data->data, data->size)) != data->size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino: In function 'int com_updateInvocationCounter(const char*)':
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino:292:13: warning: unused variable 'messages' [-Wunused-variable]
message messages;
^~~~~~~~
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino:293:17: warning: unused variable 'reply' [-Wunused-variable]
gxReplyData reply;
^~~~~
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino: In function 'int com_readScalerAndUnits()':
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino:609:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (pos = 0; pos != Client.GetObjects()->size; ++pos)
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino:634:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (pos = 0; pos != objects.size; ++pos)
~~~~^~~~~~~~~~~~~~~
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino: In function 'int com_readProfileGenericColumns()':
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino:669:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (pos = 0; pos != objects.size; ++pos)
~~~~^~~~~~~~~~~~~~~
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino: In function 'int com_readProfileGenerics()':
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino:708:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (pos = 0; pos != objects.size; ++pos)
~~~~^~~~~~~~~~~~~~~
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino:695:9: warning: unused variable 'data' [-Wunused-variable]
char* data = NULL;
^~~~
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino: In function 'int com_readValues()':
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino:766:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (pos = 0; pos != Client.GetObjects()->size; ++pos)
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino:760:9: warning: unused variable 'data' [-Wunused-variable]
char* data = NULL;
^~~~
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino: In function 'void loop()':
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\client.ino:1007:7: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
int ret;
^~~
Compiling libraries...
Compiling library "LibPrintf"
Using previously compiled file: C:\Users\Benyamin\AppData\Local\Temp\arduino_build_302714\libraries\LibPrintf\LibPrintf.cpp.o
Compiling library "EEPROM"
Compiling core...
Using precompiled core: C:\Users\Benyamin\AppData\Local\Temp\arduino_cache_457546\core\core_arduino_avr_mega_cpu_atmega2560_0c812875ac70eb4a9b385d8fb077f54c.a
Linking everything together...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega2560 -o "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714/client.ino.elf" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\apdu.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\bitarray.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\bytebuffer.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\ciphering.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\client.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\converters.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\cosem.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\datainfo.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\date.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\dlms.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\dlmsSettings.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxaes.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxarray.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxget.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxinvoke.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxkey.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxmd5.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxobjects.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxserializer.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxset.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxsetignoremalloc.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxsetmalloc.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxsha1.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxsha256.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\gxvalueeventargs.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\helpers.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\message.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\notify.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\objectarray.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\parameters.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\replydata.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\server.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\serverevents.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\variant.c.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\GXDLMSClient.cpp.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\sketch\\client.ino.cpp.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714\\libraries\\LibPrintf\\LibPrintf.cpp.o" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714/..\\arduino_cache_457546\\core\\core_arduino_avr_mega_cpu_atmega2560_0c812875ac70eb4a9b385d8fb077f54c.a" "-LC:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714" -lm
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\bitarray.c: In function 'ba_toString':
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\bitarray.c:300:19: warning: 'ch' may be used uninitialized in this function [-Wmaybe-uninitialized]
buff[pos] = ch == 0 ? '0' : '1';
^
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\bitarray.c:285:19: note: 'ch' was declared here
unsigned char ch;
^
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\helpers.c: In function 'hlp_getObjectCount2':
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\helpers.c:357:22: warning: 'value' may be used uninitialized in this function [-Wmaybe-uninitialized]
*count = (uint16_t)value;
^
C:\Users\Benyamin\Desktop\GuruxDLMS.c-master\GuruxDLMS.c-master\Arduino_IDE\client\helpers.c:355:22: note: 'value' was declared here
uint32_t value;
^
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714/client.ino.elf" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714/client.ino.eep"
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714/client.ino.elf" "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714/client.ino.hex"
Using library LibPrintf at version 1.1.3 in folder: C:\Users\Benyamin\Documents\Arduino\libraries\LibPrintf
Using library EEPROM at version 2.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-size" -A "C:\\Users\\Benyamin\\AppData\\Local\\Temp\\arduino_build_302714/client.ino.elf"
Sketch uses 133092 bytes (52%) of program storage space. Maximum is 253952 bytes.
Global variables use 3088 bytes (37%) of dynamic memory, leaving 5104 bytes for local variables. Maximum is 8192 bytes.