This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I am using a custom board with AM335x (mostly cloned from BeagleBone). We use USB1 host, with a UVC-compatible USB camera always plugged.
USB1_ID is grounded, USB1_DRVVBUS connected to TPS2051 (power switch) enable signal, USB1_VBUS connected to the TPS2051 output and to the pin1 of USB A connector (usb power 5V).
The camera works fine, but we want to control (switch-on and switch-off) the USB power (for power saving). And I don't know I to do it.
We have found two problems:
I can solve the second problem doing "rmmod uvcvideo" before pluging the camera. But probably there is a better solution!!
And about the first problem, I don't have a good solution. What could I do to control USB_DRVVBUS1? (from command line, from programm, from kernel...).
I have try to change USB1_DRVVBUS pin mux to 7 (gpio) and control it manually. It removes the power from USB but there is a lot of dmesg errors (every 250ms) "hub 1-0:1.0: over-current condition on port 1".
I have try to change USB1 mode to manually device (USB1MODE=0x180), trying to override the ID pin, and hopping that this would turn-off the DRVVBUS, but it didn´t work (probably only works on boot?).
I could change the hardware layout in order to cheat the driver: with a transistor I can send 5V to USB1_VBUS when the USB1_DRVVBUS is active; an I can use any other gpio to control from my program the TPS2051 switch to send power to the USB connector. I don´t know if this would work, but there should be a simpler software solution.
Any idea? Thanks in advance,
uname -aLinux ibernexNX050x 3.2.42 #19 Mon Jun 3 19:06:27 CEST 2013 armv7l GNU/Linux
lsusbBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 001 Device 002: ID 046d:0825 Logitech, Inc.Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Alfredo Agudothe USB1_DRVVBUS is controlled from the linux driver (and I don't found any way to instruct the driver to move it).
If you look at the MUSB linux driver (drivers/usb/musb/musb_regs.h), you will find a 8-bit register called MUSB_DEVCTL, its bit0 MUSB_DEVCTL_SESSION controls USBx_DRVVBUS.
The physical address of MUSB_DEVCTL for MUSB1 is 0x47401C60, you can use devmem2 tool to play with it.
The MUSB driver in TI provided AM335x kernel already has a user-space interface in procfs (drivers/usb/musb/musb_procfs.c) to set the SESSION bit to turn on USBx_DRVVBUS, which is command 'echo F > /proc/driver/musb_hdrc.1' for MUSB1, you can use it as a reference to implement a new procfs interface to clear the SESSION bit to turn off USBx_DRVVBUS, if want your application to control the USB power.
Alfredo Agudoif I unplug and plug again the camera, the system disconnect and found the camera, but there is same dmesg errors: "[ 2037.444946] 6:3:1: cannot set freq 16000 to ep 0x86".... and when I try to use the camera another error: "uvcvideo: Failed to set UVC probe control : -110 (exp. 26)."
I do have a Logitech uvc webcam which has the 'cannot set freq...' error, even with my Linux PC (ubuntu 12.04), but it seems have no issue to use.
The '-110' enumeration error needs further debug. Have you tried other uvc cams? Do you use kernel from TI.com? what is the psp/sdk version?
Alfredo AgudoI have try to change USB1_DRVVBUS pin mux to 7 (gpio) and control it manually.
This pinmux should not be changed in runtime.
Alfredo AgudoI have try to change USB1 mode to manually device (USB1MODE=0x180), trying to override the ID pin, and hopping that this would turn-off the DRVVBUS, but it didn´t work (probably only works on boot?).
This change only take effect after clear then set the DEVCTL SESSION bit.
We are glad that we were able to resolve this issue, and will now proceed to close this thread.
If you have further questions related to this thread, you may click "Ask a related question" below. The newly created question will be automatically linked to this question.
In reply to Bin Liu:
It works perfectly: Modifying bit 0 of 8 bit register address 0x47401C60 it switch on/off USB1_DRVVBUS pin, without dmesg errors.
About the second problem ( "uvcvideo: Failed to set UVC probe control : -110 (exp. 26)" ) I am using Logitech C270 (but I still don´t know which will be the final model) and the Linux 3.2.41 from Angstrom.
I don´t know the source of the second problem, but I have found a solution: in order to revive the camera after the USB power on, instead of doing "rmmod uvcvideo; modprobe uvcvideo" I just call "v4l2-ctl --list-devices" or "v4l2-ctl -V" and then I can use the camera without problem.
I am unable control usb power with DRVVBUS at runtime, I was using above procfs command i.e echo F > /proc/driver/musb_hdrc.1 which showing below log message
root@am335x-evm:~# echo F > /proc/driver/musb_hdrc.1-sh: /proc/driver/musb_hdrc.1: No such file or directory
could you tell me how to turn off and turn on USBx_DRVVBUS.
Thanks & Regards
In reply to Srini:
Which SDK do you use?
'echo F ...' is only applicable to SDK6.0 or older. It does not exist since SDK7.0.
Hi Bin liu,
We are using sdk 8.0(kernel 3.14) In our custom board(host mode) we are trying to disable USB charging for slave devices. But we are facing an over-current issue with our board. USB controller on AM3352 processor is detecting over-current event which means the Mobile phone is trying to source more current from our board, which the board is not able to feed in. This is because of current being limited to 150mA for USB on the board. We have tried on multiple mobile phones (Samsung S4, Moto G, Sony, etc) and seeing the same issue on all of them.
we do not want charging of phones using our board !
could you tell me how disable usb controller.
Kindly do the needful as early as possible
Many Thanks in advance,
I am not sure what is your reason of limiting the VBUS current to 150mA, but this violates the USB2.0 Spec. The USB2.0 host should provided minimum 500mA.
Another issue is that even if you could disable the USB controller in your use case, then what is the point to connect the phone to your board via USB?
Sriniactually our usb switch current limit is 150mA
As I said before, this design violates the USB2.0 Specs.
Srinihow to stop charging devices from the USB otg port
I don't think there is any way to achieve this.
Srinibecause Mobile USB devices require more power than it is permitted by the specifications for a single port.
How much is the current? If it is not more than 500mA from the AM335x USB port, the mobile device still complies with the USB Spec.
In reply to peaves:
Hi paul & Bin,
Thanks for yours response,
Problem: over current detection.
I am using sdk 8.0 and kernel 3.14, In usb otg when I plugin any device to board after that the USB OTG controller begins a host session the DRVVBUS output is driven high to enable a VBUS power switch. The OTG controller is monitoring the VBUS voltage after a host session.
how to determine if there is an over-current condition on VBUS line in driver level.
Please find the below details.
Usb power switch max current is150mA
Schematic: BBB reff
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.