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.

AM67: USB-C DRP functionality on the J722SXH01EVM not working

Part Number: AM67
Other Parts Discussed in Thread: TUSB321, TUSB321AI

Tool/software:

I am trying to design a USB-C 2.0 connector circuit connected to USB0 for use as a USB-C port and for booting. I have been following the design on the EVM and I am confused by the USB Type C Current Limit circuit design. 

I understand the mechanics of the circuit and how it correctly enables/disables the VBUS_5V0_TYPEC rail, but I don't get why USBC_ID isn't brought back to the processor. Isn't it still needed for the processor to be able to correctly determine if it should be configured as a UFP or DFP, or is this information transmitted through the USB data lines?

What further confuses me is that this circuit doesn't seem to work on my EVM. When I plug a USB-C drive into the port nothing happens. When I measured out the signals USB_TYPEC_DRVVBUS and USB0_DRVVBUS are low, preventing U50 from enabling. If I manually change USB0_DRVVBUS high, it then detects the USB drive. However, if I then try to configure the board as a USB device and connect it to my PC, I get a bunch of errors:

root@am67-sk:~# dd if=/dev/zero of=/tmp/mass_storage.dat bs=1M count=128
128+0 records in
128+0 records out
134217728 bytes (134 MB, 128 MiB) copied, 0.657969 s, 204 MB/s
root@am67-sk:~# modprobe g_mass_storage file=/tmp/mass_storage.dat
[   30.187379] Mass Storage Function, version: 2009/09/11
[   30.192618] LUN: removable file: (no medium)
[   30.197229] LUN: file: /tmp/mass_storage.dat
[   30.201535] Number of LUNs=1
[   30.204635] g_mass_storage gadget.0: Mass Storage Gadget, version: 2009/09/11
[   30.211785] g_mass_storage gadget.0: userspace failed to provide iSerialNumber
[   30.219124] g_mass_storage gadget.0: g_mass_storage ready
root@am67-sk:~# [   38.236745] usb 2-1-port4: config error
[   39.370832] usb 2-1-port4: Cannot enable. Maybe the USB cable is bad?
[   40.570848] usb 2-1-port4: Cannot enable. Maybe the USB cable is bad?
[   40.577574] usb 2-1-port4: config error
[   41.506802] usb 2-1-port4: Cannot enable. Maybe the USB cable is bad?
[   41.513474] usb 2-1-port4: config error
[   43.054916] usb 2-1-port4: config error

