Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Selection of Serial Port Baudrate

Selection of serial port baudrate

Profile picture for user DrClaudio
By DrClaudio , 25 August, 2023
Project
gurux.dlms.cpp
Status
Closed (fixed)

Dear Mikko,

I do not know if it is correct to report in this modality 'issues' relevant to example code. Nevertheless, with the sake of contributing, let me please share with you that I experienced an issue when using the '-S' command line option for the Client example (GuruxDLMSClientExample).

The '-S' option, as far as I have understood, is meant to allow the selection of serial port communication parameters, including the baudrate, with this syntax:

-S [COM1:9600:8None1]

However, the baurate isn't actually affected by the specified command line parameter (e.g.: -S [COM1:38400:8None1]) will default to 9600 baud.

I used this command line (so you can check if I made any mistake preventing to proper use of ‘-S’ command line option):

./bin/gurux.dlms.client.bin -c 16 -s 1 -S "/dev/ttyS0:57600:8None1" -r ln -i HDLC -T "4775727578313233" -A D0A1A2A3A4A5A6A7A8A9AAABACADAEAF -B 300102030405060708090A0B0C0D0E0F -V "Suite0" -f 2000 -w 1 -P "Claudio" -a "None" -C "None"

To this extent, I made these small modifications in file [communication.cpp]:

- in line 443 change:

unsigned short baudRate;

to

unsigned int baudRate;

- in line 611 change

cfsetospeed(&options, B9600);
cfsetispeed(&options, B9600);

to

speed_t baudRate_speed=getTermiosSpeed(baudRate,1);
cfsetospeed(&options, baudRate_speed);
cfsetispeed(&options, baudRate_speed);

- adding a the getTermiosSpeed() function as per this code:

https://github.com/stephane/libmodbus/blob/b25629bfb508bdce7d519884c0fa….

Thank you
Best regards,
Claudio

Priority
Minor
Category
Bug report
Profile picture for user Kurumi

Kurumi

2 years 9 months ago

Hi Claudio, Thank you for…

Hi Claudio,
Thank you for pointing this out. This is now fixed and a new client example is in GitHub.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin