robertsLando / node-red-contrib-m-bus

Node-Red node for M-Bus protocol
MIT License
10 stars 7 forks source link

Regular communication errors #37

Closed freeck closed 1 year ago

freeck commented 1 year ago

Hi there, Although 2 attached Kamstrup 603 heatflowmeters produce data, the communication is not perfect. At a poll interval of 3 minutes the received data seems to be corrupted 20-40% of the requests. The Mbus-node produces this error: " Error while reading device ID 55 .... failed to send /recieve M-bus request frame [55]" . Today the communication totally stopped, after restarting the flows the communication recovered. The Mbus signal is not disturbed , I checked this with an oscilloscoop. I dont have a serial analyser.

Any ideas how to solve this? Perhaps there is a control strategy to overcome this by periodically send a " restart" command to the Mbus-control node?

robertsLando commented 1 year ago

Tried to change baud-rate and timeout?

freeck commented 1 year ago

Sure, I tried from 300 to 9600 baud, same effect. I dont know what the normal behaviour is of the reconnecting proces? It takes from 5-10 seconds. During this proces I dont see any activity on the serial port. Changing the timeout value has no effect. Normally the connection status is "connected", the error occurs always after the "read id" command. During which there is activity on the serial port.

robertsLando commented 1 year ago

Sorry I dunno how to help you so

freeck commented 1 year ago

I tested the Mbus interface (platform Rasp-4) with the Mbus-utilities " mbus-serial-request-data" even at a baudrate up to 19200. Everything ran without any problems, so hardware-issues may be excluded. Perhaps you can provide me any new hints for further analysis?

Do I have to install mbuslib separatly from installing the node-red library, or is it part of the node-red install procedure?

robertsLando commented 1 year ago

Do I have to install mbuslib separatly from installing the node-red library, or is it part of the node-red install procedure?

That is shipped within this node.

Perhaps you can provide me any new hints for further analysis?

If you are familiar with nodejs you could try to create your own nodejs program that connects to your hardware using the same lib I use here (node-mbus) or try directly edit the files of this project inside node_modules dir

freeck commented 1 year ago

Thanks. Unfortunately I am not familiar with node.js . First of all I will isolate this mbus-flow from the present application, or/and install everything on a different platform, and see what happens.

Perhaps as a last resort I could execute the Mbus-utilities " mbus-serial-request-data" within Nodered and redirect the xml-output to nodered?

robertsLando commented 1 year ago

Yeah you could do that

freeck commented 1 year ago

Major step forward: I installed nodered and the Mbus-flow on a different Raspberry , removed the other flows from my application. Until now we have a reliable connection with the 2 flowmeters!

Could it have anything to do with the schedule priority of node.js, nodered or cpu-load? Next step: add the other flows and see what happens.

robertsLando commented 1 year ago

Could it have anything to do with the schedule priority of node.js, nodered or cpu-load?

I don't think so, maybe the problem is the usb port not working well?

freeck commented 1 year ago

I tried the other USB-ports but same effect. Then I tried the uart of the GPIO-bus (pin 8 and 10). The device name then available is called "/dev/serial0" . But unfortunately the Mbus-node does not accept this port. Its keeping "re-connecting"...

PS: I found the solution here: https://cdn.shopify.com/s/files/1/0176/3274/files/Datasheet_MBUS_HAT_Rev_A.pdf?v=1664303535 On page 6 the commands to enable and free port "/dev/serial0" are described. So now I got rid of the USB-serial-ports. Until now the communication works fine. So after all the mbus-node works great. Nevertheless I hope this information is usefull for other users.

robertsLando commented 1 year ago

Thanks for your feedback @freeck , glad you have found a solution to this, hope this will help someone else 🙏🏼