Hello.
I use ti-processor-sdk-linux-am335x-evm-01.00.00.03 in the BBB.
I use g_printer device mode.
I want to check of USB Cable Connect.
How do I ?
Help !
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.
Hello.
I use ti-processor-sdk-linux-am335x-evm-01.00.00.03 in the BBB.
I use g_printer device mode.
I want to check of USB Cable Connect.
How do I ?
Help !
There is no direct report of the cable connect status from the kernel, but I think you use the following sysfs entry, which reports the otg state.
/sys/bus/platform/devices/musb-hdrc.0.auto/mode
Hi, Bin.
VBUS is work correctly on my board.
But, /sys/bus/platform/devices/musb-hdrc.0.auto/mode is not operating correctly.
b_periphera ---> No Change.
Current Status.
HUB IC CY7C65642 is in my PCB
PC ------------------- UpStream HUB DownStream#1 ------------------- AM3358, USB0 ( g_printer driver )
DownStream#2 -------------------- Reserved ( Open )
DownStream#3 -------------------- Reserved ( Open )
DownStream#4 -------------------- Reserved ( Open )
How I do ?
Help ?
hoyoun lyu said:But, /sys/bus/platform/devices/musb-hdrc.0.auto/mode is not operating correctly.
b_periphera ---> No Change.
Current Status.
HUB IC CY7C65642 is in my PCB
PC ------------------- UpStream HUB DownStream#1 ------------------- AM3358, USB0 ( g_printer driver )
I am able to replicate this using an external hub, the sysfs mode does not change when disconnect the hub from the PC.
This seems like a sw bug, but I am not sure when it will be fixed, since the issue is minor. no usb function is affected. To get your project moving forward, I recommend a couple alternatives.
1. modify musb driver to export bit3,4 of usb0_devctl register to userspace, bit3,4=0h means vbus is off, while bit3,4=11b means vbus on.
2. use discrete circuit to detect vbus line on the hub upstream port using GPIO.
hoyoun lyu said:I think that USB cable connect status is appear DRVVBUS bit of USB0STAT register.
No, USB0STAT register and DRVVBUS are irrelevant to device mode, which is what you use.
Bin Liu said:I am able to replicate this using an external hub, the sysfs mode does not change when disconnect the hub from the PC.
This seems like a sw bug, but I am not sure when it will be fixed, since the issue is minor. no usb function is affected.
Here is the explanation of the behavior - AM335x USB controller, while working in peripheral mode, relies on VBUS voltage to detect the disconnect event. So if the hub turns off VBUS of the downstream port when disconnected from the PC, AM335x USB will move to b_idle state as expected. But if the hub keeps VBUS of the downstream port on while disconnected from the PC, AM335x USB controller will not generate the disconnect event, then the Linux driver is unable to change the state to b_idle.
So this isn't a sw bug. You just have to ensure that the hw turns off the hub downstream port VBUS if VBUS of the hub upstream port is gone.