SW2 is configured to set TUSB321 in DRP mode, so I was hoping for some clarity on what I might be doing wrong? I am using the latest SDK from the AM67x page.

  • Hi Douglas,

    I'm looking into this, however  I will need a little more time. I will come back to you tomorrow.

    Thanks,

    Stan

  • Hi Douglas,

    What is your board revision? I see in revision history older boards have issue with VBUS enable.

    Thanks,

    Stan

  • Looks like the revision number is 3A.

  • Hi Douglas,

    Seems like this revision is already fixed in terms of VBUS enable.

    You are right, USBC_ID isn't brought to the processor, therefore USB driver cannot know how to act - as a host or as a device. Thus, the only way is to configure the role of the controller is in software driver. ROM gets this information from BOOTMODE pins. SW2 must also be set accordingly in both cases.

    I will check internally for confirmation since I'm not super familiar with this board yet.

    Thanks,

    Stan

  • Douglas,

    I came across an internal forum thread discussing USB2 on this board. I got 2 major points:

    1. the board doesn't support lane swap, therefore an usb plug will work only in the one of the two directions

    2. DRVVBUS not working needs DRVVBUS pin mux config :

    diff --git a/dts/upstream/src/arm64/ti/k3-j722s-evm.dts b/dts/upstream/src/arm64/ti/k3-j722s-evm.dts
    index e362bfbb655..5d256e630c3 100644
    --- a/dts/upstream/src/arm64/ti/k3-j722s-evm.dts
    +++ b/dts/upstream/src/arm64/ti/k3-j722s-evm.dts
    @@ -375,6 +375,12 @@
                    bootph-all;
            };
     
    +       main_usb0_pins_default: main-usb0-default-pins {
    +               pinctrl-single,pins = <
    +                       J722S_IOPAD(0x0254, PIN_INPUT, 0) /* (E25) USB0_DRVVBUS */
    +               >;
    +       };
    +
            main_usb1_pins_default: main-usb1-default-pins {
                    pinctrl-single,pins = <
                            J722S_IOPAD(0x0258, PIN_INPUT, 0) /* (B27) USB1_DRVVBUS */
    @@ -1098,7 +1104,9 @@
     };
     
     &usb0 {
    -       dr_mode = "otg";
    +       pinctrl-names = "default";
    +       pinctrl-0 = <&main_usb0_pins_default>;
    +       dr_mode = "host";
            usb-role-switch;
     };

  • I have several questions/comments in regards to the previous two posts:
    1. I am unclear what you are referring to with the comment about lane swapping. Is this referring to swapping the super speed lanes or to USB 2.0 functionality? For our design we are only concerned with USB 2.0 through USB-C and have had no issues with plugging in a USB drive into the EVM board. We have had some issues on our own design with USB 2.0 only working in one direction, but that went away when we reworked one of our boards to closer match the EVM.

    2. For the DRVVBUS, we tried that pin mux config, but saw no change in behavior for DRVVBUS.

    3. For the EVM, I am still confused by the baseline behavior of the DRVVBUS behavior on the EVM. Currently I am using the most current SDK and have SW2 set to DRP. If I turn on the board, boot into Linux, and then plug a USB-C drive into the USB-C header, nothing happens. When I measure out the signals, DRVVBUS is low and thus power to the USB-C header is off. It isn't until I run some commands driving DRVVBUS high that the system finally drives power to the header and the USB-C drive shows up in Linux. My question then is why by default DRVVBUS is not driven high by the software? With the current design of the circuit on the board, I can't think of a reason for it to by default be low. 

    4. Overall our design goal is to connect USB0 from the AM67x to a USB-C header and support USB 2.0 as a DRP as well as for boot. My expectations for a USB port acting as both a host and device would have the ID pin brought back to processor, with the processor then controlling DRVVBUS to correctly set power. This matches with the typical application shown for TUSB321AI (the USB-C controller we plan to use), although the design is listed for DFP and not DRP. However, the AM67x processor does not have a dedicated USB_ID for USB0 and the software driver we are using (snps,dwc3) does not have dedicated pins for either ID or DRVVBUS. These facts indicate to us that the expect design is to just handle the ID and power control through hardware, but we are a little hesitant to copy the EVM as it doesn't seem to be working properly due to the issues I have discussed. Is the intended design for USB_ID for the AM67x to have it be controlled by hardware or should it be brought back to the processor to be controlled by software? Also are there any other reference designs using USB0 as a DRP on the AM67x we could reference aside from the EVM?

  • Hello Douglas,

    Thank you for the inputs.

    The expert supporting the query is Out of Office.

    Please expect 1..2 days delay in response.

    Regards,

    Sreenivasa

  • Hi Douglas,

    I'm checking internally about the history of the USB design in this board.

    1. I think the e2e post is referring to swapping of the physical direction of the USB plug in the receptacle

    3. DRVVBUS is not driven by software directly. The USB controller is driving the pin based on internal logic. DRVVBUS is driven high basically only in host mode (and never in peripheral mode) and when the SoC is not in a low-power mode. Software driver controls it indirectly by setting the controller in host, peripheral, or DRD mode.

    4. I agree about the ID pin absence. ID was also a controller-monitored pin in older SoCs. Nowadays this function can be implemented only via GPIO.

    I can see as you already stated - no ID pin signal is routed to the SoC by any means on this board. Based on this and the fact the VBUS power is controlled by board switches, I can conclude that DRD/DRP mode is not possible. Role switching can be done only manually during power down, by switching the role in the USB driver plus switching the USBC_MODE_SEL switch accordingly.

    I think you can refer to the USB2.0-only design in the TMDS64EVM . The receptacle used is micro-AB and the ID controller pin is pinned out on this device, but otherwise the USB2.0 DRD concept is clear here.

    Regards,

    Stan

  • Hi Douglas,

    I have reached out to the software expert.

    Please expect delay in response (early next week) due to the holidays in Bangalore.

    Regards,

    Sreenivasa

  • HI Douglas,

    For the EVM, I am still confused by the baseline behavior of the DRVVBUS behavior on the EVM. Currently I am using the most current SDK and have SW2 set to DRP. If I turn on the board, boot into Linux, and then plug a USB-C drive into the USB-C header, nothing happens. When I measure out the signals, DRVVBUS is low and thus power to the USB-C header is off. It isn't until I run some commands driving DRVVBUS high that the system finally drives power to the header and the USB-C drive shows up in Linux.

    Can you try adding the below patch in linux and try testing on TI J722S EVM?

    • the root-cause of the issue is the USB2.0_MUX_SEL GPIO. The following change in k3-j722s-evm.dts enables the Type-C interface in linux

    diff --git a/arch/arm64/boot/dts/ti/k3-j722s-evm.dts b/arch/arm64/boot/dts/ti/k3-j722s-evm.dts
    index 6169b2c9710f..ea74ab159848 100644
    --- a/arch/arm64/boot/dts/ti/k3-j722s-evm.dts
    +++ b/arch/arm64/boot/dts/ti/k3-j722s-evm.dts
    @@ -668,7 +668,7 @@ p05-hog {
                            /* P05 - USB2.0_MUX_SEL */
                            gpio-hog;
                            gpios = <5 GPIO_ACTIVE_LOW>;
    -                       output-high;
    +                       output-low;
                    };
     
                    p01_hog: p01-hog {

    Also, it would be great if you can try with SW2 in both DFP and DRP mode.

    Regards

    Gokul

  • Hello Douglas, 

    Checking if you were able to make some progress?

    Regards,

    Sreenivasa

  • I haven't had time to test this out as our software team has been very busy, but this ultimately seems to be a sidestep for us as this change would just move the USB functionality of the USB-C header over to the HUB, a part of the EVM we are not copying in our design. We were more interested in getting USB0 to work directly with the USB-C header as that is what we are doing in our design, which from our understanding of the circuit would only require a software change of USB0_DRVVBUS being driven high with a gpio-hog. However at this point in time we have moved forward with a new design for our USB-C circuit that implements a hardware solution for USB-C ID and have little interest in continuing to debug the EVM. Thank you for your time supporting us with these issues.