i.MX6: USB charge current

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

i.MX6: USB charge current

Jump to solution
3,663 Views
danielmattsson
Contributor I

Hi,


We have a custom board with i.MX6DualLite running android which seems to work well. We are having problems finding out how much current we are allowed to draw from the USB port during USB charging.  We plan to use an external circuit for the actual charging, but the device driver for the charging circuit needs input regarding which type of port the USB cable is connected to and how much current we are allowed to draw from this port.

The i.MX6 reference manual describes USB port detection in chapter 65 (Universal Serial Bus 2.0 Integrated PHY) and the actual algorithm for finding which type of port is connected is described in chapter 65.2.7.4 (charger detection software flow). This algorithm is implemented in the file kernel/drivers/usb/gadget/imx_usb_charger.c and we have found this algorithm to work well when testing USB port detection.

The algorithm decides that the connected USB port is one of the following:
* Standard Downstream Port (SDP)
* Charging Downstream Port (CDP)
* Dedicated Charging Port (DCP)

The following is a bit simplified, but the Battery Charging Specification (http://www.usb.org/developers/devclass_docs/BCv1.2_070312.zip) states how much current a device is allowed to draw from a specific type of port:

* SDP: 100mA when not configured and 500mA when configured.

* CDP/DCP: 1500mA without having to be configured or follow the rules of suspend.


We plan to draw at most 900mA which should be ok for both CDP and DCP, but for the SDP we need to draw either 100mA or 500mA depending on if the port is configured or not. The port gets configured after a negotiation between the connected USB port and the i.MX6 USB controller. The actual negotiation is (somewhat simplified) described at http://www.lvr.com/usbcenum.htm


From what I can see there is no way to get this information from the available i.MX6 registers so we don't know whether we are allowed to draw 100mA or 500mA.


Any input on how to get the amount of current being allowed to draw from a connected USB port would be greatly appreciated?

Labels (1)
0 Kudos
1 Solution
2,123 Views
LinWang
NXP Employee
NXP Employee

Daniel,

Yes, it has not supported by current udc driver, the attached patch may help it,  this patch has not tested, besides, please make sure

the usb charger is enabled.

 

View solution in original post

0 Kudos
17 Replies
2,124 Views
LinWang
NXP Employee
NXP Employee

Daniel,

Yes, it has not supported by current udc driver, the attached patch may help it,  this patch has not tested, besides, please make sure

the usb charger is enabled.

 

0 Kudos
2,123 Views
yanbingxu
Contributor I

Hi LinWang,

I am a software engineer at ThermoFisher Scientific, which is using IMX6Q as processor for our portable analytic instrument. I also have the same question as posted. I want to download the patch file you directed and see if it works on our platform. I got the following error message. My email address is yanbing.xu@thermofisher.com. Please help me access the file though email or other means.

"Access to this place or content is restricted. If you think this is a mistake, please contact your administrator or the person who directed you here."

Thanks,

Yanbing

0 Kudos
2,123 Views
LinWang
NXP Employee
NXP Employee

Hi Yixing Kong , how can we help on this customer? Thanks!

0 Kudos
2,123 Views
YixingKong
Senior Contributor IV

Wang Lin

Let me take care of it.

Thanks,

Yixing

0 Kudos
2,123 Views
rotechen
Contributor I

Hi LinWang,

I am a software engineer at cenec corp. I also have the same question as posted. I want to download the patch file you directed and see if it works on our platform. I got the following error message. My email address is rote@cenec.com.tw. Please help me access the file though email or other means.

"Access to this place or content is restricted. If you think this is a mistake, please contact your administrator or the person who directed you here."

Thanks,

Rote

0 Kudos
2,123 Views
LinWang
NXP Employee
NXP Employee

Hi Rote,

Please contact FSL FAE for help.

I don't have right to send out to customer directly.

Hope get your understanding.

Thanks!

0 Kudos
2,123 Views
rotechen
Contributor I

Ok, i will contact the FSL FAE.

Thanks!

0 Kudos
2,123 Views
danielmattsson
Contributor I

Hi LinWang,

Thanks for the patch, but I am not allowed to download it. I get the following error message: "Access to this place or content is restricted. If you think this is a mistake, please contact your administrator or the person who directed you here."

Regards,

Daniel

0 Kudos
2,123 Views
YixingKong
Senior Contributor IV

Daniel

If your issue had bene addressed, we will close the DI. Or you can reply with an update to this DI if your issue still exists.

Regards,

Yixin

0 Kudos
2,123 Views
danielmattsson
Contributor I

Hi Yixing,

Sorry for late reply. The HW engineer responsible for USB related stuff is not available this week so testing have been stalled. We have done some initial tests and we have done some minor modifications to the fix, but it looks promising. If I could get back to you during next week regarding this issue it would be great.

Regards,

Daniel

0 Kudos
2,123 Views
YixingKong
Senior Contributor IV

Daniel

It is ok. Please get back to here next week.

Thanks,

Yixing

0 Kudos
2,123 Views
danielmattsson
Contributor I

Hi Yixing,

We have now verified the behaviour and the supplied patch worked as desired.

Thanks for your help!

Regards,

Daniel

0 Kudos
2,123 Views
YixingKong
Senior Contributor IV

Daniel

Please login community and then download. If you are still unable to download it, please put your email address here. I will send it by email.

Regards,

Yixing

0 Kudos
2,123 Views
LinWang
NXP Employee
NXP Employee

Hi YixingKong,please help to check download issue.

Thanks!

0 Kudos
2,123 Views
YixingKong
Senior Contributor IV

Daniel

We are sorry for getting back to you so late. Are you still stuck with the issue? If you have somehow to resolved the issue, can we close the discussion? If you still need help, please feel free to reply with an update to this discussion.

Thanks,
Yixing

0 Kudos
2,123 Views
danielmattsson
Contributor I

Hi Yixing,

We have unfortunately not solved this issue yet. We haven't had much progress since my last post so the problem described above is still valid. Any input would be appreciated.

Regards,

Daniel

0 Kudos
2,123 Views
YixingKong
Senior Contributor IV

Daniel

I will branch your issue into an inernal group and assign an engineer to work on it.

Regards,

Yixing

0 Kudos