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

How to add new device (Toradex Colibri) to allow controlling WS2811/WS2812 LED strips? #211

Open
davidgengenbach opened this issue Aug 26, 2024 · 1 comment

Comments

@davidgengenbach
Copy link

I am trying to control LED strips (WS281X) using the GPIO interface on a Colibri iMX7 (see data sheet in the attachments or the link).

As far as I understood, I would need to create GpioDeviceFactoryInterface? How would I go about that?
The Colibri device also have PWM pins if that is easier.

colibri_arm_som_imx7_datasheet.pdf

import com.diozero.devices.LED;

public class LEDTest {

  public static void main(String[] args) {
    try (LED led = new LED(1)) {
      led.on();
    }
  }
}

has the output:

WARN com.diozero.sbc.LocalSystemInfo.populateFromLsCpu - Error with lscpu command: Cannot run program "lscpu": error=2, No such file or directory
ERROR bridge.LEDTest.main - com.diozero.api.NoSuchDeviceException: No such GPIO #1
        at com.diozero.sbc.BoardPinInfo.lambda$getByGpioNumberOrThrow$0(BoardPinInfo.java:239)
        at java.base/java.util.Optional.orElseThrow(Optional.java:403)
        at com.diozero.sbc.BoardPinInfo.getByGpioNumberOrThrow(BoardPinInfo.java:239)
        at com.diozero.api.DigitalOutputDevice.<init>(DigitalOutputDevice.java:142)
        at com.diozero.api.DigitalOutputDevice.<init>(DigitalOutputDevice.java:129)
        at com.diozero.api.DigitalOutputDevice.<init>(DigitalOutputDevice.java:118)
        at com.diozero.devices.LED.<init>(LED.java:82)
        at bridge.LEDTest.main(LEDTest.java:14)

Executing:

    NativeDeviceFactoryInterface x = DeviceFactoryHelper.getNativeDeviceFactory();
    Logger.info(x.getBoardPinInfo().getGpioPins());

has the output:

INFO bridge.LEDTest.main - []
$ gpioinfo
gpiochip0 - 32 lines:
	line   0:  "SODIMM_43"         "cd"   input   active-low [used]
	line   1:  "SODIMM_45"    "Wake-Up"   input  active-high [used pull-down]
	line   2: "SODIMM_135"       unused   input  active-high
	line   3:  "SODIMM_22"       unused   input  active-high
	line   4:      unnamed        "scl"  output  active-high [used open-drain]
	line   5:      unnamed        "sda"   input  active-high [used open-drain]
	line   6:  "SODIMM_37"       unused   input  active-high
	line   7:  "SODIMM_29"       unused   input  active-high
	line   8:  "SODIMM_59"       unused   input  active-high
	line   9:  "SODIMM_28"       unused   input  active-high
	line  10:  "SODIMM_30"       unused   input  active-high
	line  11:  "SODIMM_67"       unused   input  active-high
	line  12:      unnamed       unused   input  active-high
	line  13:      unnamed       unused   input  active-high
	line  14: "SODIMM_188"       unused   input  active-high
	line  15: "SODIMM_178"       unused   input  active-high
	line  16:      unnamed       unused   input  active-high
	line  17:      unnamed       unused   input  active-high
	line  18:      unnamed       unused   input  active-high
	line  19:      unnamed       unused   input  active-high
	line  20:      unnamed       unused   input  active-high
	line  21:      unnamed       unused   input  active-high
	line  22:      unnamed       unused   input  active-high
	line  23:      unnamed       unused   input  active-high
	line  24:      unnamed       unused   input  active-high
	line  25:      unnamed       unused   input  active-high
	line  26:      unnamed       unused   input  active-high
	line  27:      unnamed       unused   input  active-high
	line  28:      unnamed       unused   input  active-high
	line  29:      unnamed       unused   input  active-high
	line  30:      unnamed       unused   input  active-high
	line  31:      unnamed       unused   input  active-high
gpiochip1 - 32 lines:
	line   0: "SODIMM_111"       unused   input  active-high
	line   1: "SODIMM_113"       unused   input  active-high
	line   2: "SODIMM_115"       unused   input  active-high
	line   3: "SODIMM_117"       unused   input  active-high
	line   4: "SODIMM_119"       unused   input  active-high
	line   5: "SODIMM_121"       unused   input  active-high
	line   6: "SODIMM_123"       unused   input  active-high
	line   7: "SODIMM_125"       unused   input  active-high
	line   8:  "SODIMM_91"       unused   input  active-high
	line   9:  "SODIMM_89"       unused   input  active-high
	line  10: "SODIMM_105"       unused   input  active-high
	line  11: "SODIMM_152"       unused   input  active-high
	line  12: "SODIMM_150"       unused   input  active-high
	line  13:  "SODIMM_95"       unused   input  active-high
	line  14: "SODIMM_126"       unused   input  active-high
	line  15: "SODIMM_107"       unused   input  active-high
	line  16: "SODIMM_114"       unused   input  active-high
	line  17: "SODIMM_116"       unused   input  active-high
	line  18: "SODIMM_118"       unused   input  active-high
	line  19: "SODIMM_120"       unused   input  active-high
	line  20: "SODIMM_122"       unused   input  active-high
	line  21: "SODIMM_124"       unused   input  active-high
	line  22: "SODIMM_127"       unused   input  active-high
	line  23: "SODIMM_130"       unused   input  active-high
	line  24: "SODIMM_132"       unused   input  active-high
	line  25: "SODIMM_134"       unused   input  active-high
	line  26: "SODIMM_133"       unused   input  active-high
	line  27: "SODIMM_104"       unused   input  active-high
	line  28: "SODIMM_106"       unused   input  active-high
	line  29: "SODIMM_110"       unused   input  active-high
	line  30: "SODIMM_112"       unused   input  active-high
	line  31: "SODIMM_128"       unused   input  active-high
