How can we redectect usb charger?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How can we redectect usb charger?

1,166 次查看
prosper
Contributor I

We have a condition where the usb power pins makes connections without the data pins when charger D+/D– detection occurs. Thus the usb charger is detect as SCP which we're relying on to set charging current. Is there a way to trigger a redetection or how an implementation can be made?

Using imx7

static int imx7d_charger_primary_detection(struct imx_usbmisc_data *data)
{
.....
    /* Check if it is a charger */
    val = readl(usbmisc->base + MX7D_USB_OTG_PHY_STATUS);
    if (!(val & MX7D_USB_OTG_PHY_STATUS_CHRGDET)) {
        // We're landing in here when we normally wouldn't
        dev_dbg(charger->dev, "It is a standard downstream port\n");
        charger->psy_desc.type = POWER_SUPPLY_TYPE_USB;
        charger->max_current = 500;
    }
    return 0;
}
标签 (4)
标记 (1)
0 项奖励
回复
3 回复数

1,055 次查看
IvanRuiz
NXP Employee
NXP Employee

Hello,

 

If the charger does have Dp/Dm connected in the plug but the detection happened before the Dp/Dm pins make contact, then it is sufficient to delay the detection.

i.e. when VBUS is detected, wait ~100 ms before calling the imx7d_charger_primary_detection() routine, to allow for signals to settle. (or put a delay in the detection routine).

 

Redetection afterwards is more difficult because the enumeration may have started. Enumeration will start when the device enables the 1.5K Dp pull-up resistor in the phy and this happens automatically when the controller is started (USB_CMD.RS bit is set).

If the charger detector is enabled whilst the controller is running, the communication with the host will be distorted and the charger detection may return incorrect results.

Hope it helps!

BR,

Ivan.

0 项奖励
回复

1,055 次查看
prosper
Contributor I

Hi Ivan,

If the charger does have Dp/Dm connected in the plug but the detection happened before the Dp/Dm pins make contact, then it is sufficient to delay the detection.

 

i.e. when VBUS is detected, wait ~100 ms before calling the imx7d_charger_primary_detection() routine, to allow for signals to settle. (or put a delay in the detection routine).

The primary issue is that the usb insertion notch is position just after the power pin makes contact but the data pins do not. So unfortunately event a long delay may not be sufficient. Hardware solution is being looked at by someone else.

Redetection afterwards is more difficult because the enumeration may have started. Enumeration will start when the device enables the 1.5K Dp pull-up resistor in the phy and this happens automatically when the controller is started (USB_CMD.RS bit is set).

 

If the charger detector is enabled whilst the controller is running, the communication with the host will be distorted and the charger detection may return incorrect results.

  1. What if we restrict the redetection to DCP or since we can determine that, restrict it to devices that do not talk to the controller?
  2. Is the controller even running when connected if the Dp and Dm is floating?
  3. Is there a way to determine that Dp and Dm were floating during detection?
  4. Is it possible to stop the controller?

Thanks,

Prosper

0 项奖励
回复

1,055 次查看
IvanRuiz
NXP Employee
NXP Employee

Hello,

As I mentioned before, the optimal procedure is to respect USB specifications also in regards of the hardware.

Enumeration will start when the device enables the D+ pull-up resistor in the PHY and this happens automatically when the controller is started -> USB_CMD.RS bit is set.

You will find details in the USB Battery charging specification, available at the www.usb.org.

Have a nice day!

BR,

Ivan.

0 项奖励
回复