About VBUSVALID Config

HI ,

I wan to  disable the vBus "VBUS is not valid, and the pull-up resistor on D+ is disabled." on nRF54LM20,

I try to write to disconnect usb from PC :

    NRF_USBHS->PHY.INPUTOVERRIDE |= USBHS_PHY_INPUTOVERRIDE_VBUSVALID_Msk;
    NRF_USBHS->PHY.OVERRIDEVALUES &=~USBHS_PHY_INPUTOVERRIDE_VBUSVALID_Msk;
and the USB still on connecting,How to set  the pull-up resistor on D+ is disabled? thanks
  • Hi,

    Your second line uses the wrong mask register. You are applying USBHS_PHY_INPUTOVERRIDE_VBUSVALID_Msk to PHY.OVERRIDEVALUES, but these are two separate registers with different bit layouts. You need to clear the VBUSVALID bit in PHY.OVERRIDEVALUES using the correct mask for that register.

    According to the datasheet:

    1. PHY.INPUTOVERRIDE — Enables the override for a specific signal (e.g., VBUSVALID field, bit F). Set this bit to activate the override. [PHY.INPUTOVERRIDE]

    2. PHY.OVERRIDEVALUES — Sets the actual value driven to the PHY when the override is active. For VBUSVALID (bit F): [PHY.OVERRIDEVALUES]
    • 1 = VBUS is valid, pull-up on D+ enabled
    • 0 = VBUS is not valid, pull-up on D+ disabled

    So, could you try the following:


    NRF_USBHS->PHY.OVERRIDEVALUES &= ~USBHS_PHY_OVERRIDEVALUES_VBUSVALID_Msk;
    NRF_USBHS->PHY.INPUTOVERRIDE |= USBHS_PHY_INPUTOVERRIDE_VBUSVALID_Msk;

    Set the value before enabling the override, to avoid a glitch where the PHY briefly sees the wrong value.

    -Priyanka

  • HI Priyanka,

    I tested the fix, but the device remains connected and visible to the host. It seems the PHY override for VBUSVALID is not taking effect. Could there be another register or bit that needs to be configured? Thanks

  • Hi,

    Thanks for testing. Changing VBUSVALID does not directly tell the PC that the USB device has disconnected.

    It only changes what the USB PHY thinks about the USB power signal. 

    To make the PC see the device as disconnected, use the USB controller’s software-disconnect bit.

    Look for SFTDISCON – Soft Disconnect. The documentation states that while this bit is set, the host does

    not see the device as connected, and enumeration restarts after the bit is cleared.

    Then reconnect again and wait a few seconds.

    In short, use VBUSVALID to control the PHY’s view of USB power, but use SFTDISCON when you want the

    PC to detect that the USB device has been unplugged.

    -Priyanka

Related