Jump to content
Thinh Nguyen

Control USB 3.0 VBus by software.

Recommended Posts

I have a Tinker board 2S and I would like to control USB 3.0 VBUS to turn on/off devices that connected to USB port. Does this board support controlling USB Power?

I also look at schemtic, please look at the picture below (Attached)

image.png

Can USB3_EN be control by software?

 

Share this post


Link to post
Share on other sites

Hello,

I've come across this thread and realized that the original question hasn't been answered yet.
I am also interested in this topic, and I'm wondering if anyone could provide some insights or experiences related to this.

Thank you in advance for any help you can provide.

Share this post


Link to post
Share on other sites

hello @nishi and @Thinh Nguyen

you can control the vbus power through echo commands

1. check the kernel version with command: 

uname -a

keep in mind that if you're using a usb keyboard, the power will be off immediately after you execute the echo off command. if you wish to turn it back on without reboot, please: 1. use a type c keyboard, or 2. connect tinker board to a pc with a ttys dongle so the commands can be executed from the putty console

here are the commands to control the vbus power:

linux4.4 debian10 (v.2.0.20 2023/07/13 and later):

TypeA port:

echo on > /sys/kernel/debug/fe900000.dwc3/vbus
echo off > /sys/kernel/debug/fe900000.dwc3/vbus

TypeC port:

echo on > /sys/kernel/debug/fe800000.dwc3/vbus
echo off > /sys/kernel/debug/fe800000.dwc3/vbus

 

linux4.19 debian10 (v.2.1.16 2023/07/14 and later):

TypeA port:

echo on > /sys/kernel/debug/fe900000.dwc3/vbus
echo off > /sys/kernel/debug/fe900000.dwc3/vbus

TypeC port (for cc chip fusb302):

echo on > /sys/kernel/debug/fe800000.dwc3/vbus
echo off > /sys/kernel/debug/fe800000.dwc3/vbus

TypeC port (for cc chip rt1715):

echo sink >/sys/class/typec/port0/port_type
echo dual >/sys/class/typec/port0/port_type

 

linux5.10 debian11 (v.3.0.6  2023/07/31 and later):

typeA port:

echo on > /sys/kernel/debug/usb/fe900000.usb/hub_vbus
echo off > /sys/kernel/debug/usb/fe900000.usb/hub_vbus

TypeC port (both fusb302 & rt1715 use the same commands):

echo sink >/sys/class/typec/port0/port_type
echo dual >/sys/class/typec/port0/port_type

 

android12 (v.3.0.2 2023/07/13 and later):

typeA port:

echo on > /sys/kernel/debug/fe900000.dwc3/hub_vbus
echo off > /sys/kernel/debug/fe900000.dwc3/hub_vbus

typeC port (for cc chip fusb302):

echo on > /sys/kernel/debug/fe800000.dwc3/hub_vbus
echo off > /sys/kernel/debug/fe800000.dwc3/hub_vbus

TypeC port (for cc chip rt1715):

echo sink >/sys/class/typec/port0/port_type
echo dual >/sys/class/typec/port0/port_type

 

Edited by tooz
updated supported versions (with dates)
  • Thanks 1

Share this post


Link to post
Share on other sites

@tooz

Hello. I followed your instruction about usb-c.

I use "linux4.4 debian10".

echo on > /sys/kernel/debug/fe800000.dwc3/vbus
echo off > /sys/kernel/debug/fe800000.dwc3/vbus

The result is 

-bash: /sys/kernel/debug/fe800000.dwc3/vbus: Permission denied

I cannot find vbus as follows.

~# ls /sys/kernel/debug/fe800000.dwc3/
ep0in   ep1in   ep2in   ep3in   ep4in   ep5in   ep6in       mode     testmode
ep0out  ep1out  ep2out  ep3out  ep4out  ep5out  link_state  regdump

I would be grateful if you could help me.

Share this post


Link to post
Share on other sites

hello @sonyan11

33 minutes ago, sonyan11 said:

~# ls /sys/kernel/debug/fe800000.dwc3/ ep0in ep1in ep2in ep3in ep4in ep5in ep6in mode testmode ep0out ep1out ep2out ep3out ep4out ep5out link_state regdump

what's the image version you're using? if it's not on the list then the function might not have been added -- my bad. i have updated my previous post with versions that support usb vbus control. for debian 10 kernel 4.4, please use v.2.0.20 or later 

  • Thanks 1

Share this post


Link to post
Share on other sites

Dear @tooz

Thank you so much, I have updated kenel and have successfully control the vbus.

I am super happy to get this result. I deeply appreciate your contribution to this forum.

Best regards,

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...