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. Forums
  3. Error When Trying To Do DLMS Client Example - RS485 2Ch HAT - Raspberry Pi

Error when trying to do DLMS Client example - RS485 2Ch HAT - Raspberry Pi

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By nate , 1 June, 2022
Forums
Gurux.DLMS

Hi,

I'm getting the error: ("getBaudRate failed. ") from e

-I'm using raspberry pi 2-Channel Isolated RS485 Expansion HAT https://www.waveshare.com/2-ch-rs485-hat.htm

Traceback (most recent call last):
File "main.py", line 37, in <module>
from gurux_serial import GXSerial
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/__init__.py", line 35, in <module>
from .GXSerial import GXSerial
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/GXSerial.py", line 51, in <module>
from ._handlers.GXLinuxHandler import GXLinuxHandler
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/_handlers/__init__.py", line 40, in <module>
from .GXLinuxHandler import GXLinuxHandler
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/_handlers/GXLinuxHandler.py", line 183
raise Exception("getBaudRate failed. ") from e
^
any advice?
dmesg | grep tty
[ 8.162569] spi1.0: ttySC1 at I/O 0x1 (irq = 199, base_baud = 921600) is a SC16IS752

Profile picture for user Kurumi

Kurumi

4 years ago

Hi,

Hi,

I believe that getBaudRate is not implemented for the HAT. One HAT is ordered so this can be tested. We have to wait until it's delivered.

BR,
Mikko

nate

4 years ago

Thanks Mikko, looking forward

Thanks Mikko, looking forward to your feedback, once you have received and tested.

nate

4 years ago

Hi Mikko, in the interim i

Hi Mikko, in the interim i have tested with another device using the generic usb 2 wire convertor. I get the same error. So i presume this is also driver related?
dmesg | grep tty
[ 19.547227] ch341-uart ttyUSB0: break control not supported, using simulated break
[ 19.547701] usb 1-1: ch341-uart converter now attached to ttyUSB0

python main.py
Traceback (most recent call last):
File "main.py", line 37, in <module>
from gurux_serial import GXSerial
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/__init__.py", line 35, in <module>
from .GXSerial import GXSerial
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/GXSerial.py", line 51, in <module>
from ._handlers.GXLinuxHandler import GXLinuxHandler
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/_handlers/__init__.py", line 40, in <module>
from .GXLinuxHandler import GXLinuxHandler
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/_handlers/GXLinuxHandler.py", line 183
raise Exception("getBaudRate failed. ") from e

lsusb
Bus 001 Device 002: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

ls /sys/module/usbserial/drivers/usb
usb:ch341/ usb-serial:generic/ usb:usbserial_generic/

Profile picture for user Kurumi

Kurumi

4 years ago

Hi,

Hi,

I have HL-340 on my desc and I tested this. Everything worked without problems until I realized that I was running Python 3.7.3 and not 2.7.

This is now fixed and the serial port component works with python 2.7 again.
Update to version 1.0.19 and let me know if you have problems.

BR,
Mikko

nate

4 years ago

Hi Mikko,

Hi Mikko,

Thanks for the update. Unfortunately i receive the same error.
git clone https://github.com/gurux/Gurux.DLMS.Python 1.0.19
Cloning into '1.0.19'...
remote: Enumerating objects: 2794, done.
remote: Counting objects: 100% (704/704), done.
remote: Compressing objects: 100% (184/184), done.
remote: Total 2794 (delta 638), reused 557 (delta 516), pack-reused 2090
Receiving objects: 100% (2794/2794), 1.35 MiB | 608.00 KiB/s, done.
Resolving deltas: 100% (2365/2365), done.

cd 1.0.19/

~/1.0.19 $ cd Gurux.DLMS.Client.Example.python/

pip install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting gurux-common==1.0.13 (from -r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/dd/b2/9c92b62f2b1b2324fa3f9310a…
Collecting gurux-dlms==1.0.124 (from -r requirements.txt (line 2))
Downloading https://files.pythonhosted.org/packages/ba/58/ac08b222817023ae4f3b1eddd… (287kB)
100% |████████████████████████████████| 296kB 238kB/s
Collecting gurux-net==1.0.18 (from -r requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/f0/d4/5d8d384cbf806e9f4bfdafdc8…
Collecting gurux-serial==1.0.18 (from -r requirements.txt (line 4))
Downloading https://files.pythonhosted.org/packages/13/4d/b9cb82dc13fe2626a90ab7f5c…
Building wheels for collected packages: gurux-common, gurux-dlms, gurux-net, gurux-serial
Running setup.py bdist_wheel for gurux-common ... done
Stored in directory: /home/wirepas/.cache/pip/wheels/1c/9a/a8/f7e53fd231d936acef177cc391fccbdcf49150c2bdb256278c
Running setup.py bdist_wheel for gurux-dlms ... done
Stored in directory: /home/wirepas/.cache/pip/wheels/94/f9/cb/b8d9b9955bc38e4db5c372ac1bc737fedba10496c22b4ed5b0
Running setup.py bdist_wheel for gurux-net ... done
Stored in directory: /home/wirepas/.cache/pip/wheels/69/80/08/f66b47450329ee430f3d23eaf0ada6d2ca37d488aee25c8dad
Running setup.py bdist_wheel for gurux-serial ... done
Stored in directory: /home/wirepas/.cache/pip/wheels/9c/ac/69/65ee4d9bd0358cf0b579a4bb8b9ef2b0b759fd752e85016a8c
Successfully built gurux-common gurux-dlms gurux-net gurux-serial
Installing collected packages: gurux-common, gurux-dlms, gurux-net, gurux-serial
Successfully installed gurux-common-1.0.13 gurux-dlms-1.0.124 gurux-net-1.0.18 gurux-serial-1.0.18

python main.py
Traceback (most recent call last):
File "main.py", line 37, in <module>
from gurux_serial import GXSerial
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/__init__.py", line 35, in <module>
from .GXSerial import GXSerial
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/GXSerial.py", line 51, in <module>
from ._handlers.GXLinuxHandler import GXLinuxHandler
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/_handlers/__init__.py", line 40, in <module>
from .GXLinuxHandler import GXLinuxHandler
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/_handlers/GXLinuxHandler.py", line 183
raise Exception("getBaudRate failed. ") from e
^
SyntaxError: invalid syntax

python main.py -S /dev/ttyUSB0
Traceback (most recent call last):
File "main.py", line 37, in <module>
from gurux_serial import GXSerial
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/__init__.py", line 35, in <module>
from .GXSerial import GXSerial
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/GXSerial.py", line 51, in <module>
from ._handlers.GXLinuxHandler import GXLinuxHandler
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/_handlers/__init__.py", line 40, in <module>
from .GXLinuxHandler import GXLinuxHandler
File "/home/wirepas/.local/lib/python2.7/site-packages/gurux_serial/_handlers/GXLinuxHandler.py", line 183
raise Exception("getBaudRate failed. ") from e
^
SyntaxError: invalid syntax

Profile picture for user Kurumi

Kurumi

4 years ago

Hi,

Hi,

You are using the old version 1.0.18.
The new serial port component version was not updated for GXDLMSClient requirements.txt. It's now updated. Get the latest version from Github or change the version from 1.0.18 to 1.0.19 to requirements.txt and give it a new try.

BR,
Mikko

nate

4 years ago

Thanks Mikko. This worked.

Thanks Mikko. This worked.

  • 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

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin