question

Mack Allison avatar image
Mack Allison asked

How do I direct Venus OS to probe a particular serial port?

Where can I configure which serial ports (by name) will be probed by Venus? I need to listen to a BlueSolar MPPT charger over IP serial. I have all of the relevant steps completed leading up to it. I can

  • read from the VE.Direct TTL pins, via a logic converter,
  • pick it up in a serial <-> ethernet converter
  • watch the console output on putty or minicom
  • read it properly from the Windows application after autodetection.

So the question becomes, how do I direct venus OS to probe a particular serial port and look for it?

Raspberry Pi
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

2 Answers
mvader (Victron Energy) avatar image
mvader (Victron Energy) answered ·

Hi Mack, that will involve some code reading & experimenting :o).


what you need to look into is the serial-starter (search the rootfs) and udev (search the internet to understand it generically, and search rootfs to see how we use it).

Or, to skip the auto-scanning, start the vedirect-interface driver manually on that port.

Make sure to search our venus wiki on gothub for “serial”.

Success & enjoy, Matthijs

6 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ commented ·

Ps, reading through these 45 commits will also help in udev understanding

https://github.com/victronenergy/meta-victronenergy/search?q=udev&type=Commits

0 Likes 0 ·
Mack Allison avatar image Mack Allison commented ·

Thanks, mvader, that helped point me in the right direction. Ultimately it was a relatively straightforward application of this: https://github.com/victronenergy/venus/wiki/install-venus-packages-on-Debian, if that helps another who stumbles on this post.

I will add that the script:/data/services/vedirect00/run

must give an explicit --dbus-instance

#!/bin/sh
exec 2>&1
exec /opt/victronenergy/vedirect-interface/vedirect-dbus -v --log-before 25 --log-after 25 -t30 --banner -s /dev/ttyV0 --dbus-instance 233

In my case /dev/ttyV0 is a tcp serial port being created by socat and the instance 233 was chosen at random to deal with this error in

/var/log/vedirect00/run/current
failed to determine a unique number, see --dbus-instance

I'm certain now it could be just as easily implemented in VenusOS but it was easier with all the tools.

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ Mack Allison commented ·

nice! .

.

.

0 Likes 0 ·
Mack Allison avatar image Mack Allison mvader (Victron Energy) ♦♦ commented ·

I have hit a snag when adapting back to the Venus pi release instead of packages on raspian. where you indicate to link

ln -s /data/services/vedirect00 /etc/service/vedirect00

that directory does not exist and creating it does not get the result. Is there somewhere else I need to link my vedirect00 directory to start it on Venus?

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ Mack Allison commented ·

Hi, Check with ps where svscan is looking for services.

And you could google on svscan or daemontools to learn more

0 Likes 0 ·
Mack Allison avatar image Mack Allison mvader (Victron Energy) ♦♦ commented ·

Thanks for the tip. That took me in the right direction. It's working now and svscan is managing my socat processes as well

For others; TLDR

/service in Venus

0 Likes 0 ·
fantail avatar image
fantail answered ·

If the USB adapter uses an FTDI chip then it has a unique serial number that you can use to identify the adapter and then locate its port ID. bad news is that this port ID can change between boots.

--- in terminal/putty

enter :: ls -l /dev/serial/by-id

for a list of the attached devices and their assigned IDs


You will also need to change GX serial-starter.rules file to stop victron tasks polling this port. This can cause corruption on link


The most of the above also applys on most unix systems


fantail

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.