0
arjepsen

using the usb-otg only as usb port

Recommended Posts

Hey.

I'm trying to install octoprint on my Opi Zero +2, using the latest armbian image I found here on the site.

Installation works fine, and I get the web interface up and running no problem.

But I have connected power to the board on the gpio pins, and want to use the mini-usb to connect to the 3d printer.

I have enabled usbhost0-3 in the hardware in armbian-config, but still it seems the printer cannot be reached.

I read some older posts regarding other boards, where the solution seemed to be recompiling. Is this a necessity, and if so, could someone please point me to a walkthrough?

 

Regards

Anders

Share this post


Link to post
Share on other sites

lsusb gives:


Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 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 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

and dmesg:

 


[    0.000000] Kernel command line: root=UUID=289bd460-9951-431f-bf37-6007ea923b14 rootwait rootfstype=ext4 console=ttyS0,115200 console=tty1 panic=10 consoleblank=0 loglevel=1 ubootpart= usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u   cgroup_enable=memory swapaccount=1
[    1.283924] usbcore: registered new interface driver usbfs
[    1.283961] usbcore: registered new interface driver hub
[    1.284015] usbcore: registered new device driver usb
[    2.408662] ehci-platform 1c1a000.usb: EHCI Host Controller
[    2.408685] ehci-platform 1c1a000.usb: new USB bus registered, assigned bus number 1
[    2.409219] ehci-platform 1c1a000.usb: irq 11, io mem 0x01c1a000
[    2.421479] ehci-platform 1c1a000.usb: USB 2.0 started, EHCI 1.00
[    2.421715] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[    2.421722] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.421728] usb usb1: Product: EHCI Host Controller
[    2.421734] usb usb1: Manufacturer: Linux 4.19.17-sunxi64 ehci_hcd
[    2.421739] usb usb1: SerialNumber: 1c1a000.usb
[    2.422737] ehci-platform 1c1b000.usb: EHCI Host Controller
[    2.422755] ehci-platform 1c1b000.usb: new USB bus registered, assigned bus number 2
[    2.423243] ehci-platform 1c1b000.usb: irq 13, io mem 0x01c1b000
[    2.437485] ehci-platform 1c1b000.usb: USB 2.0 started, EHCI 1.00
[    2.437675] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[    2.437682] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.437688] usb usb2: Product: EHCI Host Controller
[    2.437693] usb usb2: Manufacturer: Linux 4.19.17-sunxi64 ehci_hcd
[    2.437698] usb usb2: SerialNumber: 1c1b000.usb
[    2.438615] ehci-platform 1c1c000.usb: EHCI Host Controller
[    2.438633] ehci-platform 1c1c000.usb: new USB bus registered, assigned bus number 3
[    2.439082] ehci-platform 1c1c000.usb: irq 15, io mem 0x01c1c000
[    2.453484] ehci-platform 1c1c000.usb: USB 2.0 started, EHCI 1.00
[    2.453665] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[    2.453672] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.453677] usb usb3: Product: EHCI Host Controller
[    2.453683] usb usb3: Manufacturer: Linux 4.19.17-sunxi64 ehci_hcd
[    2.453688] usb usb3: SerialNumber: 1c1c000.usb
[    2.454566] ehci-platform 1c1d000.usb: EHCI Host Controller
[    2.454583] ehci-platform 1c1d000.usb: new USB bus registered, assigned bus number 4
[    2.455038] ehci-platform 1c1d000.usb: irq 17, io mem 0x01c1d000
[    2.469474] ehci-platform 1c1d000.usb: USB 2.0 started, EHCI 1.00
[    2.469655] usb usb4: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[    2.469662] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.469667] usb usb4: Product: EHCI Host Controller
[    2.469672] usb usb4: Manufacturer: Linux 4.19.17-sunxi64 ehci_hcd
[    2.469677] usb usb4: SerialNumber: 1c1d000.usb
[    2.470775] ohci-platform 1c1a400.usb: Generic Platform OHCI controller
[    2.470798] ohci-platform 1c1a400.usb: new USB bus registered, assigned bus number 5
[    2.471052] ohci-platform 1c1a400.usb: irq 12, io mem 0x01c1a400
[    2.533722] usb usb5: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 4.19
[    2.533729] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.533735] usb usb5: Product: Generic Platform OHCI controller
[    2.533741] usb usb5: Manufacturer: Linux 4.19.17-sunxi64 ohci_hcd
[    2.533746] usb usb5: SerialNumber: 1c1a400.usb
[    2.534673] ohci-platform 1c1b400.usb: Generic Platform OHCI controller
[    2.534696] ohci-platform 1c1b400.usb: new USB bus registered, assigned bus number 6
[    2.534972] ohci-platform 1c1b400.usb: irq 14, io mem 0x01c1b400
[    2.597725] usb usb6: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 4.19
[    2.597732] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.597738] usb usb6: Product: Generic Platform OHCI controller
[    2.597743] usb usb6: Manufacturer: Linux 4.19.17-sunxi64 ohci_hcd
[    2.597748] usb usb6: SerialNumber: 1c1b400.usb
[    2.598651] ohci-platform 1c1c400.usb: Generic Platform OHCI controller
[    2.598669] ohci-platform 1c1c400.usb: new USB bus registered, assigned bus number 7
[    2.598948] ohci-platform 1c1c400.usb: irq 16, io mem 0x01c1c400
[    2.661728] usb usb7: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 4.19
[    2.661736] usb usb7: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.661741] usb usb7: Product: Generic Platform OHCI controller
[    2.661747] usb usb7: Manufacturer: Linux 4.19.17-sunxi64 ohci_hcd
[    2.661752] usb usb7: SerialNumber: 1c1c400.usb
[    2.662633] ohci-platform 1c1d400.usb: Generic Platform OHCI controller
[    2.662650] ohci-platform 1c1d400.usb: new USB bus registered, assigned bus number 8
[    2.662914] ohci-platform 1c1d400.usb: irq 18, io mem 0x01c1d400
[    2.725722] usb usb8: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 4.19
[    2.725729] usb usb8: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.725735] usb usb8: Product: Generic Platform OHCI controller
[    2.725740] usb usb8: Manufacturer: Linux 4.19.17-sunxi64 ohci_hcd
[    2.725745] usb usb8: SerialNumber: 1c1d400.usb
[    2.727096] usbcore: registered new interface driver usb-storage
[    2.731595] usbcore: registered new interface driver usbhid
[    2.731597] usbhid: USB HID core driver

 

Share this post


Link to post
Share on other sites

Can you "unplug/plug" your USB device and redo "dmesg | grep usb" again ?

Did you provide "+5V" to your USB connectors or did you use an already built hat/piggyback board ?

 

Share this post


Link to post
Share on other sites

I've soldered two wires to pin-hole 2 and 4 on the expansion port. 5v is supplied from an ATX pc psu.

 

Heres the dmesg command after unplugging/plugging:

 


[    0.000000] Kernel command line: root=UUID=289bd460-9951-431f-bf37-6007ea923b14 rootwait rootfstype=ext4 console=ttyS0,115200 console=tty1 panic=10 consoleblank=0 loglevel=1 ubootpart= usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u   cgroup_enable=memory swapaccount=1
[    1.283959] usbcore: registered new interface driver usbfs
[    1.283996] usbcore: registered new interface driver hub
[    1.284051] usbcore: registered new device driver usb
[    2.408156] ehci-platform 1c1a000.usb: EHCI Host Controller
[    2.408178] ehci-platform 1c1a000.usb: new USB bus registered, assigned bus number 1
[    2.408713] ehci-platform 1c1a000.usb: irq 11, io mem 0x01c1a000
[    2.421513] ehci-platform 1c1a000.usb: USB 2.0 started, EHCI 1.00
[    2.421741] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[    2.421748] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.421754] usb usb1: Product: EHCI Host Controller
[    2.421760] usb usb1: Manufacturer: Linux 4.19.17-sunxi64 ehci_hcd
[    2.421765] usb usb1: SerialNumber: 1c1a000.usb
[    2.422793] ehci-platform 1c1b000.usb: EHCI Host Controller
[    2.422816] ehci-platform 1c1b000.usb: new USB bus registered, assigned bus number 2
[    2.423299] ehci-platform 1c1b000.usb: irq 13, io mem 0x01c1b000
[    2.437518] ehci-platform 1c1b000.usb: USB 2.0 started, EHCI 1.00
[    2.437719] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[    2.437726] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.437732] usb usb2: Product: EHCI Host Controller
[    2.437737] usb usb2: Manufacturer: Linux 4.19.17-sunxi64 ehci_hcd
[    2.437742] usb usb2: SerialNumber: 1c1b000.usb
[    2.438659] ehci-platform 1c1c000.usb: EHCI Host Controller
[    2.438677] ehci-platform 1c1c000.usb: new USB bus registered, assigned bus number 3
[    2.439143] ehci-platform 1c1c000.usb: irq 15, io mem 0x01c1c000
[    2.453507] ehci-platform 1c1c000.usb: USB 2.0 started, EHCI 1.00
[    2.453690] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[    2.453697] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.453703] usb usb3: Product: EHCI Host Controller
[    2.453708] usb usb3: Manufacturer: Linux 4.19.17-sunxi64 ehci_hcd
[    2.453713] usb usb3: SerialNumber: 1c1c000.usb
[    2.454591] ehci-platform 1c1d000.usb: EHCI Host Controller
[    2.454608] ehci-platform 1c1d000.usb: new USB bus registered, assigned bus number 4
[    2.455053] ehci-platform 1c1d000.usb: irq 17, io mem 0x01c1d000
[    2.469518] ehci-platform 1c1d000.usb: USB 2.0 started, EHCI 1.00
[    2.469691] usb usb4: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[    2.469698] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.469704] usb usb4: Product: EHCI Host Controller
[    2.469709] usb usb4: Manufacturer: Linux 4.19.17-sunxi64 ehci_hcd
[    2.469714] usb usb4: SerialNumber: 1c1d000.usb
[    2.470809] ohci-platform 1c1a400.usb: Generic Platform OHCI controller
[    2.470827] ohci-platform 1c1a400.usb: new USB bus registered, assigned bus number 5
[    2.471093] ohci-platform 1c1a400.usb: irq 12, io mem 0x01c1a400
[    2.533695] usb usb5: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 4.19
[    2.533702] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.533707] usb usb5: Product: Generic Platform OHCI controller
[    2.533713] usb usb5: Manufacturer: Linux 4.19.17-sunxi64 ohci_hcd
[    2.533718] usb usb5: SerialNumber: 1c1a400.usb
[    2.534651] ohci-platform 1c1b400.usb: Generic Platform OHCI controller
[    2.534668] ohci-platform 1c1b400.usb: new USB bus registered, assigned bus number 6
[    2.534966] ohci-platform 1c1b400.usb: irq 14, io mem 0x01c1b400
[    2.597847] usb usb6: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 4.19
[    2.597854] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.597859] usb usb6: Product: Generic Platform OHCI controller
[    2.597865] usb usb6: Manufacturer: Linux 4.19.17-sunxi64 ohci_hcd
[    2.597870] usb usb6: SerialNumber: 1c1b400.usb
[    2.598776] ohci-platform 1c1c400.usb: Generic Platform OHCI controller
[    2.598794] ohci-platform 1c1c400.usb: new USB bus registered, assigned bus number 7
[    2.599072] ohci-platform 1c1c400.usb: irq 16, io mem 0x01c1c400
[    2.661858] usb usb7: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 4.19
[    2.661865] usb usb7: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.661871] usb usb7: Product: Generic Platform OHCI controller
[    2.661876] usb usb7: Manufacturer: Linux 4.19.17-sunxi64 ohci_hcd
[    2.661882] usb usb7: SerialNumber: 1c1c400.usb
[    2.662776] ohci-platform 1c1d400.usb: Generic Platform OHCI controller
[    2.662793] ohci-platform 1c1d400.usb: new USB bus registered, assigned bus number 8
[    2.663069] ohci-platform 1c1d400.usb: irq 18, io mem 0x01c1d400
[    2.725845] usb usb8: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 4.19
[    2.725852] usb usb8: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.725858] usb usb8: Product: Generic Platform OHCI controller
[    2.725863] usb usb8: Manufacturer: Linux 4.19.17-sunxi64 ohci_hcd
[    2.725869] usb usb8: SerialNumber: 1c1d400.usb
[    2.727225] usbcore: registered new interface driver usb-storage
[    2.731090] usbcore: registered new interface driver usbhid
[    2.731092] usbhid: USB HID core driver

 

Share this post


Link to post
Share on other sites
9 minutes ago, arjepsen said:

I've soldered two wires to pin-hole 2 and 4 on the expansion port.

What is this expansion board ? Do you have schematics ?

10 minutes ago, arjepsen said:

Heres the dmesg command after unplugging/plugging:

We don't see any unplug/plug activity in this log ...

Share this post


Link to post
Share on other sites

no - only pin 2 and 4. Should pin 3 also be connected? If so - why? As far as I can tell, it's function is listed as: TWI0_SDA / PA12 / GPIO12

Pin 2 is connected to 5v, and pin 4 to ground - both on the atx supply. According to the link I posted, pin 4 (among others) are ground on the Opi.

Since I've been able to boot, and install armbian, having it powered like this, I assume the power is connected correctly?

Share this post


Link to post
Share on other sites
18 hours ago, arjepsen said:

no - only pin 2 and 4. Should pin 3 also be connected?

According to pinout provided in the link :

1 	5V
2 	GND
3 	USB-DM2
4 	USB-DP2
5 	USB-DM3
6 	USB-DP3 

So, GND on pin 2 should be connected to GND of ATX, and your USB connector should use USB-DM2/USB-DP2 ...

Share this post


Link to post
Share on other sites

I'm sorry - I've probably been too vague in describing what I'm aiming for.

