Open kamaxeon opened 8 years ago
Hi kamaxeon, You can not really assign addresses, however you can select the device. After selecting the device will be available at primary address 253. after you have finished reading the device you should deselect it with a SND_NKE message to make address 253 available for the next device. Selecting and deselecting is handled by the serial-request-data function so if you follow the steps in mbus-serial-request-data.c you should be able to find what you need. Rico
Hi kamaxeon, i think you refers to MBDOC48.pdf chapter 6.4.2 Writing Data to a Slave. In theory you need to select a slave via secondary address and then send SND_UD message with primary address record ( data = 253 ). Unfortunately i've never give it a try neither i don't know which M-Bus slaves support that feature.
Hi again,
In this pdf, point 3.7.2 is the instruction that I need, but I don't know how to do it :-(
The M-Bus slave supports this feature, it has been tested with a windows software and works like a charm.
Hi,
I have a need for the same type of functionality that kamaxeon requests. I want to be able to assign primary addresses using libmbus.
How about the example in pull request #118 ?
I put this 'mbus-serial-set-address.c' in /libmbus/bin/ and added it to the Makefile.am of this folder. With this, ./build.sh compiles the program.
I tested it with: Raspberry Pi B+ >> USB-Serial adapter (HL-340) >> Relay PW20 MBus Master >> Modularis MBus Slave. https://www.wehrle.de/en/metering/remote-reading/modularis-modules/
Initially, the Module comes with primary address '0'. After './mbus-serial-set-address -d -b 2400 /dev/ttyUSB0 0 9' I receive
init_slaves: debug: sending init frame 1 [2018-03-03 21:07:23] SEND (005): 10 40 FD 3D 16 init_slaves: debug: sending init frame 2 [2018-03-03 21:07:23] SEND (005): 10 40 FD 3D 16 [2018-03-03 21:07:24] SEND (012): 68 06 06 68 53 00 51 01 7A 09 28 16
And './mbus-serial-request-data -b 2400 /dev/ttyUSB0 0' times out, as expected. Whereas './mbus-serial-request-data -b 2400 /dev/ttyUSB0 9' returns the requested data.
Hi !
This is not a bug, this is a question. I have not enough knowledge to do it. I have been reading the protocol, but I don't know how to assign primary address using the secondary.
Somebody can help me ?
Thanks