Reply
Posts: 6
Registered: ‎09-15-2015

EFM8UB1 USB functionality without VBUS

Just a quick message about a bug I noticed in the EFM8 USB library:

 

If you're making a bus-powered USB device, you shouldn't technically need to sense the VBUS voltage. This frees up the VBUS pin for use as a normal GPIO pin. Silicon Labs does a decent job of disabling the VBUS checking for bus-powered configurations, but they missed one check in the handleUsbResetInt() function:

 

 

  

static void handleUsbResetInt(void)
{
  ...
  // If VBUS is preset, put the device in the Default state.
  // Otherwise, put it in the Attached state.
#if (!(SLAB_USB_PWRSAVE_MODE & USB_PWRSAVE_MODE_ONVBUSOFF))
...

Should be: 

static void handleUsbResetInt(void)
{
  ...
  // If VBUS is preset, put the device in the Default state.
  // Otherwise, put it in the Attached state.
// If the device is bus-powered, always put it in the Default state #if (!(SLAB_USB_PWRSAVE_MODE & USB_PWRSAVE_MODE_ONVBUSOFF) && !SLAB_USB_BUS_POWERED) ...

This took me quite a bit of time to find, so I thought it might be useful for others!

Posts: 439
Registered: ‎02-21-2014

Re: EFM8UB1 USB functionality without VBUS

I forwarded this to the engineer who wrote the USB library. His response: "Good catch!". He put in an internal ticket to resolve this in a future release.

 

-Brian

Highlighted
Posts: 6
Registered: ‎08-20-2016

Re: EFM8UB1 USB functionality without VBUS

Seems I found similar bug.

 

  // If VBUS is not present on detection of a USB reset, enter suspend mode.
#if (SLAB_USB_PWRSAVE_MODE & USB_PWRSAVE_MODE_ONVBUSOFF)
if (USB_IsVbusOn() == false)
{
USB_SetSuspendIntActive(statusCommon);
}

 

Remained unnoticed by me for quiet a some time. Previously mentioned bug seem to be already fixed. USB works fine with VBUS pin being low, however if it is low during attaching USB, device is not recognized. Bug fix is exactly the same.