RevPi Con M-Bus

Rund um die Hardware des Revolution Pi
Post Reply
MaxMueller
Posts: 24
Joined: 23 Nov 2016, 11:30
Answers: 0

RevPi Con M-Bus

Post by MaxMueller »

Hallo in die Runde,

ich habe mich heute ein paar Stunden an das Con M-Bus Modul gesetzt und ihm versucht ein paar Zählerdaten von einem wireless MBus fähigen Zähler zu entlocken. Leider bis jetzt ohne Erfolg. Hat sich hier jemand schon mal mit dem Con M-Bus Modul beschäftigt bzw. hat das RevPi-Team ein paar Infos für mich? Ihr habt doch bei der Entwicklung des Con M-Bus Moduls auch ein wenig getestet, oder?

Doku vom Hersteller

Die Kommunikation baue ich wie in der Doku beschrieben auf. 19200, 8N1, kein flow control. Von allein sendet das Modul ab und zu ein paar kryptische Nachrichten. Diese sind aber nicht verwertbar. Wenn ich versuche den Chip in den Konfigurationsmodus zu bringen, antwortet er mir auch mit sehr kryptischen Nachrichten in denen sich kurze lesbare Abschnitte befinden. Was eigentlich erwartet wird ist nur ein ">" als Bestätigung meines Befehls.

Code: Select all

\x01\x05\x03\x00\x00\x01\t\x00\x05<\x00\xd3\x91\xda\x80\x80|\x00\x01\x01\x00\x00\x17\x00\x00H$\x124Vx\x01\x07\x01\x01\x00\x00\x00\x00\x04\xff\x08\x00\x00\x00\x00\x00\x00\x05\x08\x00\x01\x05\x00\x00\x00\x00\x00\x00D\x08\x02\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00RC1180-MBUS3,2.00,3.16\x00\x00\x00\x00\x00\x00\x04\xa00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe0\xea\xfa\x07\x84\x84\xe0\xea\xfaG\x84\xc4\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff>\x01\x05\x03\x00\x00\x01\t\x00\x05<\x00\xd3\x91\xda\x80\x80|\x00\x01\x01\x00\x00\x17\x00\x00H$\x124Vx\x01\x07\x01\x01\x00\x00\x00\x00\x04\xff\x08\x00\x00\x00\x00\x00\x00\x05\x08\x00\x01\x05\x00\x00\x00\x00\x00\x00D\x08\x02\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00RC1180-MBUS3,2.00,3.16\x00\x00\x00\x00\x00\x00\x04\xa00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe0\xea\xfa\x07\x84\x84\xe0\xea\xfaG\x84\xc4\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff>
Ich dachte mir nach einer Weile, eventuell ist das Modul defekt. Aber auch mir einem anderen Con M-Bus Modul kommt der gleiche Mist über die serielle Schnittstelle. Auch mit einem anderen RevPi Connect ändert sich nichts. Aus Spaß habe ich mal alle Baudraten durchprobiert aber auch damit kam nichts sinnvolleres raus.

Nun stelle ich mir die Frage. Ist die Datenübertragung vom RevPi Connect zum Con M-Bus fehlerhaft oder mache ich was falsch?

Hier mal ein Auszug von den Nachrichten die sonst so vom Modul kommen:

Code: Select all

