我有一个24FJ256GB106设置在USB设备模式的大容量存储,它是完美地结合我的PC作为主机。除了一个问题:我不能得到VBUS关闭,以便使用GPIO感测主机连接。PIC VBUS引脚保持在3.7V(VCC=3.3V),一旦USB已配置。我有PIC VBUS引脚直接连接到相应的引脚上的USB插座,与100K下拉电阻。RF3也作为我的传感器连接。清除UBTCON
tiTS。VBUSEN,U1PWCBITS.UBPWR,没有影响,也没有设置U1OTGCONBITS。VBDSDI.我需要禁用设备VBUS,而不需要随后的USB配置。如果我在USB配置上暂停,那么VBUS=0,但是如果我运行这个主机对象,在插件之后,我还尝试使用U1OTGSTATBITS。VBSVD=1作为连接的触发器,但这不起作用。我用24FJ256GB106做了一个公平的位,包括这个实际的大容量存储设置,以前没有出现过问题。
以上来自于百度翻译
以下为原文
I have a 24FJ256GB106 set up in USB device mode for mass storage and it is working perfectly in conjunction with my PC as host.
Except for one problem: I can't get Vbus to turn off in order to use GPIO sensing of host hookup. The PIC Vbus pin remains at 3.7V (Vcc=3.3V) once the USB has been configured.
I have the PIC Vbus pin connected directly to the corresponding pin on the USB socket, with a 100K pull down resistor. RF3 is also connected as my sensor.
Clearing U1OTGCONbits.VBUSON, U1PWRCbits.USBPWR, has no effect nor does setting U1OTGCONbits.VBUSDIS.
I need to disable device Vbus without subsequently requiring a USB configuration.
If I hold off on USB configuration then Vbus=0 but the host objects if I run that after plug-in.
I have also tried using U1OTGSTATbits.VBUSVD=1 as a trigger for hookup but that doesn't work.
I have done a fair bit with 24FJ256GB106 including this actual mass storage setup and haven't had the problem before.