Change OTG port to Host

With more recent kernels there is a limitation for the number of devices that can be detected by the inbuilt USB hubs on the AM335x.

If more than 10 devices are required to be connected the second USB hub needs to be utilized.

Changing the OTG port to Host mode allows another 10 devices to be connected giving a total of 20 devices.


To change the mode of the port there needs to be a hardware modification performed and a configuration modification.


Hardware Modification

To force the USB port into device mode the option resistor needs to be fitted:

Place a 0 Ohm 0402 resistor at location R2100 (highlighted below)

To allow for 5V to be supplied to the USB port it needs to be connected to the appropriate pins on the 46 way connectors:

Provide power at pins 5/6 (5V) and ground at pins 1/2 on SK7001


Configuration Modification

Login to the bbe via the serial terminal.

make sure you are in your home directory where you can do the editing and compiling of the device tree.

#cd ~

First you need to reverse compile the binary device tree back into an editable form

#dtc -I dtb -O dts -o ./am335x-sancloud-bbe.dts /boot/dtbs/4.4.54-ti-r93/am335x-sancloud-bbe.dtb

Then edit the file (I’m using vi…. why I hear you scream… because I can!!).  You can use an editor of your choice, just make sure you change the correct line.

#vi am335x-sancloud-bbe.dts

Search for peripheral (non vi-ers   /peripheral  ENTER_KEY)

Should be around line 1869 (8.7-iot image)

usb@47401000 {
      compatible = "ti,musb-am33xx";
      status = "okay";
      reg = <0x47401400 0x400 0x47401000 0x200>;
      reg-names = "mc", "control";
      interrupts = <0x12>;
      interrupt-names = "mc";
      dr_mode = "peripheral";
      mentor,multipoint = <0x1>;
      mentor,num-eps = <0x10>;
      mentor,ram-bits = <0xc>;
      mentor,power = <0x1f4>;
      phys = <0x3f>;

change to host

      dr_mode = "host";

Save (non vi-ers  Esc :wq ENTER_KEY)

Next compile the new dts file

#dtc –I dts –O dtb –o ./am335x-sancloud-bbe.dtb ./am335x-sancloud-bbe.dts

Would be wise to backup the original dtb file

#sudo mv /boot/dtbs/4.4.54-ti-r93/am335x-sancloud-bbe.dtb /boot/dtbs/4.4.54-ti-r93/am335x-sancloud-bbe.dtb.orig

Then you can copy the newly compiled dtb over ready for boot

#sudo cp ./am335x-sancloud-bbe.dtb /boot/dtbs/4.4.54-ti-r93/

To be save flush file buffers to make sure your changes have gone to SD/eMMC


Now reboot and when you perform an lsusb you should see 2 hubs:

debian@beaglebone:~$ lsusb
Bus 002 Device 003: ID 0bda:b720 Realtek Semiconductor Corp.
Bus 002 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub