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

Add I/O extender support to Venus #1412

Open
10 tasks
dirkjanfaber opened this issue Jan 14, 2025 · 2 comments
Open
10 tasks

Add I/O extender support to Venus #1412

dirkjanfaber opened this issue Jan 14, 2025 · 2 comments
Assignees

Comments

@dirkjanfaber
Copy link
Collaborator

dirkjanfaber commented Jan 14, 2025

This issue is about adding support for the I/O extender (and other switching devices).

When plugged in the GX, the device adds digital inputs as we are used to, (under com.victronenergy.digital_input etc) because it is an USB device. The device does contain an eeprom, so we know the serial (see dmesg output below).

More complex devices end up under com.victronenergy.switch.iox_$serial, and perhaps some of the configuration of the io extender will be placed there too. E.g. the state of the dipswitches.

Affected repositories (needs to be checked, possibly not altered):

  • systemcalc ibu / rvz
  • node-red-contrib-victron dfa
  • venus-platform rvz
  • gui jho
  • gui-v2 rvz
  • dbus_modbus_tcp dfa
  • vecan-dbus mbo
  • dbus-generator (running state, digital input) rvz
  • VRM - For switching the relays (and digital io?) dfa
  • HTML5 app mma
[511157.709507] usb 6-1: new full-speed USB device number 3 using ohci-platform
[511157.992646] usb 6-1: New USB device found, idVendor=10c4, idProduct=ea90, bcdDevice= 0.00
[511158.001143] usb 6-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[511158.008408] usb 6-1: Product: GX IO-Extender 150
[511158.013229] usb 6-1: Manufacturer: Victron Energy BV
[511158.018430] usb 6-1: SerialNumber: HQ24200AFFE
[511158.032731] cp2112 0003:10C4:EA90.0002: hidraw0: USB HID v1.01 Device [Victron Energy BV GX IO-Extender 150] on usb-1c1d400.usb-1/input0
[511158.120561] cp2112 0003:10C4:EA90.0002: Part Number: 0x0C Device Version: 0x03
ReinvdZee added a commit to victronenergy/gui-v2 that referenced this issue Jan 22, 2025
Instead of deriving the input number from the path.
To support the digital inputs of the IO extender.

victronenergy/venus#1412
@ReinvdZee
Copy link
Collaborator

On Venus OS 3.60~17, the IO extender is recognized properly. The inputs will be picked up by dbus-digitalinputs. The GUI used to show the digital inputs by deriving the input number from the path com.victronenergy.settings/Settings/DigitalInput/<n>/ to show it as "Digital Input ". This only accepted integers. I changed the GUI to show the input label instead: com.victronenergy.digitalinputs/Devices/x/Label, like the GUI does for analog inputs.

Now, the digital inputs are automatically picked up and shown as:

Image

ReinvdZee added a commit to victronenergy/gui-v2 that referenced this issue Jan 31, 2025
Instead of deriving the input number from the path.
To support the digital inputs of the IO extender.

victronenergy/venus#1412
ReinvdZee added a commit to victronenergy/gui-v2 that referenced this issue Feb 6, 2025
Instead of deriving the input number from the path.
To support the digital inputs of the IO extender.

victronenergy/venus#1412
ReinvdZee added a commit to victronenergy/meta-victronenergy that referenced this issue Feb 17, 2025
Add udev rules for PCA963x
Create symlinks in the temp dir

victronenergy/venus#1412
@ReinvdZee
Copy link
Collaborator

I added PWM support for the IO extender. To support hotplugging the PCA9632 chip (PWM driver in the io extender), I patched the driver such that it uses a default configuration when there are no device-tree nodes found. Which will be the case, since it is loaded with udev which can't pass any devicetree nodes.

I also modified the udev rules and the ioextender script such that the pwm channels show up in /var/run/io-ext/<SN>/pwm<x>. Write 0-255 to /pwm<x> to control the duty-cycle of the PWM output.

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

4 participants