Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout problem for 2400 baud #124

Closed
btrhad opened this issue Apr 7, 2017 · 7 comments
Closed

Timeout problem for 2400 baud #124

btrhad opened this issue Apr 7, 2017 · 7 comments

Comments

@btrhad
Copy link

btrhad commented Apr 7, 2017

I am using libmbus on a Beaglebone black and had no problems in retrieving data from various meter types. Until I encountered a GWF UniCocoder water meter. This meter is fixed at 2400 baud. I was able to do an address scan, but an serial-request-data at 2400 baud always failed. Checking with a scope I found the device was sending a correct response, but the Beaglebone as master was not able to parse the response.
I found out the Timeout for 2400 baud in mbus_serial_set_baudrate() was just a little bit to short.
Changing handle-t.c.c_cc[VTIME] from 2 to 3 solved the problem.

@lategoodbye
Copy link
Collaborator

lategoodbye commented Apr 7, 2017

@btrhad I want to know more about your setup (starting from Beaglebone until M-Bus wire).
What kind of M-Bus master do you use?
Do you use Linux on the Beaglebone?

Edit: Sorry, it's not your job but i don't access to a M-Bus setup, but could you please dump the return value of tcdrain by patching mbus-serial.c with your setup:

ret = tcdrain(handle->fd);
fprintf(stderr, "tcdrain = %d\n", ret);

@btrhad
Copy link
Author

btrhad commented Apr 7, 2017 via email

@lategoodbye
Copy link
Collaborator

@btrhad Could you please try this branch (which contains your suggestion):

https://github.com/rscada/libmbus/tree/serial-timeout

@btrhad
Copy link
Author

btrhad commented Apr 7, 2017 via email

@lategoodbye
Copy link
Collaborator

I created a branch to fix FCB handling:

https://github.com/rscada/libmbus/tree/fix-fcb-handling

but didn't get positive feedback. In case there is a real issue please feel free to open a new issue or at least try this branch, too.

@btrhad
Copy link
Author

btrhad commented Apr 10, 2017 via email

@lategoodbye
Copy link
Collaborator

I merged the serial-timeout branch into the master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants