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

Help with usb to RS485 - SH-U11 #93

Open
jjhdtv opened this issue Apr 2, 2023 · 1 comment
Open

Help with usb to RS485 - SH-U11 #93

jjhdtv opened this issue Apr 2, 2023 · 1 comment

Comments

@jjhdtv
Copy link

jjhdtv commented Apr 2, 2023

I'm attempting to run mbusd on a openwrt device using a SH-U11 usb to RS485.
I have tested the SH-U11 with a windows machine and it works.

The goal is to get the RS485 data from my Solar Inverter served up by mbusd on the openwrt machine and accessed by a different machine running home assistant. I have stumbled on others doing a similar setup and it seems to be a good fit in what I want to accomplish.

The log below shows my start up parameters, running mbusb, and a connection being made by the HA machine (local address 192.168.1.40). It is unclear to me if mbusd is working. Hopefully the log will tell the story to someone who understands it. I'm not receiving data on the HA machine. I have also been unsuccessful trying to connect with windows (running modpoll). I have also notice that when connected, the SH-U11 does not have blinking data LEDs for RX/TX. I believe it did when using windows/modpoll.

Appreciate the suggestions,

log below:

root@OpenWrt:~# mbusd -L/tmp/mbusd.log -s 9600 -T 1000 -P 502 -d -v9

02 Apr 2023 06:31:44 mbusd-0.5.0 started...
02 Apr 2023 06:31:44 tty: trying to open /dev/ttyS0 (speed 9600 mode 8N1)
02 Apr 2023 06:31:44 tty: state now is TTY_PAUSE
02 Apr 2023 06:31:44 conn_loop(): select(): max_sd = 4, t_out = 217673204:000000
02 Apr 2023 06:31:44 conn_loop(): select() returns 0
02 Apr 2023 06:31:44 tty: state now is TTY_READY
02 Apr 2023 06:31:44 conn_loop(): select(): max_sd = 4, t_out = 243484302:000000
02 Apr 2023 06:32:00 conn_loop(): select() returns 1
02 Apr 2023 06:32:00 conn_open(): accepting connection from 192.168.1.40
02 Apr 2023 06:32:00 queue_new_elem(): length now is 1
02 Apr 2023 06:32:00 conn[192.168.1.40]: state now is CONN_HEADER
02 Apr 2023 06:32:00 conn_loop(): select(): max_sd = 5, t_out = 14618308:000000
02 Apr 2023 06:32:00 conn_loop(): select() returns 1
02 Apr 2023 06:32:00 conn[192.168.1.40]: state now is CONN_RQST_FUNC
02 Apr 2023 06:32:00 conn_loop(): select(): max_sd = 5, t_out = 15173046:000000
02 Apr 2023 06:32:00 conn_loop(): select() returns 1
02 Apr 2023 06:32:00 conn[192.168.1.40]: read request fc 3
02 Apr 2023 06:32:00 conn[192.168.1.40]: state now is CONN_RQST_TAIL
02 Apr 2023 06:32:00 conn[192.168.1.40]: request: [01][03][00][03][00][05]
02 Apr 2023 06:32:00 conn[192.168.1.40]: state now is CONN_TTY
02 Apr 2023 06:32:00 tty: state now is TTY_RQST
02 Apr 2023 06:32:00 conn_loop(): select(): max_sd = 4, t_out = 17534273:000000
02 Apr 2023 06:32:00 conn_loop(): select() returns 1
02 Apr 2023 06:32:00 tty: written 8 bytes
02 Apr 2023 06:32:00 tty: request written (total 8 bytes)
02 Apr 2023 06:32:00 tty: state now is TTY_RESP
02 Apr 2023 06:32:00 tty: estimated 15 bytes, waiting 523958 usec
02 Apr 2023 06:32:00 conn_loop(): select(): max_sd = 4, t_out = 19122927:000000
02 Apr 2023 06:32:00 conn_loop(): select() returns 0
02 Apr 2023 06:32:00 tty: response timeout
02 Apr 2023 06:32:00 tty: attempt to retry request (1 of 3)
02 Apr 2023 06:32:00 tty: state now is TTY_RQST
02 Apr 2023 06:32:00 tty: written 8 bytes
02 Apr 2023 06:32:00 tty: request written (total 8 bytes)
02 Apr 2023 06:32:00 tty: state now is TTY_RESP
02 Apr 2023 06:32:00 tty: estimated 15 bytes, waiting 523958 usec
02 Apr 2023 06:32:00 conn_loop(): select(): max_sd = 4, t_out = 152089299:000000
02 Apr 2023 06:32:01 conn_loop(): select() returns 0
02 Apr 2023 06:32:01 tty: response timeout
02 Apr 2023 06:32:01 tty: attempt to retry request (2 of 3)
02 Apr 2023 06:32:01 tty: state now is TTY_RQST
02 Apr 2023 06:32:01 tty: written 8 bytes
02 Apr 2023 06:32:01 tty: request written (total 8 bytes)
02 Apr 2023 06:32:01 tty: state now is TTY_RESP
02 Apr 2023 06:32:01 tty: estimated 15 bytes, waiting 523958 usec
02 Apr 2023 06:32:01 conn_loop(): select(): max_sd = 4, t_out = 35013825:000000
02 Apr 2023 06:32:01 conn_loop(): select() returns 0
02 Apr 2023 06:32:01 tty: response timeout
02 Apr 2023 06:32:01 tty: attempt to retry request (3 of 3)
02 Apr 2023 06:32:01 tty: state now is TTY_RQST
02 Apr 2023 06:32:01 tty: written 8 bytes
02 Apr 2023 06:32:01 tty: request written (total 8 bytes)
02 Apr 2023 06:32:01 tty: state now is TTY_RESP
02 Apr 2023 06:32:01 tty: estimated 15 bytes, waiting 523958 usec
02 Apr 2023 06:32:01 conn_loop(): select(): max_sd = 4, t_out = 168449085:000000
^C02 Apr 2023 06:32:02 conn_loop(): select() returns -1
02 Apr 2023 06:32:02 conn_loop(): error in select() (Invalid argument)
02 Apr 2023 06:32:02 conn_open(): error in accept() (Resource temporarily unavailable)
02 Apr 2023 06:32:02 tty: error in read() (Resource temporarily unavailable)
02 Apr 2023 06:32:02 trying to re-open tty...
02 Apr 2023 06:32:02 tty re-opening...
02 Apr 2023 06:32:02 tty: trying to open /dev/ttyS0 (speed 9600 mode 8N1)
02 Apr 2023 06:32:02 tty: state now is TTY_PAUSE
02 Apr 2023 06:32:02 tty re-opened.
02 Apr 2023 06:32:02 tty: read -1 bytes
02 Apr 2023 06:32:02 tty: read 255 bytes of 15, offset 0
02 Apr 2023 06:32:02 Terminated by signal: SIGINT
root@OpenWrt:~#

@jjhdtv
Copy link
Author

jjhdtv commented Apr 2, 2023

I was able to get it going by installing kmod-usb-serial-ftdi. Now my U11 has a ttyUSB0 address and things are working.

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

1 participant