i am interfacing Secure saral meter.
connections are correct as i am able to retrieve data from meter using DLMSdirector but when i am using code client.ino from GuruxDLMS.c-master.zip then it is not giving data.
When the code is uploaded, if i will remove tx rx pins (of meter) from arduino mega board still data is getting received at rx pin, and it is same string is receiving continously.
String received is:
7E A0 07 03 41 93 5A 64 7E
this is initialization code:
Client.init(true, 32, 1, DLMS_AUTHENTICATION_LOW, "ABCD0001", DLMS_INTERFACE_TYPE_HDLC);
this is loop function:
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_initializeConnection();
ret = com_readAllObjects("1.0.94.91.0.255");
delay(1000);
Serial1.println(ret);
Check your client and server address from the GXDLMSDirector. If they are the 32 and 1 then check the serial port settings. I believe that your client address should be 0x32 and not 32.
The client re-establish the connection, because the meter doesn't reply. Check your serial port settings (baud rate) and serial port wires that those are correct.
Thanks for your suggestion, i have re-checked the serial connections and now it is working.
Please suggest me how can i translate the hex into understandable format.
like, this is the reply of date time read:
7E A0 1E 41 03 52 05 4F E6 E7 00 C4 01 81 00 09 0C 07 E6 08 10 FF 0F 21 1B FF 80 00 00 C7 1A 7E
i have used DLMSDirector -> DLMS translator function, it converts it into :
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 1E 41 03 52 05 4F E6 E7 00 C4 01 81 00 09 0C 07 E6 08 10 FF 0F 21 1B FF 80 00 00 C7 1A 7E
<HDLC len="1D" >
<TargetAddress Value="20" />
<SourceAddress Value="1" />
<FrameType Value="52" />
<PDU>
<GetResponse>
<GetResponseNormal>
<!-- Priority: High, ServiceClass: UnConfirmed, Invoke ID: 1 -->
<InvokeIdAndPriority Value="81" />
<Result>
<Data>
<!-- 16-08-2022 15:33:27 -->
<OctetString Value="07E60810FF0F211BFF800000" />
</Data>
</Result>
</GetResponseNormal>
</GetResponse>
</PDU>
</HDLC>
but i want to write this date time translation in arduino code.
kindly give me idea so that i can take out date-time from above response and translate it into understandable value.
DLMS is very complicated protocol and before you can read or write anything, you need to establish the connection for the meter. After that you can read the data. There is also a sequence number for each frame that makes this more difficult to just read the value.
The main problem at the moment is that your meter doesn't reply SNRM frame:
7E A0 07 03 41 93 5A 64 7E
Because you can connect from GXDLMSDirector and your client and server address are correct the only reason why the meter is not answering is that your serial port settings are wrong or the connection between Arduino and the meter is not working.
Check that baud rate is 9600 and then check your cable.
i got stuck with this last point, i just want to know how too convert DLMS hex data into XML format, so that i can convert received hex response into XML format like it is done by translator in DLMSirector.
i want to establish this code into arduino.
Hi,
Hi,
Check your client and server address from the GXDLMSDirector. If they are the 32 and 1 then check the serial port settings. I believe that your client address should be 0x32 and not 32.
BR,
Mikko
Hello! Kurumi,
Hello! Kurumi,
thanks for reply.
on GXDLMSDirector, i set client address as 0x20 -> it will be 32 in integer (same is shown on GXDLMSDirector)
working command line paramter:
-S COM7:9600:8NoneOne -c 32 -a Low -P ABCD0001 -w 1 -f 128 -t Verbose
What to check in Serial port
What to check in Serial port ?
7E A0 07 03 41 93 5A 64 7E
7E A0 07 03 41 93 5A 64 7E
this is i am receiving 4 times both with and without connections of meter to arduino
Hi,
Hi,
The client re-establish the connection, because the meter doesn't reply. Check your serial port settings (baud rate) and serial port wires that those are correct.
BR,
Mikko
Thanks for your suggestion, i
Thanks for your suggestion, i have re-checked the serial connections and now it is working.
Please suggest me how can i translate the hex into understandable format.
like, this is the reply of date time read:
7E A0 1E 41 03 52 05 4F E6 E7 00 C4 01 81 00 09 0C 07 E6 08 10 FF 0F 21 1B FF 80 00 00 C7 1A 7E
i have used DLMSDirector -> DLMS translator function, it converts it into :
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 1E 41 03 52 05 4F E6 E7 00 C4 01 81 00 09 0C 07 E6 08 10 FF 0F 21 1B FF 80 00 00 C7 1A 7E
<HDLC len="1D" >
<TargetAddress Value="20" />
<SourceAddress Value="1" />
<FrameType Value="52" />
<PDU>
<GetResponse>
<GetResponseNormal>
<!-- Priority: High, ServiceClass: UnConfirmed, Invoke ID: 1 -->
<InvokeIdAndPriority Value="81" />
<Result>
<Data>
<!-- 16-08-2022 15:33:27 -->
<OctetString Value="07E60810FF0F211BFF800000" />
</Data>
</Result>
</GetResponseNormal>
</GetResponse>
</PDU>
</HDLC>
but i want to write this date time translation in arduino code.
kindly give me idea so that i can take out date-time from above response and translate it into understandable value.
Hi,
Hi,
DLMS is very complicated protocol and before you can read or write anything, you need to establish the connection for the meter. After that you can read the data. There is also a sequence number for each frame that makes this more difficult to just read the value.
The main problem at the moment is that your meter doesn't reply SNRM frame:
7E A0 07 03 41 93 5A 64 7E
Because you can connect from GXDLMSDirector and your client and server address are correct the only reason why the meter is not answering is that your serial port settings are wrong or the connection between Arduino and the meter is not working.
Check that baud rate is 9600 and then check your cable.
BR,
Mikko
Hello Kurumi,
Hello Kurumi,
i am getting data now.
i got stuck with this last point, i just want to know how too convert DLMS hex data into XML format, so that i can convert received hex response into XML format like it is done by translator in DLMSirector.
i want to establish this code into arduino.
Thanks Kurumi,
Thanks Kurumi,
i got the way for translation.
thank you for your support