gpiochip2 - 32 lines:
	line   0:  "SODIMM_56"       unused   input  active-high
	line   1:  "SODIMM_44"       unused   input  active-high
	line   2:  "SODIMM_68"       unused   input  active-high
	line   3:  "SODIMM_82"       unused   input  active-high
	line   4:  "SODIMM_93"       unused   input  active-high
	line   5:  "SODIMM_76"       unused   input  active-high
	line   6:  "SODIMM_70"       unused   input  active-high
	line   7:  "SODIMM_60"       unused   input  active-high
	line   8:  "SODIMM_58"       unused   input  active-high
	line   9:  "SODIMM_78"       unused   input  active-high
	line  10:  "SODIMM_72"       unused   input  active-high
	line  11:  "SODIMM_80"       unused   input  active-high
	line  12:  "SODIMM_46"       unused   input  active-high
	line  13:  "SODIMM_62"       unused   input  active-high
	line  14:  "SODIMM_48"       unused   input  active-high
	line  15:  "SODIMM_74"       unused   input  active-high
	line  16:  "SODIMM_50"       unused   input  active-high
	line  17:  "SODIMM_52"       unused   input  active-high
	line  18:  "SODIMM_54"       unused   input  active-high
	line  19:  "SODIMM_66"       unused   input  active-high
	line  20:  "SODIMM_64"       unused   input  active-high
	line  21:  "SODIMM_57"       unused   input  active-high
	line  22:  "SODIMM_61"       unused   input  active-high
	line  23: "SODIMM_136"       unused   input  active-high
	line  24: "SODIMM_138"       unused   input  active-high
	line  25: "SODIMM_140"       unused   input  active-high
	line  26: "SODIMM_142"       unused   input  active-high
	line  27: "SODIMM_144"       unused   input  active-high
	line  28: "SODIMM_146"       unused   input  active-high
	line  29:      unnamed       unused   input  active-high
	line  30:      unnamed       unused   input  active-high
	line  31:      unnamed       unused   input  active-high
gpiochip3 - 32 lines:
	line   0:  "SODIMM_35"       unused   input  active-high
	line   1:  "SODIMM_33"       unused   input  active-high
	line   2:  "SODIMM_38"       unused   input  active-high
	line   3:  "SODIMM_36"       unused   input  active-high
	line   4:  "SODIMM_21"       unused   input  active-high
	line   5:  "SODIMM_19"       unused   input  active-high
	line   6: "SODIMM_131"       unused   input  active-high
	line   7: "SODIMM_129" "regulator-usbh-vbus" output active-low [used]
	line   8:  "SODIMM_90"       unused   input  active-high
	line   9:  "SODIMM_92"       unused   input  active-high
	line  10:  "SODIMM_88"       unused   input  active-high
	line  11:  "SODIMM_86"   "spi2 CS0"  output   active-low [used]
	line  12:  "SODIMM_81"       unused   input  active-high
	line  13:  "SODIMM_94"       unused   input  active-high
	line  14:  "SODIMM_96"       unused   input  active-high
	line  15:  "SODIMM_75"       unused   input  active-high
	line  16: "SODIMM_101"       unused   input  active-high
	line  17: "SODIMM_103"       unused   input  active-high
	line  18:  "SODIMM_79"       unused   input  active-high
	line  19:  "SODIMM_97"       unused   input  active-high
	line  20:  "SODIMM_67"       unused   input  active-high
	line  21:  "SODIMM_59"       unused   input  active-high
	line  22:  "SODIMM_85"       unused   input  active-high
	line  23:  "SODIMM_65"       unused   input  active-high
	line  24:      unnamed       unused   input  active-high
	line  25:      unnamed       unused   input  active-high
	line  26:      unnamed       unused   input  active-high
	line  27:      unnamed       unused   input  active-high
	line  28:      unnamed       unused   input  active-high
	line  29:      unnamed       unused   input  active-high
	line  30:      unnamed       unused   input  active-high
	line  31:      unnamed       unused   input  active-high
gpiochip4 - 32 lines:
	line   0:  "SODIMM_69"       unused   input  active-high
	line   1:  "SODIMM_71"     "enable"  output  active-high [used]
	line   2:  "SODIMM_73"       unused   input  active-high
	line   3:  "SODIMM_47"       unused   input  active-high
	line   4: "SODIMM_190"       unused   input  active-high
	line   5: "SODIMM_192"       unused   input  active-high
	line   6:  "SODIMM_49"       unused   input  active-high
	line   7:  "SODIMM_51"       unused   input  active-high
	line   8:  "SODIMM_53"       unused   input  active-high
	line   9:      unnamed       unused   input  active-high
	line  10:      unnamed       unused   input  active-high
	line  11:  "SODIMM_98"       unused  output  active-high
	line  12: "SODIMM_184"       unused   input  active-high
	line  13: "SODIMM_186"       unused   input  active-high
	line  14:  "SODIMM_23"       unused   input  active-high
	line  15:  "SODIMM_31"       unused   input  active-high
	line  16: "SODIMM_100"       unused   input  active-high
	line  17: "SODIMM_102"       unused   input  active-high
	line  18:      unnamed       unused   input  active-high
	line  19:      unnamed       unused   input  active-high
	line  20:      unnamed       unused   input  active-high
	line  21:      unnamed       unused   input  active-high
	line  22:      unnamed       unused   input  active-high
	line  23:      unnamed       unused   input  active-high
	line  24:      unnamed       unused   input  active-high
	line  25:      unnamed       unused   input  active-high
	line  26:      unnamed       unused   input  active-high
	line  27:      unnamed       unused   input  active-high
	line  28:      unnamed       unused   input  active-high
	line  29:      unnamed       unused   input  active-high
	line  30:      unnamed       unused   input  active-high
	line  31:      unnamed       unused   input  active-high
gpiochip5 - 32 lines:
	line   0:      unnamed       unused   input  active-high
	line   1:      unnamed       unused   input  active-high
	line   2:      unnamed       unused   input  active-high
	line   3:      unnamed       unused   input  active-high
	line   4:      unnamed       unused   input  active-high
	line   5:      unnamed       unused   input  active-high
	line   6:      unnamed       unused   input  active-high
	line   7:      unnamed       unused   input  active-high
	line   8:      unnamed       unused   input  active-high
	line   9:      unnamed       unused   input  active-high
	line  10:      unnamed       unused   input  active-high
	line  11:      unnamed       unused  output  active-high
	line  12: "SODIMM_169"       unused   input  active-high
	line  13: "SODIMM_157"       unused   input  active-high
	line  14:      unnamed       unused   input  active-high
	line  15: "SODIMM_163"       unused   input  active-high
	line  16:  "SODIMM_77"       unused   input  active-high
	line  17:  "SODIMM_24"       unused   input  active-high
	line  18:      unnamed       unused   input  active-high
	line  19:  "SODIMM_25"       unused   input  active-high
	line  20:  "SODIMM_27"       unused   input  active-high
	line  21:  "SODIMM_32"       unused   input  active-high
	line  22:  "SODIMM_34"       unused   input  active-high
	line  23:      unnamed       unused   input  active-high
	line  24:      unnamed       unused   input  active-high
	line  25:      unnamed       unused   input  active-high
	line  26:      unnamed       unused   input  active-high
	line  27:      unnamed       unused   input  active-high
	line  28:      unnamed       unused   input  active-high
	line  29:      unnamed       unused   input  active-high
	line  30:      unnamed       unused   input  active-high
	line  31:      unnamed       unused   input  active-high
gpiochip6 - 32 lines:
	line   0:      unnamed       unused   input  active-high
	line   1:      unnamed       unused   input  active-high
	line   2:  "SODIMM_63"       unused   input  active-high
	line   3:  "SODIMM_55"       unused   input  active-high
	line   4:      unnamed       unused   input  active-high
	line   5:      unnamed       unused   input  active-high
	line   6:      unnamed       unused   input  active-high
	line   7:      unnamed       unused   input  active-high
	line   8: "SODIMM_196"        "scl"  output  active-high [used open-drain]
	line   9: "SODIMM_194"        "sda"   input  active-high [used open-drain]
	line  10:      unnamed       unused   input  active-high
	line  11:  "SODIMM_99"       unused   input  active-high
	line  12:      unnamed       unused   input  active-high
	line  13:      unnamed       unused   input  active-high
	line  14: "SODIMM_137"         "id"   input  active-high [used]
	line  15:      unnamed       unused   input  active-high
	line  16:      unnamed       unused   input  active-high
	line  17:      unnamed       unused   input  active-high
	line  18:      unnamed       unused   input  active-high
	line  19:      unnamed       unused   input  active-high
	line  20:      unnamed       unused   input  active-high
	line  21:      unnamed       unused   input  active-high
	line  22:      unnamed       unused   input  active-high
	line  23:      unnamed       unused   input  active-high
	line  24:      unnamed       unused   input  active-high
	line  25:      unnamed       unused   input  active-high
	line  26:      unnamed       unused   input  active-high
	line  27:      unnamed       unused   input  active-high
	line  28:      unnamed       unused   input  active-high
	line  29:      unnamed       unused   input  active-high
	line  30:      unnamed       unused   input  active-high
	line  31:      unnamed       unused   input  active-high

Thanks in advance!

@mattjlewis
Copy link
Owner

Can you provide further details on the operating system please. Are you able to install lscpu?

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

5 participants
@davidgengenbach @mattjlewis and others