>>> ser.readline()
b'L\xc4e\xb2Q\xd1\xc0\x00\xf1U\xa0\x83\x11\x00\xac/%\x019De2GqY\x12\x16\x07zh\x00\x00\x00\x0c\x13Eg\x05\x00L\x13\x92\x85\x04\x00Bl_,\x02\xbbV\x00\x002l\xff\xff\x04m\x10\x08}$\x82\x04l\x7f#\x8c\x04\x13\x03%\x05\x00\xa1.De2\x05\x87a\x12\x16\x06z\t\x00\x00\x00\x0c\x13v\x16\x00\x00L\x13\x15\x12\x00\x00Bl_,\x02\xbbV\x00\x002l\xff\xff\x04m\x08\r}$\xba\n'
>>> ser.readline()
b'\xc4e\xb2Q\xd1\xc0\x00\xe1 \xa0\n'
>>> ser.readline()
b'\xc4e\xb2Q\xd0\xc0\x00\xe0j\xa4\n'
>>> ser.readline()
b'\xc4e\xb2Q\xd3\x80\x00\xe3\x1c\xbe\n'
>>> ser.readline()
b"\xc4e\xb2Q\xd2\xa0\x00\xe2\x94\xab'De2\x106\x14\x833\x08z2\x00\x00\x00\x0bn\x14\x03\x00Kn\x85\x05\x00Bl_,2l\xff\xff\x04m\t\r}$\xba'De27!\x14\x833\x08z2\x00\x00\x00\x0bn'\x01\x00Kn\x91\x01\x00Bl_,2l\xff\xff\x04m\t\r}$\xb1\n"
>>> ser.readline()
b'\xc4e\xb2Q\xd1\xc0\x00\xe1 \xa0\n'
>>> ser.readline()
b'\xc4e\xb2Q\xd0\xc0\x00\xe0j\x9f\n'
>>> ser.readline()
b"\xc4e\xb2Q\xd2\xa0\x00\xe2\x94\xa3'De29!\x14\x833\x08z2\x00\x00\x00\x0bn'\x03\x00Kn\x94\x04\x00Bl_,2l\xff\xff\x04m\r\r}$\x9d'De2\x93 \x14\x833\x08z2\x00\x00\x00\x0bnU\x06\x00Kn7\x06\x00Bl_,2l\xff\xff\x04m\x0c\r}$\x9b\n"
>>> ser.readline()
b'\xc4e\xb2Q\xd1\xc0\x00\xe1 \xa9\n'
>>> ser.readline()
b'\xc4e\xb2Q\xd0\xc0\x00\xe0j\xa4L\xc4e\xb2Q\xd2\xb0\x05\xf1U\xa0\x83\x11\x00\xac/%\x019De2GqY\x12\x16\x07zh\x00\x00\x00\x0c\x13Eg\x05\x00L\x13\x92\x85\x04\x00Bl_,\x02\xbbV\x00\x002l\xff\xff\x04m\x10\x08}$\x82\x04l\x7f#\x8c\x04\x13\x03%\x05\x00\xa9\n'
>>> ser.readline()
b'\xc4e\xb2Q\xd3\x90\x00\xe3\x1c\xbc\n'
>>> ser.readline()
b'\xc4e\xb2Q\xd2\xb0\x00\xe2\x94\xa3.De2\x05\x88a\x12\x16\x06zj\x00\x00\x00\x0c\x13r\x89\x02\x00L\x13H0\x02\x00Bl_,\x02\xbbV\x00\x002l\xff\xff\x04m\n'
>>> ser.readline()
b'\r}$\xbdL\xc4e\xb2Q\xd0\xd0\x06\xf1U\xa0\x83\x11\x00\xac/%\x019De2GqY\x12\x16\x07zh\x00\x00\x00\x0c\x13Eg\x05\x00L\x13\x92\x85\x04\x00Bl_,\x02\xbbV\x00\x002l\xff\xff\x04m\x10\x08}$\x82\x04l\x7f#\x8c\x04\x13\x03%\x05\x00\xa2\n'
>>> ser.readline()
b'\xc4e\xb2Q\xd1\xc0\x00\xe1 \xa7\n'
Ladam
Posts: 16
Joined: 30 Jul 2019, 09:59
Answers: 0

Re: RevPi Con M-Bus

Post by Ladam »

Hallo,

ich plane ebenfalls den Einsatz des wM-Bus Moduls. Bei deiner Frage kann ich dir leider (noch) nicht helfen. Ich suche nämlich nach einem komplatiblen wM-Bus Stromzähler. Hast du hier schon Erfahrungen gesammelt? Oder hast du nur mit anderen Verbrauchszählern gearbeitet?

Danke
Luke
MaxMueller
Posts: 24
Joined: 23 Nov 2016, 11:30
Answers: 0

Re: RevPi Con M-Bus

Post by MaxMueller »

Hi Luke,

ich arbeite aktuell ausschließlich mit Wärmemengenzählern von Diehl. Stromzähler stehen noch nich im Fokus. Ich denke, solange der M-Bus Mode des Zähler mit den Fähigkeiten des wM-Bus Moduls passt, sollte die Kombination funktionieren. Die oben genannten Probleme konnte ich mittlerweile lösen bzw. lösen lassen.

VG
Max
Ladam
Posts: 16
Joined: 30 Jul 2019, 09:59
Answers: 0

Re: RevPi Con M-Bus

Post by Ladam »

Hallo Max,

danke für deine Antwort. Freut mich zu hören das du deine Probleme lösen konntest. Falls ich ähnliche Probleme haben sollte werde ich mich noch einmal melden ;).

Grüße
Luke
I3eeeen
Posts: 4
Joined: 06 Apr 2020, 13:01
Answers: 0

Re: RevPi Con M-Bus

Post by I3eeeen »

Hi,
das Thema ist zwar schon älter, aber ich wollte mal Fragen wie du das Problem gelöst hast. Ich stehe gerade vor dem selben Problem. Ich erwarte ein ">" und bekomme aber nur zwei bis drei kryptische Zeichen als Antwort. Würde mich über jede Hilfe freuen :)
martijngerrits
Posts: 5
Joined: 20 Apr 2020, 11:37
Answers: 0

Re: RevPi Con M-Bus

Post by martijngerrits »

I'm sorry for posting an English reply in a German topic. But there is no english topics about this, and it seemed silly to create a new one.

I'm still figuring this out as I go too. So please, correct me anywhere if I am wrong.

The output you're getting:

Code: Select all

