This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USB1 VBUS sensing with MCB4357

Hello,

I need to get an IRQ when my USB device gets attached to or detached from USB host. I think I have a solution, but it does not work stably and I suspect it might have something to do with peculiarity of MCB4357 board.

* Interconnect P2_5 pad on the board (wired to VBUS pin of USB1 connector) and WAKE1 pad.
* Configure P2_5 pin for input.
* Configure EVRT to generate event on on EVRT_SRC_ACTIVE_HIGH_LEVEL on WAKE1 pin.
* When IRQ_EVRT happens, read the value on GPIO5[5] pin and depending on its value make decision whether USB host is attached or not. Also, depending on its value reconfigure EVRT to wait for HIGH or LOW level.

It almost works, except the fact that voltage on P2_5 does not really go down to zero if the device is disconnected from the host, but stays around 1.5V unless I pull it down. 22K pull-down does not help at all, 10K helps a little, the line goes down after couple seconds. If I attach a microampermeter to P2_5 to the ground I see something is leaking 20uA (this act brings the line down to 0.2V immediately and it seems to stay there even if I detach microampermeter).

I am not sure if I am allowed to use GPIO5[5] as input while USB1 is in use. I tried to connect another pin P2_6 to P2_6 and use it to read value of VUSB? I have not figured out how to read value from WAKEUP1 line. Now I am using PORTSC1_D to detect status, but I am not sure if it is correct solution. Can this cause loop if, for example, VUSB +5V is present, but USB status is not good?

Help is appreciated.

PS. I suppose I could try additionally GPIO PIN INT feature, but I need WAKEUP anyway because the device needs to wake up on RTC timer (another feature).

Best regards,
Alex