Changing baud rate for receiving data while communication is open

11 posts / 0 new
Last post
erdeepakcs
Changing baud rate for receiving data while communication is open

Dear Sir,

I am sending command to Non-DLMS meter on baud rate 300, meter will send data on 9600 baud rate. so how can i change the serial port baud rate while communication is open ?

Kurumi
Kurumi's picture

Hi,

If you are using C# or Java you can just
serial.BaudRate = 9600;

If you are using Android version you must close serial port, change settings and open again.

BR,

Mikko

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

erdeepakcs

I am using C#, but when i change the baud rate like this meter is not sending data, is there any setting which i have to change while changing the baud rate?

Deepak

Kurumi
Kurumi's picture

Hi,

Some ciphsets want that DTR and RTS are disabled first and when serial port settings are changed they are enabled back.

serial.DtrEnable = serial.RtsEnable = false;
//Change settings.
serial.DtrEnable = serial.RtsEnable = true;

BR,

Mikko

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

erdeepakcs

I have tried this setting also enable and disable RTS and DTR but not getting response from meter.
below is my command
Request: 11-04-2017 PM 04:50:37.25364 (+78.6795 seconds)

2F 3F 21 0D 0A //send on 300 baud rate to meter

Answer: 11-04-2017 PM 04:50:38.69364 (+0.4400 seconds)

2F 5A 50 41 35 5A 45 31 31 35 2E 76 30 5F 31 32 // receive from meter at 300 baud rate
33 35 0D 0A

Request: 11-04-2017 PM 04:50:38.31364 (+0.0100 seconds)

06 30 35 30 0D 0A //send at 300 baud rate to meter

now data will come at 9600 baud rate.

Deepak

Kurumi
Kurumi's picture

Hi,

You are asking meter to send data with 9600. You are reading IEC 62055-21 (old IEC 1107).
You have max 1 second time to change baudrate after you send baudrate message.

If you want to receive data with 300 you must send this command:
06 30 30 30 0D 0A

BR,

Mikko

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

erdeepakcs

yes this command "06 30 30 30 0D 0A" is working perfectly at 300 baud rate, i am getting the response from meter.
For 9600 baud rate, i have to send this command "06 30 35 30 0D 0A" to meter on 300 baud rate and the i have to change the baud rate to 9600 to receive the data form meter.
can you give me some example of code for changing baud rate ?
In serial port send and receive function, after sending the command to meter, change the baud rate but not working.

thanks
erdeepakcs

Deepak

Kurumi
Kurumi's picture

Hi,

You are doing just like should be. You can get example from Gurux.DLMS.Client.Example.Net in GitHub.

BR,

Mikko

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

erdeepakcs

issue is resolved sir, i have provided the delay before and after changing the baud rate vale.
thanks sir for help

Deepak

vikrant

when i use dlms media.close in simple java application it throws fatal error by java run time environment.
Please reply soon.

Kurumi
Kurumi's picture

Hi,
Please, create own topic if you have a question.
Can you give more information from this. What kind of error you are getting? Are you run this on Windows or Linux. What serial port you are using? Do you have updated driver to latest verstion?

BR,

Mikko

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