USB Current Consumption Remains after De-Init

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB Current Consumption Remains after De-Init

177 Views
Rudy25
Contributor I
Hi all, good day!
 
We have a custom board that based on EVK1062 demo board. Our source code is based on SDK version 2.13.2.
 
I measured the current consumption at 3.3V rail when USB is initialized, up and running versus
when USB is not initialized and not running at all.
I can see about 8mA increase when USB is up and running which is pretty much normal since USB peripheral/clock is initialized. 
 
During normal operation, we basically don't need USB. We only need it if we wanted to do firmware update or perform diagnostic check. So, by default USB is not initialize and will only initialize it when
it is connected. And then, when USB is disconnected, we de-initialize it.
 
The de-initialization, I've done it in a way that reversing the initialization steps.
I was surprise because after de-init the USB, the current that I was reading was still the same as when the USB is up and running.
Why is that? Can you please have a look below code snapshot? And please tell me if I forgot something or did something wrong.
 
Thank you very much.
 
 
Code snapshot for USB init:
  USB_DeviceClockInit();
#if (defined(FSL_FEATURE_SOC_SYSMPU_COUNT) && (FSL_FEATURE_SOC_SYSMPU_COUNT > 0U))
  SYSMPU_Enable(SYSMPU, 0);
#endif /* FSL_FEATURE_SOC_SYSMPU_COUNT */
 
  s_cdcVcom.speed = USB_SPEED_FULL;
  s_cdcVcom.attach = 0;
  s_cdcVcom.deviceHandle = NULL;
 
  if (kStatus_USB_Success != USB_DeviceInit(CONTROLLER_ID, USB_DeviceCallback, &s_cdcVcom.deviceHandle))
    {
      return;
    }
 
  USB_DeviceIsrEnable();
 
  /*Add one delay here to make the DP pull down long enough to allow host to detect the previous disconnection.*/
  SDK_DelayAtLeastUs(5000, BOARD_BOOTCLOCKRUN_CORE_CLOCK);
  USB_DeviceRun(s_cdcVcom.deviceHandle);    
  
  
  
Code snapshot for USB de-init:  
  uint32_t i_sr;
  uint8_t irqNumber;
 
  uint8_t usbDeviceEhciIrq[] = USBHS_IRQS;
  irqNumber                  = usbDeviceEhciIrq[CONTROLLER_ID - kUSB_ControllerEhci0];  
  
  vf_enter_critical(&i_sr); 
    
  /* Stop the USB Device */
  if(kStatus_USB_Success != USB_DeviceStop(s_cdcVcom.deviceHandle))
    {
      __asm("nop");
    }
  
  /* Disable the interrupt */
  DisableIRQ((IRQn_Type)irqNumber); 
  
  s_cdcVcom.attach = 0;
  s_cdcVcom.startTransactions = 0;
    
  /* De-init the USB */
  if(kStatus_USB_Success != USB_DeviceDeinit(s_cdcVcom.deviceHandle))
    {
      __asm("nop");
    }
  
  if(kUSB_ControllerEhci0 == CONTROLLER_ID)
    {
      /* disable the USB pll clock */
      CLOCK_DisableUsbhs0PhyPllClock();
    }
  USB_EhciPhyDeinit(CONTROLLER_ID);
 
  vf_exit_critical(i_sr);
0 Kudos
5 Replies

147 Views
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

Hi,

 

I understand this query is power consumption related, but is the application itself working correctly?

Is there any change in the power consumption before initializing the USB for the first time?

 

Regards,

Daniel.

0 Kudos

138 Views
Rudy25
Contributor I

Hello Daniel,

The application is working fine, no problem at all. Our project is running with limited power budget, so every juice counts. Really appreciate if you can help me to point out the possible reasons to why the usb power remains even after de-init.

I did not observe any change in power consumption before usb is initialize. Since usb is not running by default, I can clearly see the jump in current when usb is connected and initialized.

Thank you.

 

0 Kudos

125 Views
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

Please take a look to these articles that might be useful for you.

AN12245 and Data Sheet.

 

Have you tried any low power mode yet? For instance, instead of de-initializing the USB, you could try to set a Low Power Suspend Mode. Please take look to Chapter 42 of the reference manual.

 

I hope this helps,

Daniel.

0 Kudos

103 Views
Rudy25
Contributor I

Hi Daniel,

I haven't tried to set the usb to low power or suspend mode.

If our core is running at full-speed and no plan to change its state, is it possible to set the usb only to low power or suspend mode? If yes, do you have a reference project that I can use (probably sample project available in SDK)?

Thank you.

0 Kudos

82 Views
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

Probably some of the suspend-resume SDK examples might be useful.

For instance, dev_suspend_resume_hid_mouse_bm.

 

I hope this helps,

Daniel.

0 Kudos