This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

J5 EVM force USB device mode

I worked on the J5 EVM and DM814x boards. I tried to use the force device mode by setting  bit7 of USBnMODE and bit8(iddig) of USBnMODE as 1. USBnMODE=0x180. But bit7 of USBnMODE always can not be set. USBnMODE is 0x100. 

Can someone tell me how to set bit7 of USBnMODE as "1" to use the force mode and ignore the ID pin on J5/J4 board?

BTW, I tried AM335 board. bit7 of USBnMODE can be set as 1. it is correct.

Thanks a lot

  • Hi,

    For the DM814x USB ID pin check this forum thread:

    USB host with USB ID pin unconnected

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/248550.aspx

    Thank you.

    BR
    Vladimir

  • Thanks Viadimir for your reply.

    "I don't know; maybe the TRM text could mean that: On devices like DM814x (that have USB ID pin) the forced host mode cannot be controlled by software/registers.

    • If "iddig" register field of USB0MODE is 1, controller is forced to B type device - peripheral.
    • If "iddig" register field of USB0MODE is 0, the role it is controlled by the USB ID pin, so in that case to force host mode, you have to connect the the USB ID pin to GND (optionally with a jumper).

    Maybe there could be more specifics; it could be something else."

    Do you mean DM814x does not support USB force host/device mode as its datasheet mentioned?   If the dm814x USB_ID pin is grounded, it can be forced as device mode by software, except doing H/W change, right?

    Thanks,

    Jian  

  • Sorry, there is a typo.  it should be a "not":

    Do you mean DM814x does not support USB force host/device mode as its datasheet mentioned?   If the dm814x USB_ID pin is grounded, it can not be forced as device mode by software, except doing H/W change, right?

  • Jian,

    I am just saying that I can note the following sentence in the TRM:

    "

    if USB0MODE=0, the state of the USB_ID pin controls the role the controller assumes.

    "

    However, I think that for this scenario you shouldn't modify registers directly. Try with kernel config; for peripheral mode it should be something like the following:

    1. -> Device Drivers -> USB support -> USB Gadget Support [enable] (for some of the gadgets there could be some limitations and they could only work when compiled as kernel modules (or as built-ins, possibly), but that is another topic; try to experiment yourself)



    2. -> Device Drivers -> USB support -> Driver Mode -> USB Peripheral [choice]



    3. -> Device Drivers -> USB support -> USB Gadget Support -> USB Peripheral Controller -> Inventra HDRC USB Peripheral [choice]



    Note that you have to go to the "USB Gadget Support" and enable it first and then to go back to "USB support", switch to "USB Peripheral", and ultimately only after all of these - "Inventra HDRC USB Peripheral" will be visible.

    Please, try the above and let me know is it working.

    Thank you.

    BR
    Vladimir

  • Jian,

    One more thing (although you could be aware of this), depending on how you build the kernel, if you are using the kernel source from releases like EZSDK, some Makefiles may overwrite .config with the default config. For example within EZSDK here is one approach to reconfig and build the kernel:

    $ cd <EZSDK_HOME>/board-support/linux-<VERSION>/

    $ cp arch/arm/configs/ti8148_evm_defconfig .config

    $ make ARCH=arm xconfig

    (reconfig, save and exit)

    $ cp .config arch/arm/configs/ti8148_evm_defconfig

    $ cd <EZSDK_HOME>

    $ make linux_clean

    $ make linux





    This overwrites your default config.

    Thank you.

    BR
    Vladimir

  • Thanks very much Vladimir for your help.

    Unfortunately, I am not using Linux EZSDK. I am working on the QNX OS USB device driver. If bit7 of USBnMODE can not be modified directly, Do you know which registers(USB_CTRLn, USB_POWER, USB_DEVCTL or other) need be configured first and how? 

    I checked the EZSDK source, and tried to find such pre-configuration for bit7 of USBnMODE. But I didn't get it. Could you please let me know where the source related to these USB force device mode setting is?

    Thanks,

    Jian 

  • Jian,

    I cannot tell you exactly what could be done; I cannot test anything. Examine the entirety of the code under <KERNEL>/drivers/usb/musb and try to experiment on your side. Try with floating USB_ID. I can note the following sentence in the DM814x TRM, try to read again through the USB chapter, you could find something:

    "

    If desired, firmware can force the USB Controller to act as an A-Device or a B-Device by writing to IDDIG bit in the USB Mode register before it sets the DEVCTL[SESSION] bit.

    "

    Also you could try to enter peripheral mode with USB0MODE=0, I don't know what will work and what will not, again try to experiment. Also double-check that nothing overwrites your registers/configuration; use some tool to check the registers once the systems is up and running (if you haven't already).

    Thank you.

    BR
    Vladimir