Open MZourob opened 6 years ago
Can you compile with debug and post the output?! Or at all the complete output?
Please provide the output after adding the debug parameter "-d". Did you try it with a PC?
Thanks a lot for the replies. This is a sample of the output I am getting:
Scanning primary addresses: 0 [2018-05-10 13:17:15] SEND (005): 10 40 00 40 16 [2018-05-10 13:17:15] RECV (001): 00
[2018-05-10 13:17:15] RECV (001): 00 [2018-05-10 13:17:15] RECV (001): 00 [2018-05-10 13:17:15] RECV (001): 40 [2018-05-10 13:17:15] RECV (001): 04 Collision at address 0 1 [2018-05-10 13:17:16] SEND (005): 10 40 01 41 16 [2018-05-10 13:17:16] RECV (001): 00
[2018-05-10 13:17:16] RECV (001): 00 [2018-05-10 13:17:16] RECV (001): 00 [2018-05-10 13:17:16] RECV (001): 00 [2018-05-10 13:17:16] RECV (001): 04 Collision at address 1 2 [2018-05-10 13:17:16] SEND (005): 10 40 02 42 16 [2018-05-10 13:17:16] RECV (001): 00
[2018-05-10 13:17:16] RECV (001): 00 [2018-05-10 13:17:16] RECV (001): 00 [2018-05-10 13:17:16] RECV (001): 02 [2018-05-10 13:17:16] RECV (001): 04 Collision at address 2 3 [2018-05-10 13:17:16] SEND (005): 10 40 03 43 16 [2018-05-10 13:17:16] RECV (001): 00
[2018-05-10 13:17:16] RECV (001): 00 [2018-05-10 13:17:16] RECV (001): 03 [2018-05-10 13:17:16] RECV (001): 02 [2018-05-10 13:17:16] RECV (001): 04 Collision at address 3 4 [2018-05-10 13:17:16] SEND (005): 10 40 04 44 16 [2018-05-10 13:17:16] RECV (005): 10 00 00 00 06
Collision at address 4 5 [2018-05-10 13:17:16] SEND (005): 10 40 05 45 16 [2018-05-10 13:17:17] RECV (001): 00
[2018-05-10 13:17:17] RECV (001): 00 [2018-05-10 13:17:17] RECV (001): 00 [2018-05-10 13:17:17] RECV (001): 00 [2018-05-10 13:17:17] RECV (001): 04 Collision at address 5 6 [2018-05-10 13:17:17] SEND (005): 10 40 06 46 16 [2018-05-10 13:17:17] RECV (001): 00
And it goes on scanning all 250 addresses and have collisions at all of them.
I did not try it with PC. I am working now with a RPI3 with Raspbian on it. If I set the baud rate to 300, This is the output:
0 [2018-05-10 13:30:43] SEND (005): 10 40 00 40 16 [2018-05-10 13:30:43] RECV (005): 10 40 00 40 16
1 [2018-05-10 13:30:43] SEND (005): 10 40 01 41 16 [2018-05-10 13:30:43] RECV (005): 10 40 01 41 16
2 [2018-05-10 13:30:43] SEND (005): 10 40 02 42 16 [2018-05-10 13:30:43] RECV (005): 10 40 02 42 16
3 [2018-05-10 13:30:43] SEND (005): 10 40 03 43 16 [2018-05-10 13:30:44] RECV (005): 10 40 03 43 16
4 [2018-05-10 13:30:44] SEND (005): 10 40 04 44 16 [2018-05-10 13:30:44] RECV (005): 10 40 04 44 16
5 [2018-05-10 13:30:44] SEND (005): 10 40 05 45 16 [2018-05-10 13:30:44] RECV (005): 10 40 05 45 16
6 [2018-05-10 13:30:44] SEND (005): 10 40 06 46 16 [2018-05-10 13:30:44] RECV (005): 10 40 06 46 16
7 [2018-05-10 13:30:44] SEND (005): 10 40 07 47 16 [2018-05-10 13:30:44] RECV (005): 10 40 07 47 16
8 [2018-05-10 13:30:44] SEND (005): 10 40 08 48 16 [2018-05-10 13:30:45] RECV (005): 10 40 08 48 16
9 [2018-05-10 13:30:45] SEND (005): 10 40 09 49 16 [2018-05-10 13:30:45] RECV (005): 10 40 09 49 16
10 [2018-05-10 13:30:45] SEND (005): 10 40 0A 4A 16 [2018-05-10 13:30:45] RECV (005): 10 40 0A 4A 16
11 [2018-05-10 13:30:45] SEND (005): 10 40 0B 4B 16 [2018-05-10 13:30:45] RECV (005): 10 40 0B 4B 16
12 [2018-05-10 13:30:45] SEND (005): 10 40 0C 4C 16 [2018-05-10 13:30:45] RECV (005): 10 40 0C 4C 16
13 [2018-05-10 13:30:45] SEND (005): 10 40 0D 4D 16 [2018-05-10 13:30:46] RECV (005): 10 40 0D 4D 16
14 [2018-05-10 13:30:46] SEND (005): 10 40 0E 4E 16 [2018-05-10 13:30:46] RECV (005): 10 40 0E 4E 16
...
So 300 baud works except the fact that the Meter doesn't answer because of wrong baudrate? Please provide more information:
I guess you have a local echo. Back in 2012 implemented a simple echo cancelation, but this isn't perfect. It's the best to fix this in hardware or configuration.
I am using the latest one online (http://www.rscada.se/libmbus/). libmbus-0.8.0.tar.gz. This is the version returned by uname -a: Linux raspberrypi 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU/Linux
Distributor ID: Raspbian Description: Raspbian GNU/Linux 9.3 (stretch) Release: 9.3 Codename: stretch
Unfortunately the "latest" release was in 2012. You better take the current state from github. But this wont fix your problem. Your Raspberry Pi is receiving garbage and libmbus doesn't have any chance to decode it.
Here my ideas to narrow down the issue:
I also did a check on Windows with mbus readout Software first and after that worked I had all Infos also to use on Linux.
I am using an FTDI USB/RS232 convertor (https://www.digikey.ca/products/en/computers-office-components-accessories/adapters-converters/882?k=rs232%20to%20UARt). The usb is connected to the PI and the RS232 side is connected to the Master.
I will try it with windows and report the results back
I am not sure if I am testing it properly on windows, but I have installed bash and followed the same procedure. Now after installing everything from rscada, it gives the following error everytime I try to scan
mbus_serial_connect: failed to open tty.mbus_connect_serial: Failed to setup serial connection to M-bus gateway on /dev/ttyUSB0. Failed to setup connection to M-bus gateway
And when I use lsusb, it does not return any information
On windows you need to use specific MBus software ... google for it ... There are also free versions. I used https://www.relay.de/en/products/software/mbconf/
rscada library is not working under windows ... I have an experimental windows-build-branch in my fork but without all the binaries at the moment.
Hi again and Thank you all for the help.
I kept playing around with the code and this is what I get now:
pi@raspberrypi:~/Desktop/Test2/libmbus-fix-fcb-handling $ mbus-serial-scan -d -b 2400 /dev/ttyUSB0 Scanning primary addresses: 0 [2018-05-14 18:46:21] SEND (005): 10 40 00 40 16 [2018-05-14 18:46:22] RECV (005): 10 40 00 40 16 1 [2018-05-14 18:46:22] SEND (005): 10 40 01 41 16 [2018-05-14 18:46:22] RECV (005): 10 40 01 41 16 2 [2018-05-14 18:46:22] SEND (005): 10 40 02 42 16 [2018-05-14 18:46:22] RECV (005): 10 40 02 42 16 3 [2018-05-14 18:46:22] SEND (005): 10 40 03 43 16 [2018-05-14 18:46:22] RECV (005): 10 40 03 43 16 4 [2018-05-14 18:46:22] SEND (005): 10 40 04 44 16 [2018-05-14 18:46:22] RECV (005): 10 40 04 44 16 5 [2018-05-14 18:46:23] SEND (005): 10 40 05 45 16 [2018-05-14 18:46:23] RECV (005): 10 40 05 45 16 6 [2018-05-14 18:46:23] SEND (005): 10 40 06 46 16 [2018-05-14 18:46:23] RECV (005): 10 40 06 46 16 7 [2018-05-14 18:46:23] SEND (005): 10 40 07 47 16 [2018-05-14 18:46:23] RECV (005): 10 40 07 47 16 8 [2018-05-14 18:46:23] SEND (005): 10 40 08 48 16 [2018-05-14 18:46:23] RECV (005): 10 40 08 48 16 9 [2018-05-14 18:46:24] SEND (005): 10 40 09 49 16 [2018-05-14 18:46:24] RECV (005): 10 40 09 49 16 10 [2018-05-14 18:46:24] SEND (005): 10 40 0A 4A 16 [2018-05-14 18:46:24] RECV (005): 10 40 0A 4A 16 11 [2018-05-14 18:46:24] SEND (005): 10 40 0B 4B 16
Which looks like an echo. If I try the secondary scan: init_slaves: debug: sending init frame #1 [2018-05-14 18:47:35] SEND (005): 10 40 FD 3D 16 [2018-05-14 18:47:35] RECV (005): 10 40 FD 3D 16 init_slaves: debug: sending init frame #2 [2018-05-14 18:47:35] SEND (005): 10 40 FF 3F 16 [2018-05-14 18:47:35] RECV (005): 10 40 FF 3F 16 [2018-05-14 18:47:35] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16 [2018-05-14 18:47:35] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16 [2018-05-14 18:47:36] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16 [2018-05-14 18:47:36] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16 [2018-05-14 18:47:36] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16 [2018-05-14 18:47:36] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16 [2018-05-14 18:47:36] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16 [2018-05-14 18:47:36] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16 [2018-05-14 18:47:36] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16 [2018-05-14 18:47:37] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16 [2018-05-14 18:47:37] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16 [2018-05-14 18:47:37] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16 [2018-05-14 18:47:37] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16 [2018-05-14 18:47:37] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16 [2018-05-14 18:47:37] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16 [2018-05-14 18:47:37] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16 [2018-05-14 18:47:38] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16 [2018-05-14 18:47:38] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16 [2018-05-14 18:47:38] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16 [2018-05-14 18:47:38] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16 [2018-05-14 18:47:38] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16 [2018-05-14 18:47:38] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16 [2018-05-14 18:47:38] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16 [2018-05-14 18:47:39] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16 [2018-05-14 18:47:39] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 6F FF FF FF FF 2A 16 [2018-05-14 18:47:39] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 6F FF FF FF FF 2A 16 [2018-05-14 18:47:39] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 6F FF FF FF FF 2A 16 [2018-05-14 18:47:39] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 6F FF FF FF FF 2A 16 [2018-05-14 18:47:39] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16 [2018-05-14 18:47:39] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16 [2018-05-14 18:47:40] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16 [2018-05-14 18:47:40] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16 [2018-05-14 18:47:40] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16 [2018-05-14 18:47:40] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16 [2018-05-14 18:47:40] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16 [2018-05-14 18:47:40] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16 [2018-05-14 18:47:41] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16 [2018-05-14 18:47:41] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16 [2018-05-14 18:47:41] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16 [2018-05-14 18:47:41] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16
And still no luck in locating the meters. I have tried the MBus master and the USB adapter with third-party MBus software and it is working. I am not sure if I am doing something wrong with the libmbus library.
Any further insights would be greatly appreciated.
Did you tried the combination PC + Linux + MBus master + USB adapter?
I would just like to mention that I a bit new to the whole Linux thing but I am figuring out through reading and searching online ... just in case I asked some trivial question :)
If you mean running Linux on a Windows maching, then yes I have tried that as well and it gave me an error. I will replicate the error and insert it in the comment now.
This is the error: mbus_serial_connect: failed to open tty.mbus_connect_serial: Failed to setup serial connection to M-bus gateway on /dev/ttyUSB0. Failed to setup connection to M-bus gateway
Although it is the same exact setup as on the Pi. But when I try running linux from windows, it seems that it does not recognize the USB probably.
There is also this flag everytime I run the ./configure command
Compiler flags: -g -O2
Running Linux on a Windows machine? Do you mean some kind of Virtual machine (Virtualbox, ...)?
No, from Windows 10 store, I have downloaded an Ubuntu (bash?) and used it. I dont know if that counts as a virtual machine. Here is a screenshot.
It seems I misunderstood what you meant by "PC + Linux + MBus Master + USB Adapter". Could you please elaborate on that?
Sorry, this won't work. You will need a native Linux (for example Ubuntu, Debian) running on your PC.
I have just installed xubuntu on my PC and this is the output:
mzourob@mzourob-OptiPlex-9020:~/Desktop/LibMBus/libmbus-master$ sudo mbus-serial-scan -d -b 2400 /dev/ttyUSB0 [sudo] password for mzourob: Scanning primary addresses: 0 [2018-05-14 20:35:00] SEND (005): 10 40 00 40 16 [2018-05-14 20:35:00] RECV (005): 10 40 00 40 16 1 [2018-05-14 20:35:01] SEND (005): 10 40 01 41 16 [2018-05-14 20:35:01] RECV (005): 10 40 01 41 16 2 [2018-05-14 20:35:01] SEND (005): 10 40 02 42 16 [2018-05-14 20:35:01] RECV (005): 10 40 02 42 16 3 [2018-05-14 20:35:01] SEND (005): 10 40 03 43 16 [2018-05-14 20:35:01] RECV (005): 10 40 03 43 16 4 [2018-05-14 20:35:01] SEND (005): 10 40 04 44 16 [2018-05-14 20:35:01] RECV (005): 10 40 04 44 16 5 [2018-05-14 20:35:01] SEND (005): 10 40 05 45 16 [2018-05-14 20:35:01] RECV (005): 10 40 05 45 16 6 [2018-05-14 20:35:02] SEND (005): 10 40 06 46 16 [2018-05-14 20:35:02] RECV (005): 10 40 06 46 16 7 [2018-05-14 20:35:02] SEND (005): 10 40 07 47 16 [2018-05-14 20:35:02] RECV (005): 10 40 07 47 16
mzourob@mzourob-OptiPlex-9020:~/Desktop/LibMBus/libmbus-master$ sudo mbus-serial-scan-secondary -d -b 2400 /dev/ttyUSB0 init_slaves: debug: sending init frame #1 [2018-05-14 20:36:08] SEND (005): 10 40 FD 3D 16 [2018-05-14 20:36:08] RECV (005): 10 40 FD 3D 16 init_slaves: debug: sending init frame #2 [2018-05-14 20:36:08] SEND (005): 10 40 FF 3F 16 [2018-05-14 20:36:08] RECV (005): 10 40 FF 3F 16 [2018-05-14 20:36:08] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16 [2018-05-14 20:36:09] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16 [2018-05-14 20:36:09] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16 [2018-05-14 20:36:09] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16 [2018-05-14 20:36:09] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16 [2018-05-14 20:36:09] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16 [2018-05-14 20:36:09] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16 [2018-05-14 20:36:09] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16 [2018-05-14 20:36:10] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16 [2018-05-14 20:36:10] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16 [2018-05-14 20:36:10] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16 [2018-05-14 20:36:10] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16 [2018-05-14 20:36:10] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16 [2018-05-14 20:36:10] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16 [2018-05-14 20:36:10] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16 [2018-05-14 20:36:11] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16 [2018-05-14 20:36:11] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16 [2018-05-14 20:36:11] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16 [2018-05-14 20:36:11] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16 [2018-05-14 20:36:11] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16 [2018-05-14 20:36:11] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16 [2018-05-14 20:36:11] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16 [2018-05-14 20:36:12] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16 [2018-05-14 20:36:12] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16 [2018-05-14 20:36:12] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 6F FF FF FF FF 2A 16 [2018-05-14 20:36:12] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 6F FF FF FF FF 2A 16 [2018-05-14 20:36:12] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 6F FF FF FF FF 2A 16 [2018-05-14 20:36:12] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 6F FF FF FF FF 2A 16 [2018-05-14 20:36:12] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16 [2018-05-14 20:36:13] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16 [2018-05-14 20:36:13] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16 [2018-05-14 20:36:13] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16 [2018-05-14 20:36:13] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16 [2018-05-14 20:36:13] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16 [2018-05-14 20:36:13] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16 [2018-05-14 20:36:13] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16 [2018-05-14 20:36:14] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16 [2018-05-14 20:36:14] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16 [2018-05-14 20:36:14] SEND (017): 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16 [2018-05-14 20:36:14] RECV (017): 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16
It looks like the same issue as the one in this link: https://github.com/rscada/libmbus/issues/84
It's possible that the serial adapter introduce a too long delay. I will prepare a test branch.
@MZourob Do you have a possibility to measure the time between request from the 3rd party Windows application and response of the M-Bus slave on UART?
@lategoodbye Hi Stephan,
Thank you very much for your followups. I have figured out the problem and it also relates to issue #84. I was installing and building the package in the normal user mode while using sudo. However, i tried everything in the (su) mode as root. And it all worked perfectly. Now the question is: what are the packages that are involved in the library or installation that needs an (su) permission level?
When I connect three meters, and scan through the primary addresses, it gives a collision at address 0. Just to confirm with you, that has to do with the primary address on the actual meters, is not it? This means that all if the meters are set to a primary address of 0.
When I tried scanning through the secondary addresses, it showed all three different meters and I was able to pull data from them using the mbus-serial-request-data command and their individual addresses.
Just to confirm, when we connect the meters, they are all connected in parallel, is not it?
This confuses me. What did you change to make it working? Does is works under Raspberry Pi, too?
Answers to your questions:
Nevertheless i prepared a extended version of mbus-serial-scan, which provides an option to specify an additional timeout in 1/10 seconds. Btw i reverted my last change to the serial timeouts.
Example with 1 second additional delay: mbus-serial-scan -d -t 10 /dev/ttyUSB0
Relevant branch: https://github.com/rscada/libmbus/tree/adjustable-timeout
@Apollon77 What's your opinion?
Disclaimer: In the lack of a setup only flat tested
@lategoodbye literally all what I did is install the libmbus library while being in su mode and it worked perfectly.
At first I installed the libmbus on the third party Pi, which had its own MBus code and always launches in su mode. The libmbus worked perfectly. This gave me the idea to try the libmbus in su mode on my RPi3 and that’s what I have done. Literally did not change a thing in the setup, and it worked perfectly on both my RPi and the Linux on PC as well. Would this suggest that there is a permission issue in the library? Or the installation? I am not sure as my knowledge with Linux is just two weeks old.
Usually you also always need superuser rights to install libraries. libmbus doesn't have any influence on that. After installation it's necessary to call ldconfig
, which also requires higher privileges.
@lategoodbye change seems reasonable. As soon as you officially commit that I can take the new default timings in my node-lib and receive user feedback too .. and if needed can build the same logic to use the new offset for slower systems if users need that.
@lategoodbye Hello,
I cannot find the mbus-serial-set-address command in the libmbus. Is it by any chance included in an updated version of the library?
I would like to change the MBus primary address on the meters and I thought I can use the mbus-serial-set-address command, however, it is not available within the library I have installed. Did I miss anything?
Thank you.
I don't have access to the rscada website. How about downloading the latest version from github?
That works nicely. Thank you very much @lategoodbye Stefan. Is it possible to communicate with you via email?
Hi Stefan @lategoodbye,
Thank you for all the help so far. I was wondering, is there a way to read stored data in the meter? The meter at hand stores up to 30 days of data. So I was wondering if I can access that data using the Libmbus library.
Thank you.
Hi Stefan @lategoodbye
Hope this message finds you well.
I was wondering if the library can be used to retrieve historical data from the meters. As of now, it pulls the instantaneous values from the meter, However, what about historical data that is stored in the meter?
Thanks.
As long as the datapoints are described within the standard or MBDOC48 it should be possible. Sorry, how should i answer such a unspecific question.
Hi @lategoodbye,
I have figured out that this issue would have to do with the meter firmware and not with the library. I was able to retrieve historical data from the meter that was originally stored by the meter as past variables. So I get back from the meter say 20 variables with 7 of them historical values.
Thanks for the feedback.
@MZourob since you are new to this, i have couple of simple questions but i would rather avoid asking it here. Could you send me an email?
Mohammed.zourob@sagacitysoft.camailto:Mohammed.zourob@sagacitysoft.ca
Best Regards, Mohammed Omar Zourob, Ph.D., M.E.Sc. Electrical/Electronics Engineer
On Jun 29, 2018, at 5:39 PM, nardev notifications@github.com<mailto:notifications@github.com> wrote:
@MZourobhttps://github.com/MZourob since you are new to this, i have couple of simple questions but i would rather avoid asking it here. Could you send me an email?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/rscada/libmbus/issues/138#issuecomment-401480912, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlUjBqaihShS714s5sbdlmd61L6YB6wUks5uBp6egaJpZM4T4u6N.
I am trying to connect to an MBus meter and using a TechBase MBus 10 converter to RS232. Then I use an RS232 to USB and connected to a RPI3 with Raspian. Every time I scan (mbus-serial-scan -b 2400 /dev/ttyUSB0), it reports (Collision at address ###) for the addresses from 0 to 250. And it does not detect the meter. I have tried that with two meters with no luck. Can anyone give me any insights to this issue?
Thanks alot.