Next Step please if you can!

32 posts / 0 new
Last post
hurani
Next Step please if you can!

Hi all,
As you know, I am trying with bluetooth probe and Holley meter which works on DLMS Protocol,
I am sending this and receiving this:
1- Send --> var bytear= byteArrayOfInts(0x55,0xAF,0x3F,0x21,0x8D,0x0A)
bt.send(bytear)
Receive <-- /HLY5\2xxxxxx
2- Send --> var byteack = byteArrayOfInts(0x06,0xB2,0x30,0xB2,0x0D,0x0A)
bt.send(bytear)
Receive <-- ACK 202

I think now meter goes to Mode E right?
then I tried to send SNRM with these two options, but no luck any help to set frames of SNRM?
7E A0 07 03 21 93 0F 01 7E
7E A0 07 03 23 93 BF 32 7E
I am waiting you bro.

Edit: I think probe works on 300 baud rate, and I think I need to change 7E1 to 8N1 mode for probe to start HDLC communication right?

Kurumi
Kurumi's picture

Hi,

Yes, you need to change 7E1 to 8N1 after you have send
06 30 35 31 0D 0A

Try to wait one second before you send SNRM. This delay is on standard.
BR,
Mikko

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

hurani

Its working now, when I send SNRM request the meter replied but cant know what is replying, I think its problem with bluetooth connection, if the reply when it is 7E1 I can read it on Android but after convert to 8N1 the bluetooth event listener doesnt read any thing.
But I am sure that meter replied I can see the led on probe.
Any help to convert (the reply) to string that I can print it on Android screen?

Kurumi
Kurumi's picture

Hi,

Use GXDLMSTranslator.toHex for this.

BR,
Mikko

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

hurani

I read data from BT like this:

case BluetoothState.MESSAGE_READ:
byte[] readBuf = (byte[]) msg.obj;
String readMessage = new String(readBuf);
if(readBuf != null && readBuf.length > 0) {
if(mDataReceivedListener != null)
mDataReceivedListener.onDataReceived(readBuf, readMessage);
}
how to implement yours here?
Thanks in advance

Edit: I trie this and it is working with /?! and moving to mode E but not with SNRM, why?
"byte[] readBuf = (byte[]) msg.obj;
String readMessage = new String(readBuf);
GXDLMSTranslator t = new GXDLMSTranslator(TranslatorOutputType.SIMPLE_XML);
String tt = t.toHex(readBuf);"

Kurumi
Kurumi's picture

Hi,

Is there any data in readBuf? /?!\r is sent using ASCII mode. SNRM is sent using binary mode and a different baud rate.

BR,
Mikko

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

hurani

No data in readBuf, any tips to get binary bytes?
Edit: but I send SNRM as byte array to meter with same baud rate.
Is mode E works just in 9600? Because the probe set on 300 baudrate, I will try to set BR of probe to 9600

Kurumi
Kurumi's picture

Hi,

Try to send
06 30 30 31 0D 0A

Now baud-rate is 300

BR,
Mikko

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

hurani

As mentioned in first post I sent
06 32 30 32 0D 0A, thats moving to Mode E right? And baud rate 300 right? But its not working to receive data to Android but Probe leds receiving ..
06 30 30 31 0D 0A which mode?, I think it is for programming mode of Mode C right? but meter doesnt reply anything!

Kurumi
Kurumi's picture

Hi,

Yes, 06 32 30 32 0D 0A is moving to mode E using bau-drate 300.
Forget 06 30 30 31 0D 0A. That was my mistake.

We can make example to C# in next week. Let's see if that helps.

BR,
Mikko

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

hurani

Thank you

hurani

Hi @Kurumi
I got the SNRM Reply Finally so now when :
Send: 7E A0 07 03 23 93 BF 32 7E
Receive: 7E A0 1E 23 03 73 7B CF 81 80 12 05 01 80 06 01 80 07 04 00 00 00 01 08 04 00 00 00 01 53 3B 7E

But now I am trying to send AARQ request like this:
S: 7E A0 48 03 23 10 62 20 E6 E6 00 60 3A 80 02 02 84 A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 0A 80 08 30 30 30 30 30 30 30 30 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 FF FF FF 28 00 68 F4 7E
and Meter doesnt reply!, do you have any recommendation? is it need to send 2 hex from the above as one byte, or every hex as one byte?
Thanks in advance

Image: 
Kurumi
Kurumi's picture

Hi,

If meter reply for SNRM you are close.
Can you try to read the meter with GXDLMSDirector and post the first 4 traces here so I can check what settings are different. Same data in the same way as you sent the SNRM.

BR,
Mikko

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

hurani

Here you are:
11:03:34 Send SNRM request.
TX: 7E A0 07 03 23 93 BF 32 7E
11:03:34
RX: 7E A0 1E 23 03 73 7B CF 81 80 12 05 01 80 06 01 80 07 04 00 00 00 01 08 04 00 00 00 01 53 3B 7E
11:03:34 Send AARQ request.
TX: 7E A0 44 03 23 10 56 B7 E6 E6 00 60 36 A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 0A 80 08 30 30 30 30 30 30 30 30 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 1D FF FF 5C FD 7E
11:03:34
RX: 7E A0 37 23 03 30 D4 C9 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 18 1D 00 F0 00 07 C2 40 7E