You're refering to the 1x13 header. I've connected power to the 2x13 header.

But my problem is:

I want to use the small micro-usb port that for the printer. The port that I would otherwise normally use for powering the board.

That's the reason I've connected power to the pins of the 2x13 header.

But I can't seem to get that port to work as a regular usb host.

Share this post


Link to post
Share on other sites
45 minutes ago, arjepsen said:

I've connected power to the 2x13 header.

... but there is no USB port on this one ...

46 minutes ago, arjepsen said:

I want to use the small micro-usb port that for the printer.

In this case , you absolutely needs to have USB node in DT with : dr_mode = "host";

Using 1x13 header could be use easily with adaptors like :

https://www.ebay.ca/itm/10PCS-USB-Female-Port-Connector-Breakout-Board-Power-2-54mm-Header-for-Arduino/132482993278

 

Share this post


Link to post
Share on other sites
18 hours ago, martinayotte said:

In this case , you absolutely needs to have USB node in DT with : dr_mode = "host";

 

Ok. Could you give some details on how to get this done?

Share this post


Link to post
Share on other sites
44 minutes ago, arjepsen said:

Ok. Could you give some details on how to get this done?

First, install DeviceTree compiler :

wget http://ftp.debian.org/debian/pool/main/d/device-tree-compiler/device-tree-compiler_1.4.7-3_arm64.deb
dpkg -i device-tree-compiler_1.4.7-3_arm64.deb

Second, de-compile the main DT of OPiZeroPlus2-H5 :

dtc -@ -I dtb -O dts -o sun50i-h5-orangepi-zero-plus2.dts-NEW /boot/dtb/allwinner/sun50i-h5-orangepi-zero-plus2.dtb

Edit the sun50i-h5-orangepi-zero-plus2.dts-NEW file, locate the node "usb@1c19000", and add the property ' dr_mode = "host"; ' into it, and change "status" to "okay". Then, recompile it after having done a backup :

mv /boot/dtb/allwinner/sun50i-h5-orangepi-zero-plus2.dtb /boot/dtb/allwinner/sun50i-h5-orangepi-zero-plus2.dtb-ORIG
dtc -@ -I dts -O dtb -o /boot/dtb/allwinner/sun50i-h5-orangepi-zero-plus2.dtb sun50i-h5-orangepi-zero-plus2.dts-NEW

Then, do a "sync" followed by "reboot" ...

 

I wasn't able to test complete recipe, since my USB-OTG cable is taking the 5V from the board, but it is not present when PSU is attached to header pins 4/6 .

 

Share this post


Link to post
Share on other sites

This is also my procedure that I have to go through every time there is a kernel upgrade. Really wish that either

  • armbian-config would point out the fact that setting "host mode" here may or may not be effective, and the dtc trickery is necessary for OTG ports

or (better)

  • armbian-config would offer to do the patching of the dtb when the OTG port is changed to "host mode"

or (best)

  • there was a way for custom dtb settings to automatically "survive" a kernel upgrade

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0