Unreliable serial communications
jmaunder opened this issue · comments
Describe the problem
My system: EasySolar-II GX, 6 x 50 Ah 17s LiFePO4 with JBD (Jiabaida) SP22S003 BMS. BMS communication is BMS UART <> Isolation module ADUM1201 <> Generic USB to TTL module <> USB cable <> USB port on GX card. Communication works OK with JBDtools. BMS modules have Bluetooth as well, but I found this to also be too unreliable, hence I am trying to do the serial connection.
Problem: seemingly random intermittent loss of the serial connection, eventually it does not re-connect. Not reliable enough to put it into service. If I leave it long enough, it eventually re-established the connection but this might take more than 15 minutes, which is too long without BMS information for useful control.
What I've tried: With USB hub and 2 x batteries, without USB hub and 1 x battery (direct connection). With aggregate-batteries and without it. Log file corresponds to 1 x battery and no USB hub, aggregate-batteries inactive.
Driver version
v1.2.20240401
Venus OS device type
GX Card (integrated in Victron device)
Venus OS version
v3.13
BMS type
Smart BMS (LLT, JBD, Overkill Solar)
Cell count
17
Battery count
1
Connection type
Serial USB adapter to TTL
Config file
[DEFAULT]
; If you want to add custom values/settings, then check the values/settings you want to change in "config.default.ini"
; and insert them below to persist future driver updates.
; Specify one or more BMS types to load else leave empty to try to load all available
; Available BMS:
; Daly, Ecs, HeltecModbus, HLPdataBMS4S, Jkbms, Lifepower, LltJbd, Renogy, Seplos
; Available BMS, but disabled by default (just enter one or more below and it will be enabled):
; ANT, MNB, Sinowealth
BMS_TYPE = LltJbd
; Example (remove the semicolon ";" to uncomment and activate the value/setting):
MAX_BATTERY_CHARGE_CURRENT = 50.0
MAX_BATTERY_DISCHARGE_CURRENT = 50.0
; Battery temperature
; Specify how the battery temperature is assembled
; 0 Get mean of temperature sensor 1 to sensor 4
; 1 Get only temperature from temperature sensor 1
; 2 Get only temperature from temperature sensor 2
; 3 Get only temperature from temperature sensor 3
; 4 Get only temperature from temperature sensor 4
TEMP_BATTERY = 1
; Temperature sensor 1 name
TEMP_1_NAME = Pack Temp. 1
; Temperature sensor 2 name
TEMP_2_NAME = Pack Temp. 2
; Temperature sensor 2 name
TEMP_3_NAME = Temp 3
; Temperature sensor 2 name
TEMP_4_NAME = Temp 4
; --------- Time-To-Go ---------
; Description:
; Calculates the time to go shown in the GUI
; Recalculation is done based on TIME_TO_SOC_RECALCULATE_EVERY
TIME_TO_GO_ENABLE = False
Relevant log output
root@nanopi:~# tail -F -n 100 /data/log/dbus-serialbattery.ttyUSB0/current
@40000000665bcf53385ec74c INFO:SerialBattery:Starting dbus-serialbattery
@40000000665bcf5338795bfc INFO:SerialBattery:Venus OS v3.13
@40000000665bcf533880bab4 INFO:SerialBattery:dbus-serialbattery v1.2.20240401
@40000000665bcf6339862c64 INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
@40000000665bcf63398f968c INFO:SerialBattery:Testing LltJbd
@40000000665bcf6409080cc4 ERROR:SerialBattery:[Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'
@40000000665bcf6426f6ccd4 INFO:SerialBattery:-- Testing BMS: 2 of 3 rounds
@40000000665bcf6426fe8564 INFO:SerialBattery:Testing LltJbd
@40000000665bcf6427139fbc ERROR:SerialBattery:[Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'
@40000000665bcf65095ea4bc INFO:SerialBattery:-- Testing BMS: 3 of 3 rounds
@40000000665bcf6509667c8c INFO:SerialBattery:Testing LltJbd
@40000000665bcf65097de4bc ERROR:SerialBattery:[Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'
@40000000665bcf652764676c ERROR:SerialBattery:ERROR >>> No battery connection at /dev/ttyUSB0
@40000000665bcf7a2223a984 INFO:SerialBattery:
@40000000665bcf7a222d4674 INFO:SerialBattery:Starting dbus-serialbattery
@40000000665bcf7a224a6b64 INFO:SerialBattery:Venus OS v3.13
@40000000665bcf7a22523f4c INFO:SerialBattery:dbus-serialbattery v1.2.20240401
@40000000665bcf8a2357ef7c INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
@40000000665bcf8a2360d8bc INFO:SerialBattery:Testing LltJbd
@40000000665bcf8b0025d1a4 ERROR:SerialBattery:Exception occurred: OSError(5, 'Input/output error') of type <class 'OSError'> in /opt/victronenergy/dbus-serialbattery/bms/lltjbd.py line #275
@40000000665bcf8b1e102cb4 INFO:SerialBattery:-- Testing BMS: 2 of 3 rounds
@40000000665bcf8b1e17d98c INFO:SerialBattery:Testing LltJbd
@40000000665bcf8b1e2dd674 ERROR:SerialBattery:[Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'
@40000000665bcf8c007b8af4 INFO:SerialBattery:-- Testing BMS: 3 of 3 rounds
@40000000665bcf8c00842de4 INFO:SerialBattery:Testing LltJbd
@40000000665bcf8d1603661c INFO:SerialBattery:Connection established to LltJbd
@40000000665bcf8e0f42ab6c INFO:SerialBattery:Found existing battery with DeviceInstance = 7
@40000000665bcf8e18cd3094 INFO:SerialBattery:DeviceInstance = 7
@40000000665bcf8e18e2f6cc INFO:SerialBattery:PID file created successfully: /var/tmp/dbus-serialbattery_7.pid
@40000000665bcf8e18ebf77c INFO:SerialBattery:Used DeviceInstances = ['5', '7', '6', '1', '3', '2', '4']
@40000000665bcf8e18f4a23c INFO:SerialBattery:com.victronenergy.battery.ttyUSB0
@40000000665bcf8f0d9c5e0c INFO:SerialBattery:publish config values = True
@40000000665bcf8f0ebe44e4 INFO:SerialBattery:Battery LLT/JBD connected to dbus from /dev/ttyUSB0
@40000000665bcf8f0ec53e0c INFO:SerialBattery:========== Settings ==========
@40000000665bcf8f0ecedafc INFO:SerialBattery:> Connection voltage: 56.87V | Current: 3.47A | SoC: None%
@40000000665bcf8f0ed52074 INFO:SerialBattery:> Cell count: 17 | Cells populated: 17
@40000000665bcf8f0edad564 INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
@40000000665bcf8f0ee0d0a4 INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9V | MAX CELL VOLTAGE: 3.45V
@40000000665bcf8f0ee6a8bc INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 50.0A | MAX BATTERY DISCHARGE CURRENT: 50.0A
@40000000665bcf8f0eec7904 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 60.0A | MAX BATTERY DISCHARGE CURRENT: 70.0A (read from BMS)
@40000000665bcf8f0ef1eb8c INFO:SerialBattery:> CVCM: True
@40000000665bcf8f0ef7a84c INFO:SerialBattery:> CCCM CV: True | DCCM CV: True
@40000000665bcf8f0efd2e5c INFO:SerialBattery:> CCCM T: True | DCCM T: True
@40000000665bcf8f0f02ac9c INFO:SerialBattery:> CCCM SOC: False | DCCM SOC: False
@40000000665bcf8f0f09a9ac INFO:SerialBattery:Serial Number/Unique Identifier: 76_50.5Ah
@40000000665bcf9020378d0c ERROR:SerialBattery:read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
@40000000665bcf910ee75c6c ERROR:SerialBattery:[Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'
@40000000665bcf93117ae444 Traceback (most recent call last):
@40000000665bcf93117b170c File "/opt/victronenergy/dbus-serialbattery/dbushelper.py", line 760, in publish_battery
@40000000665bcf93117b26ac result = self.battery.refresh_data()
@40000000665bcf93117b2e7c File "/opt/victronenergy/dbus-serialbattery/bms/lltjbd.py", line 460, in refresh_data
@40000000665bcf93117b3e1c return self.read_gen_data() and self.read_cell_data()
@40000000665bcf93117b45ec File "/opt/victronenergy/dbus-serialbattery/bms/lltjbd.py", line 546, in read_gen_data
@40000000665bcf93117e3004 gen_data = self.read_serial_data_llt(self.command_general)
@40000000665bcf93117e438c File "/opt/victronenergy/dbus-serialbattery/bms/lltjbd.py", line 668, in read_serial_data_llt
@40000000665bcf93117e532c data = read_serial_data(
@40000000665bcf93117e5afc File "/opt/victronenergy/dbus-serialbattery/utils.py", line 348, in read_serial_data
@40000000665bcf93117e66b4 with serial.Serial(port, baudrate=baud, timeout=0.1) as ser:
@40000000665bcf93117ed414 File "/usr/lib/python3.8/site-packages/serial/serialutil.py", line 240, in __init__
@40000000665bcf93117ee3b4 self.open()
@40000000665bcf93117eeb84 File "/usr/lib/python3.8/site-packages/serial/serialposix.py", line 286, in open
@40000000665bcf93117ef73c self._update_dtr_state()
@40000000665bcf93117eff0c File "/usr/lib/python3.8/site-packages/serial/serialposix.py", line 634, in _update_dtr_state
@40000000665bcf93118154b4 fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
@40000000665bcf9311816454 OSError: [Errno 5] Input/output error
@40000000665bcf9311816c24 #0
@40000000665bcf931181700c #1
@40000000665bcf93118173f4 #2
@40000000665bcf93118177dc #3
@40000000665bcf9311817bc4 #4
@40000000665bcf9311817fac #5
@40000000665bcf9311818394 #6
@40000000665bcf9311818394 #7
@40000000665bcf931181877c #8
@40000000665bcf931182047c #9
@40000000665bcf9311820c4c #10
@40000000665bcf9311821034 #11
@40000000665bcf931182141c #12
@40000000665bcf9311821804 #13
@40000000665bcf9311821bec #14
@40000000665bcf9311821fd4 #15
@40000000665bcf93118223bc #16
@40000000665bcf93118227a4 #0
@40000000665bcf9311822b8c #1
@40000000665bcf9311822f74 #2
@40000000665bcf931182335c #3
@40000000665bcf9311823744 #4
@40000000665bcf9311823b2c #5
@40000000665bcf9311823f14 #6
@40000000665bcf93118242fc #7
@40000000665bcf93118246e4 #8
@40000000665bcf9311828d34 #9
@40000000665bcf9311829504 #10
@40000000665bcf93118298ec #11
@40000000665bcf9311829cd4 #12
@40000000665bcf931182a0bc #13
@40000000665bcf931182a0bc #14
@40000000665bcf931182a4a4 #15
@40000000665bcf931182a88c #16
@40000000665bcf931b6c58fc /opt/victronenergy/serial-starter/run-service.sh: line 15: kill: (16355) - No such process
@40000000665bcfaf154da6c4 INFO:SerialBattery:
@40000000665bcfaf1562d4a4 INFO:SerialBattery:Starting dbus-serialbattery
@40000000665bcfaf1584bc54 INFO:SerialBattery:Venus OS v3.13
@40000000665bcfaf158ea764 INFO:SerialBattery:dbus-serialbattery v1.2.20240401
@40000000665bcfbf167296f4 INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
@40000000665bcfbf167a91ec INFO:SerialBattery:Testing LltJbd
@40000000665bcfc017430e24 INFO:SerialBattery:Connection established to LltJbd
@40000000665bcfc110448ef4 INFO:SerialBattery:Found existing battery with DeviceInstance = 7
@40000000665bcfc119b50824 INFO:SerialBattery:DeviceInstance = 7
@40000000665bcfc119cb3bbc INFO:SerialBattery:PID file created successfully: /var/tmp/dbus-serialbattery_7.pid
@40000000665bcfc119d2a62c INFO:SerialBattery:Used DeviceInstances = ['5', '7', '6', '1', '3', '2', '4']
@40000000665bcfc119d9ddd4 INFO:SerialBattery:com.victronenergy.battery.ttyUSB0
@40000000665bcfc129a05194 #0
@40000000665bcfc129a074bc #1
@40000000665bcfc129a07c8c #2
@40000000665bcfc129a08074 #3
@40000000665bcfc129a0845c #4
@40000000665bcfc129a0845c #5
@40000000665bcfc129a08844 #6
@40000000665bcfc129a08c2c #7
@40000000665bcfc129a09014 #8
@40000000665bcfc129a093fc #9
@40000000665bcfc129a097e4 #10
@40000000665bcfc129a09fb4 #11
@40000000665bcfc129a0a39c #12
@40000000665bcfc129a0a784 #13
@40000000665bcfc129a0ab6c #14
@40000000665bcfc129a0af54 #15
@40000000665bcfc129a0af54 #16
@40000000665bcfc12aa16614 Traceback (most recent call last):
@40000000665bcfc12aa194f4 File "/opt/victronenergy/dbus-serialbattery/dbus-serialbattery.py", line 255, in <module>
@40000000665bcfc12aa1a0ac main()
@40000000665bcfc12aa1a87c File "/opt/victronenergy/dbus-serialbattery/dbus-serialbattery.py", line 235, in main
@40000000665bcfc12aa1b434 if not helper.setup_vedbus():
@40000000665bcfc12aa1bc04 File "/opt/victronenergy/dbus-serialbattery/dbushelper.py", line 475, in setup_vedbus
@40000000665bcfc12aa1cba4 if not self.battery.get_settings():
@40000000665bcfc12aa4b1d4 File "/opt/victronenergy/dbus-serialbattery/bms/lltjbd.py", line 302, in get_settings
@40000000665bcfc12aa4c55c cycle_cap = self.read_serial_data_llt(readCmd(REG_CYCLE_CAP))
@40000000665bcfc12aa4d114 File "/opt/victronenergy/dbus-serialbattery/bms/lltjbd.py", line 668, in read_serial_data_llt
@40000000665bcfc12aa4e49c data = read_serial_data(
@40000000665bcfc12aa4ec6c File "/opt/victronenergy/dbus-serialbattery/utils.py", line 348, in read_serial_data
@40000000665bcfc12aa588ac with serial.Serial(port, baudrate=baud, timeout=0.1) as ser:
@40000000665bcfc12aa59464 File "/usr/lib/python3.8/site-packages/serial/serialutil.py", line 240, in __init__
@40000000665bcfc12aa5a404 self.open()
@40000000665bcfc12aa5a7ec File "/usr/lib/python3.8/site-packages/serial/serialposix.py", line 286, in open
@40000000665bcfc12aa5b78c self._update_dtr_state()
@40000000665bcfc12aa847cc File "/usr/lib/python3.8/site-packages/serial/serialposix.py", line 634, in _update_dtr_state
@40000000665bcfc12aa85b54 fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
@40000000665bcfc12aa8670c OSError: [Errno 19] No such device
@40000000665bcfc133d80a94 /opt/victronenergy/serial-starter/run-service.sh: line 15: kill: (16912) - No such process
@40000000665bcfd800f74aa4 INFO:SerialBattery:
@40000000665bcfd800feebc4 INFO:SerialBattery:Starting dbus-serialbattery
@40000000665bcfd8011997e4 INFO:SerialBattery:Venus OS v3.13
@40000000665bcfd801207d84 INFO:SerialBattery:dbus-serialbattery v1.2.20240401
Any other information that may be helpful
The log output above is with the driver seemingly trying and re-trying to connect and failing.
serial-battery is promising, but unless I can have reliable BMS communication I cannot use it. Motivated to get it working 100%. Very little dbus, Raspberry Pi, Unix and Python knowledge but I can learn. Some electronics knowledge. Rest of the system working well. Until I have serial-battery working I will rely on Multi charging algorithm and BMS only for protection, not control.
Please read carefully how to provide logs in correct format. Check the documentation or read carefully the instructions when you open an issue.
Please read carefully how to provide logs in correct format. Check the documentation or read carefully the instructions when you open an issue.
Thanks for your reply, not sure what I've done wrong? I tried to follow the instructions as best I could. Happy to supply more information, whatever is needed.
When opening an issue:
Please copy and paste any relevant log output here. See here how to get the driver log files. The content will be automatically formatted into code, so no need for backticks.
⚠️ IMPORTANT: Do not forget to pipe the output throughtai64nlocal
, if you don't copy the commands from the documentation.
Anyway, your problem seems to be a unreliable USB to TTL adapter, since it disappears from the USB port. You could also check with lbusb
, if your adapter is still recognized after a failure.
I'm not sure it is, I have tried two different USB-TTL adapters and the problem persists. I tried 'lsusb' and the FTDI adapter appears there, so the adapter is present, but the serial-battery is not.
root@nanopi:~# lsusb
Bus 003 Device 023: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0bda:d723 Realtek Semiconductor Corp. 802.11n WLAN Adapter
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
When I run the command <tail -F -n 100 /data/log/serial-starter/current | grep dbus-serialbattery | tai64nlocal> I get no output. Opening 'current' directly from WinSCP below is a snippet of recent entries. There are no error or warning entries in the log.
@40000000665bd1f6181aa974 INFO: Start service dbus-modbus-client.serial.ttyUSB0 once
@40000000665bd1f924d6afdc INFO: Start service dbus-serialbattery.ttyUSB0 once
@40000000665bd2c833d5ef84 INFO: Start service gps-dbus.ttyUSB0 once
@40000000665bd2d2087fdd7c INFO: Start service vedirect-interface.ttyUSB0 once
@40000000665bd2d7167c2444 INFO: Start service dbus-cgwacs.ttyUSB0 once
@40000000665bd2dc23e5914c INFO: Start service dbus-fzsonick-48tl.ttyUSB0 once
@40000000665bd2df300df2d4 INFO: Start service dbus-imt-si-rs485tc.ttyUSB0 once
@40000000665bd2e300dc256c INFO: Start service dbus-modbus-client.serial.ttyUSB0 once
@40000000665bd2e60cfc266c INFO: Start service dbus-serialbattery.ttyUSB0 once
@40000000665bd2fd253faadc INFO: Start service gps-dbus.ttyUSB0 once
@40000000665bd3003190a6ec INFO: Start service vedirect-interface.ttyUSB0 once
@40000000665bd30402509144 INFO: Start service dbus-cgwacs.ttyUSB0 once
@40000000665bd30910b219ec INFO: Start service dbus-fzsonick-48tl.ttyUSB0 once
@40000000665bd30c1da6eb64 INFO: Start service dbus-imt-si-rs485tc.ttyUSB0 once
@40000000665bd30f2a38578c INFO: Start service dbus-modbus-client.serial.ttyUSB0 once
@40000000665bd31236e02a14 INFO: Start service dbus-serialbattery.ttyUSB0 once
Did you go through the whole troubleshooting section? There is exactly explained what to check.
Make sure to also check What to check, if it doesn't work.
Also try the latest nightly.