Thes AARQ in the last post is from Holley Program, and I tried the one from Director with same result, SNRM replied but not AARQ!

Kurumi
Kurumi's picture

Hi,

What I'm afraid here is that Holley meter can't handle ProtocolVersion.
It's mandatory in DLMS Certificate tests.

http://www.gurux.fi/GuruxDLMSTranslator?translate=7EA0480323106220E6E600...

You can try to set this to GXDLMSDirector.

Select those in from supported services tab.
Action, SelectiveAccess
Set, Get, MultipleReferences, BlockTransferWithAction,
BlockTransferWithSetOrWrite, BlockTransferWithGetOrRead,

If that doesn't help, ask if there is a new version to the meter.

BR,
Mikko

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

hurani

so why director works fine? I can read all registers.
I tried what you said:
13:38:11 Send SNRM request.
TX: 7E A0 1E 03 23 93 7D 08 81 80 12 05 01 75 06 01 75 07 04 00 00 00 01 08 04 00 00 00 01 25 9C 7E
13:38:11
RX: 7E A0 1E 23 03 73 7B CF 81 80 12 05 01 80 06 01 80 07 04 00 00 00 01 08 04 00 00 00 01 53 3B 7E
13:38:11 Send AARQ request.
TX: 7E A0 44 03 23 10 56 B7 E6 E6 00 60 36 A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 0A 80 08 30 30 30 30 30 30 30 30 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 02 1D FF FF C9 A9 7E
13:38:11
RX: 7E A0 37 23 03 30 D4 C9 E6 E7 00 61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 00 1D 00 F0 00 07 2A 23 7E

Kurumi
Kurumi's picture

Hi,

In your previous post you said:
Thes AARQ in the last post is from Holley Program, and I tried the one from Director with same result, SNRM replied but not AARQ!

So is Director working or not?

BR,
Mikko

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

hurani

On windows Director works fine with above send and receive bytes with usb probe, ok?
I am trying to make Android App with bluetooth probe as you can see on screenshot I manage to read UA Reply but not AARE. I took bytes of AARQ from working Log from Director.

Kurumi
Kurumi's picture

Hi,
Yes, I know what you are trying to do.
How you have generated the AARQ in Android App? I believe that you have not used the Gurux Android library.

BR,
Mikko

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

hurani

Yes, you are right, I am using the trace bytes from Director as I made with SNRM

hurani

Edit: I tried this method to send SNRM and AARQ:

sendSNRM.setOnClickListener {
var byteArray = client.snrmRequest()
btManager.sendData(byteArray)
}
// SNRM works fine, I got reply from meter
aarqButton.setOnClickListener {
for (it: ByteArray in client.aarqRequest()) {
btManager.sendData(it)
}
}
//AARQ doesnt work I didnt get reply from Meter, amybe for loop is not correct!

Kurumi
Kurumi's picture

Hi,

May I ask why you are not using Android library?
After you have pass AARQ/AARE there is a sequence number for each message you sent or received and that will kill your app.

DLMS is a complicated protocol. If one of your settings is wrong, meter doesn't reply.
Use the Android library.

BR
Mikko

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

hurani

I am trying to use Android Library but dont know how to getReply from bluetooth!, thats why I tried bytes from Director

hurani

@Kurumi,
Whats the meaning if I send (get request normal for any register) ang meter reply with (. ! ~)?

Kurumi
Kurumi's picture

Hi,

I believe (. ! ~) is binary data. Try to show it as hex string so I can check what meter reply.

BR,
Mikko

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

hurani

It is like this:
7E A0 07 21 03 11 15 00 7E
I think it is for (next frame) but why? Do you have any tips for next?
Thanks in advance

Kurumi
Kurumi's picture

Hi,

This is not a valid DLMS error, but some Indian meters are returning this because the password, etc is not correct.

Try to the meter using GXDLMSDirector and use same settings.

BR,
Mikko

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

hurani

Hi,
Can I change connection to 8N1 before sending 06 B2 35 B2 8D 0A?
And Why meter doesnt reply to above meesage but reply to 06 B2 30 B2 8D 0A?

Kurumi
Kurumi's picture

Hi,

You change to 8N1 after you have send this message. You must wait one second before changing to 8N1. If meter is replying to 06 B2 30 B2 8D 0A the baudrate is 300 and not 9600.

BR,
Mikko

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

hurani

If I send AARQ with wrong password the meter replies with rejected frame AARE, but if I send it with correct password like director program the meter doesnt reply ..
I am sending to bluetooth probe by Android

hurani

No help here?

Kurumi
Kurumi's picture

Hi,

I can't help you with this because I don't know bytes that you are sending.
If meter don't reply, usually the reason is the wrong client or server address.
But this depends on the meter. Even DLMS is standard meters are behaving differently.

BR,
Mikko

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