\x01\x05\x03\x00\x00\x01\t\x00\x05<\x00\xd3\x91\xda\x80\x80|\x00\x01\x01\x00\x00\x17\x00\x00H$\x124Vx\x01\x07\x01\x01\x00\x00\x00\x00\x04\xff\x08\x00\x00\x00\x00\x00\x00\x05\x08\x00\x01\x05\x00\x00\x00\x00\x00\x00D\x08\x02\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00RC1180-MBUS3,2.00,3.16\x00\x00\x00\x00\x00\x00\x04\xa00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe0\xea\xfa\x07\x84\x84\xe0\xea\xfaG\x84\xc4\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff>\x01\x05\x03\x00\x00\x01\t\x00\x05<\x00\xd3\x91\xda\x80\x80|\x00\x01\x01\x00\x00\x17\x00\x00H$\x124Vx\x01\x07\x01\x01\x00\x00\x00\x00\x04\xff\x08\x00\x00\x00\x00\x00\x00\x05\x08\x00\x01\x05\x00\x00\x00\x00\x00\x00D\x08\x02\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00RC1180-MBUS3,2.00,3.16\x00\x00\x00\x00\x00\x00\x04\xa00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe0\xea\xfa\x07\x84\x84\xe0\xea\xfaG\x84\xc4\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff>
is the memory configuration of the RC1180-MBUS3 chip.

You are probably not sending the command correctly to the module.
For configuration mode the documentation states to write '0x00', in fact, this is not a hexadecimal value. So sending 0 to the module will result in a hex value of 0x30. According to the documentation this is the command 'Test Mode 0 – List configuration Memory'. This was something I was struggling with too at the beginning.
Here you can check the ascii / hex table: https://www.rapidtables.com/code/text/ascii-table.html

At first I was having trouble just getting the expected result back from the module by sending the bits over.
So I created a simple test script in Python, just because it is easy to test these things in:

Code: Select all

#!/usr/bin/env python

import serial

ser = serial.Serial('/dev/ttyConBridge', baudrate=19200, bytesize=8, parity='N', stopbits=1, timeout=1)

if ser.isOpen():
        print('Connected to /dev/ttyConBridge')

        while True:
                hexes = raw_input('Enter command:').split()
                ser.write(''.join(chr(int(h,16)) for h in hexes))

                output = ser.readline()
                print(output)
After many frustrating hours, and many more reading all the documentation ( not only from the MCU, but also the OMS standard and the docs on the mbus devices I am using ).
I came to only one simple conclusion: It should actually just work! I should be getting data by reading the serial device /dev/ttyConBridge.

So I reseted the chip just to make sure that the default settings I could read in the documentation were actually applied.
There are a few steps to do this. Since doing this requires to assert the Config pin on the module, and that is not possible since the module is built in the revolution pi casing.
But this can be bypassed by changing 1 setting in the memory configuration.

NOTE: The M- command is writing to NVM/flash, and this operation must not be interrupted by for example a reset or powercycle. Interrupting the NVM update may leave the configuration memory corrupted. I will not be responsible for any damage this may cause to your device, do this at your own risk!

With the script I included here I did the following:
Step 1: Bypass the special protection for the '@' commands that require the CONFIG pin to be asserted.
- Run the script
- Enter the hex value '00' ( we enter the hex values without the '\x', this is just to show it is a hex, we don't need it here. ) This will take you in configuration mode
- Wait for the '>' to appear
- Enter the hex value '4D' ( This is the hex equivalent of the ascii character 'M', which takes you into the memory configuration )
- Wait for the '>' to appear
- Enter the hex value '37', this is the memory address for the option: CONFIG_INTERFACE
- There will be no output after this
- Now enter the value: '01', this will disable the need of asserting the Config pin on the module when resetting the device.
- Enter the hex value: 'FF', this will end the memory configuration
- Wait for the '>' to appear
- Exit the configuration mode by entering the hex value: '58' ( no output after this command will appear ).

Step 2: Reset the memory configuration
- Enter configuration mode again: '00'
- Wait for the '>' to appear
- Enter the following hex sequence: '40 52 43' ( this represents the '@RC' -> @command, Reset Configuration ).
- Wait for the '>' to appear
- Exit the configuration mode by entering the hex value: '58' ( no output after this command will appear ).

The memory configuration is now been reset to factory defaults.

You can now simply verify that you are receiving some data from the module by entering the command:

Code: Select all

tail -f /dev/ttyConBridge
( there are many options to verify the output on the serial device, choose which one you prefer )
Keep in mind that it can take a while for data to appear, depending on the mBus mode your devices are using and the interval they are set to use.

I don't know why the memory configuration was not default, but this seemed to fix it for me.

I hope this information could be of use for someone.

For me, the devices I am using use AES-128 Mode 5, Profile A encryption ( an OMS standard ), so the data I am getting is not human readable yet, but at least I am a step closer.
Post Reply