Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with serial/usb communication with M-Bus

Solved!
Go to solution

Hi all,

For reading out the values from a heat meter with M-Bus I'm using a USB converter which is connected to a PC. I am able to confirm it is properly configured and functional with M-Bus sheet software. However, for datalogging purposes I want to integrate this in LabVIEW, but have been unsuccessful so far. I'm using the example Simple Serial.vi to test simple commands (configuration settings are checked to be correct). For troubleshooting I have already consulted a similar topic on the forum: https://forums.ni.com/t5/LabVIEW/Problem-with-M-Bus-communication/td-p/2993583

I have implemented a string control on the 'VISA Write' object and made sure to select 'Hex display' on the front panel. Then I tried to send SND_NKE: 10 40 06 46 16 (n.b. in the string control this is automatically converted to 1040 0646 16). However, I don't get any response whatsoever. Normally, it should return 'E5'. Also, no error is thrown from the serial configuration, write, read or anywhere else. Upon hanging an indicator on the 'Return count' of the 'VISA Write' I do retrieve the value 5.

My experience with programming this, datatypes etc. is quite limited. Hopefully someone can help me figure out what is going wrong.

0 Kudos
Message 1 of 7
(5,613 Views)

Hi

Do you have had any communication?

Or do you have a wiring problem, nul modem versus straight connection happens often in serial communication.

For the software side, attach your vi, we can try to find an error then.

greetings from the Netherlands
Message 2 of 7
(5,584 Views)

Hi,

 

Thanks for your response. Communication with the M-Bus Sheet software works fine. There should be no physical wiring problems. I have included the .vi file that I use simply to test if I can get any sort of response when I send the SND_NKE. No errors, no responses.

Message 3 of 7
(5,577 Views)
Solution
Accepted by topic author allovichi

Hi allovichi,

 

Thank you for posting your VI, that makes helping so much easier! Your VI looks okay. There is a possible issue in it, however with more information about the M-BUS protocol (or testing from your side) it's impossible to change it right now: does the protocol uses a general stop character (apart from the 0x16 that is used in some datagrams) like LF or CR? This would allow to remove the "bytes at port" functionality, which often causes a lot of trouble.

 

Which is the sensor you use? I think I found several devices from the company that made the software you posted. I took the manual of "Sensor THI" to get information on the protocol. Maybe you have a better source.

 

Do you know if the primary address is correct, and how to calculate the checksum? I could not verify them.

 

And, 2nd-most important: I found that the standard baud rate (of the device whose manual I was looking at) is 2400. This might apply to your device as well.

 

Most important: I found a forum thread "Problem with M-Bus communication" where an issue similar to yours was solved by: "Parity in VISA configuration should be "Even"." MAybe you want to give this a try as well?

 

 

Edit: When troubleshooting similar sensors back at university, I used a Serial Port Monitor software on the PC they were attached to (using an RS232-USB converter, too). This helped me understanding a protocol that did not have proper documentation. I used a open source, free software for this.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
Message 4 of 7
(5,570 Views)
Hi, The problem has been solved. The parity indeed had to be set to 'even' (in a different .vi I had tested this before, but didn't work for whatever reason). This was not reported either by the documentation of the "Mikro-Master" (that is the device I use for USB communication) or the M-Bus of the heat meter. The primary address was indeed correct and the checksum is the sum of certain fields in the telegram (in the SND_NKE case: 40 + 06 => 46). Baudrate was set correctly. I am now able to collect all the data I need. Time for some further fine tuning. Thank you for your help!
0 Kudos
Message 5 of 7
(5,553 Views)

Hello allovichi,

 

Good to read it's solved!

 

Please mark one of the answers in this thread as "solution", so that others facing the same issue can find it.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 6 of 7
(5,540 Views)

Hello,

 

Thanks for the example program, it was very handy. I have expanded the program further. and made it suitable for a USB Relay M-bus interface and a kamstrup multical 403. (see program).

hopefully it will help someone.

Message 7 of 7
(4,839 Views)