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.

AM3352: Invalid USB Packet Identifier (PID) fields observed from AM3352 host

Part Number: AM3352
Other Parts Discussed in Thread: TUSB217, TPS2544, TUSB217-Q1

We have a device using the AM3352 (an Electronic Logging Device aka ELD), with an external USB host port we use to connect to a camera (also our hardware).

We use the AM3352 USB1 for the external port. It goes through a (TI) TPS2544 USB charging port controller and power switch, then through a (TI) TUSB217 USB High Speed signal conditioner. The cable to our camera is built in to the camera. It is 2m long, and the port/cable passes both near and far-end eye tests.

We use the AM3352 USB0 internally for a cell modem. This connection is not at issue here.

We occasionally observe a lock-up of USB communication, fixable by reboot of the ELD, or by disabling and re-enabling the USB1 port (turning off the EN of the TPS2544).

Analysis with a TotalPhase USB480 POWER USB protocol analyzer indicates "Invalid PID Sequence" errors when the lockup starts.


The logs when this starts:
Mar 24 18:32:35 lbb-1 ktcamd[621]: [HubbleXU_Control:281] UVC ioctl error EIO (bad pipe), retrying
Mar 24 18:32:35 lbb-1 kernel: uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
Mar 24 18:32:36 lbb-1 ktcamd[621]: [HubbleXU_Control:291] UVC ioctl error (5) Input/output error. Offset: 256, DataSize: 351, XULen: 128, XU: 23
Mar 24 18:32:36 lbb-1 kernel: uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
Mar 24 18:32:37 lbb-1 ktcamd[621]: [HubbleXU_Control:281] UVC ioctl error EIO (bad pipe), retrying
Mar 24 18:32:37 lbb-1 kernel: uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
Mar 24 18:32:38 lbb-1 ktcamd[621]: [HubbleXU_Control:291] UVC ioctl error (5) Input/output error. Offset: 0, DataSize: 351, XULen: 128, XU: 23
Mar 24 18:32:38 lbb-1 kernel: uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
Mar 24 18:32:39 lbb-1 ktcamd[621]: [HubbleXU_Control:281] UVC ioctl error EIO (bad pipe), retrying
Mar 24 18:32:39 lbb-1 kernel: uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
Mar 24 18:32:40 lbb-1 ktcamd[621]: [HubbleXU_Control:291] UVC ioctl error (5) Input/output error. Offset: 128, DataSize: 351, XULen: 128, XU: 23
Mar 24 18:32:40 lbb-1 kernel: uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
Mar 24 18:32:41 lbb-1 ktcamd[621]: [HubbleXU_Control:281] UVC ioctl error EIO (bad pipe), retrying
Mar 24 18:32:41 lbb-1 kernel: uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
Mar 24 18:32:42 lbb-1 ktcamd[621]: [HubbleXU_Control:291] UVC ioctl error (5) Input/output error. Offset: 256, DataSize: 351, XULen: 128, XU: 23
Mar 24 18:32:42 lbb-1 kernel: uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
Mar 24 18:32:43 lbb-1 ktcamd[621]: [HubbleXU_Control:281] UVC ioctl error EIO (bad pipe), retrying
Mar 24 18:32:43 lbb-1 kernel: uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
Mar 24 18:32:44 lbb-1 ktcamd[621]: [HubbleXU_Control:291] UVC ioctl error (5) Input/output error. Offset: 0, DataSize: 351, XULen: 128, XU: 23
Mar 24 18:32:44 lbb-1 kernel: uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).

ktcamd is our camera management daemon. "Hubble" is an internal code name for the camera. These messages will continue whenever ktcamd attempts to control the camera. Restarting the camera does not recover the system. Removing the camera and re-inserting it to the USB port does cause a new enumeration, but the errors resume shortly thereafter. Restarting the ELD does fix the error.

We've found that enforcing a 5ms delay between XU control messages seems to prevent this issue.

Does TI have any suggestions?

  • There's no edit, and the auto-tagging didn't pick up the TUSB217, so TUSB217-Q1 since that seems to be the full part number.

  • Hi,

    I received the bus trace (lockup-hubble-usb.tdc) offline. I will spend more time reviewing it, right now I have a few questions.

    - have you tried to turn off the usb modem power to see if the issue happens, I want to know if the modem radio radiation interferes the camera.

    - the log you provided above is more related to the camera uvc driver, do you see any kernel usb low level logs when the lockup happens? Running dmesg command right after lockup should dump the relevant kernel log.

    - have you tried to directly connect the camera to AM335x EVM such as Beaglebone Black to see if the issue happens?

    - can you please explain what the 5ms delay between XU control does in terms of USB transfers in kernel driver's view?

  • - have you tried to turn off the usb modem power to see if the issue happens, I want to know if the modem radio radiation interferes the camera.

    I have tried this. It still happens.

    - the log you provided above is more related to the camera uvc driver, do you see any kernel usb low level logs when the lockup happens? Running dmesg command right after lockup should dump the relevant kernel log.

    Nothing different. dmesg log, starting from when I turned off the cell modem (USB bus 1), then plugged in the camera.

    [ +20.028169] musb-hdrc musb-hdrc.1: remove, state 1
    [  +0.000047] usb usb1: USB disconnect, device number 1
    [  +0.004060] musb-hdrc musb-hdrc.1: USB bus 1 deregistered
    [ +10.036764] musb-hdrc musb-hdrc.1: MUSB HDRC host driver
    [  +0.000054] musb-hdrc musb-hdrc.1: new USB bus registered, assigned bus number 1
    [  +0.000247] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [  +0.000011] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [  +0.000008] usb usb1: Product: MUSB HDRC host driver
    [  +0.000007] usb usb1: Manufacturer: Linux 4.9.69-lbb1 musb-hcd
    [  +0.000007] usb usb1: SerialNumber: musb-hdrc.1
    [  +0.004936] hub 1-0:1.0: USB hub found
    [  +0.000328] hub 1-0:1.0: 1 port detected
    [Mar29 15:33] usb 1-1: new high-speed USB device number 2 using musb-hdrc
    [  +0.172955] usb 1-1: New USB device found, idVendor=0408, idProduct=c002
    [  +0.000056] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [  +0.000007] usb 1-1: Product: DC54 
    [  +0.000007] usb 1-1: Manufacturer: Amba
    [  +0.003127] uvcvideo: Found UVC 1.00 device DC54  (0408:c002)
    [  +0.003658] uvcvideo: Unable to create debugfs 1-2 directory.
    [  +0.008289] uvcvideo 1-1:1.0: Entity type for entity Extension 10 was not initialized!
    [  +0.000024] uvcvideo 1-1:1.0: Entity type for entity Processing 5 was not initialized!
    [  +0.000010] uvcvideo 1-1:1.0: Entity type for entity Camera 1 was not initialized!
    [  +0.001094] input: DC54  as /devices/platform/ocp/47400000.usb/47401c00.usb/musb-hdrc.1/usb1/1-1/1-1:1.0/input/input4
    [Mar29 15:40] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039954] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040152] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039937] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040009] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040547] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039638] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040145] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040155] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039914] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +0.457639] usb 1-1: usbfs: process 623 (ktcamd) did not claim interface 0 before use
    [  +0.582711] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039793] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040258] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039931] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040190] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040208] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039821] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [Mar29 15:41] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +0.138479] usb 1-1: usbfs: process 623 (ktcamd) did not claim interface 0 before use
    [  +0.903582] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.037969] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040666] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039532] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040080] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040074] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040002] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040484] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039693] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.041769] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.038393] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.043697] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.036737] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039792] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040095] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040021] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040070] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040373] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.041800] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.038058] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040127] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040115] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040325] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039804] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040151] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039959] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040064] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040502] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039790] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039984] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040108] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040089] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040670] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039377] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.040156] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  +1.039998] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    ^C

    have you tried to directly connect the camera to AM335x EVM such as Beaglebone Black to see if the issue happens?

    I have not. I'm sure we have a Beaglebone Black somewhere, I'll see if I can get it and test.


    - can you please explain what the 5ms delay between XU control does in terms of USB transfers in kernel driver's view?

    I didn't add it. It's a userspace delay, in the application which sends control messages to the camera. So from the kernel driver's view there's a bit more time after the end of each transaction before the start of the next.

  • Hi Carl,

    Nothing different. dmesg log, starting from when I turned off the cell modem (USB bus 1), then plugged in the camera.

    So no more kernel dmesg log messages when the lockup happens?

    I have not. I'm sure we have a Beaglebone Black somewhere, I'll see if I can get it and test.

    Looking forward to the test result.

    I didn't add it. It's a userspace delay, in the application which sends control messages to the camera. So from the kernel driver's view there's a bit more time after the end of each transaction before the start of the next.

    Can you please explain what control messages are sent between the delay? Maybe provide a code snippet?

    Please also do the following test:

    - when the lockup happens, remove the camera;

    - run command 'dmesg -C' to clear the dmesg log buffer;

    - plug in the camera;

    - run command 'dmesg', if it prints any log message, please provide it here.

  • > So no more kernel dmesg log messages when the lockup happens?

    Correct.

    > Can you please explain what control messages are sent between the delay? Maybe provide a code snippet?


    We either send a UVC SET_CUR or a GET_CUR of length 128 bytes.

    LBB_EC HubbleXU_Control(HubbleXUQueryData_t * QueryData)
    {
        LBB_EC RetVal = LBB_OK;
        struct uvc_xu_control_query XUQuery;
        int IORet = 0;
        uint16_t XULen = HUBBLE_UVC_XU_INVALID_LEN;
    
        if (QueryData == NULL)
        {
            return LBB_ERR;
        }
    
        pthread_mutex_lock(&LocalData.Lock);
        if (OpenVideoDev() != LBB_OK)
        {
            pthread_mutex_unlock(&LocalData.Lock);
            return LBB_ERR;
        }
    
        XULen = GetXULen(QueryData);
    
        if (XULen == HUBBLE_UVC_XU_INVALID_LEN)
        {
            slog(LOG_ERR,"Failed to GET_LEN for XU %d", QueryData->XU);
            CloseVideoDev();
            pthread_mutex_unlock(&LocalData.Lock);
            return LBB_ERR;
        }
    
        memset(&XUQuery, 0, sizeof(struct uvc_xu_control_query));
    
        XUQuery.query = QueryData->Query ;
        XUQuery.unit = HUBBLE_UVC_XU_ID;
        XUQuery.selector = QueryData->XU;
        XUQuery.size = XULen;
    
        for (size_t Offset = 0; Offset < QueryData->XUDataSize; Offset += XULen)
        {
            XUQuery.data = &QueryData->XUData[Offset];
    
            IORet = LBB_ioctl(LocalData.HubbleFD, UVCIOC_CTRL_QUERY, &XUQuery);
            if (IORet == -1)
            {
                RetVal = LBB_ERR;
    
                /* If this is a broken pipe error retry the message after closing/
                 * re-opening the pipe.
                 */
                if(errno == EIO)
                {
                    slog(LOG_WARNING, "UVC ioctl error EIO (bad pipe), retrying");
                    if(LBB_ioctl(LocalData.HubbleFD, UVCIOC_CTRL_QUERY, &XUQuery) != -1)
                    {
                        /* close/re-open succeeded, reset the error */
                        RetVal = LBB_OK;
                    }
                }
    
                if(RetVal == LBB_ERR)
                {
                    slog(LOG_ERR, "UVC ioctl error (%d) %s. Offset: %d, DataSize: %d, XULen: %d, XU: %d", errno, strerror(errno), Offset, QueryData->XUDataSize, XULen, QueryData->XU);
                }
            }
    
    #if ENABLE_PACKETIZER_DELAY
            //HUB-506 - debugging, add optional delay between packets
            if ( (LocalData.PacketizerDelayMs) && ((Offset + XULen) < QueryData->XUDataSize) )
            {
                LBBTime_SleepMS(LocalData.PacketizerDelayMs);
            }
    #endif
        }
    
        if (RetVal == LBB_ERR)
        {
            CloseVideoDev();
        }
        pthread_mutex_unlock(&LocalData.Lock);
    
        return RetVal;
    }
    

    > Please also do the following test:

    > - when the lockup happens, remove the camera;

    > - run command 'dmesg -C' to clear the dmesg log buffer;

    > - plug in the camera;

    > - run command 'dmesg', if it prints any log message, please provide it here.


    root@lbb-1:~# dmesg
    [105142.360651] usb 1-1: new high-speed USB device number 3 using musb-hdrc
    [105147.580878] usb 1-1: device descriptor read/64, error -110
    [105162.942061] usb 1-1: device descriptor read/64, error -110
    [105163.201922] usb 1-1: new high-speed USB device number 4 using musb-hdrc
    [105168.382336] usb 1-1: device descriptor read/64, error -110
    [105183.743525] usb 1-1: device descriptor read/64, error -110
    [105183.863928] usb usb1-port1: attempt power cycle
    [105184.344455] usb 1-1: new high-speed USB device number 5 using musb-hdrc
    [105184.923571] usb 1-1: new high-speed USB device number 6 using musb-hdrc
    [105206.597237] musb-hdrc musb-hdrc.1: remove, state 1
    [105206.597285] usb usb1: USB disconnect, device number 1
    [105206.606349] musb-hdrc musb-hdrc.1: USB bus 1 deregistered
    [105216.640469] musb-hdrc musb-hdrc.1: MUSB HDRC host driver
    [105216.640523] musb-hdrc musb-hdrc.1: new USB bus registered, assigned bus number 1
    [105216.641457] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [105216.641473] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [105216.641481] usb usb1: Product: MUSB HDRC host driver
    [105216.641488] usb usb1: Manufacturer: Linux 4.9.69-lbb1 musb-hcd
    [105216.641496] usb usb1: SerialNumber: musb-hdrc.1
    [105216.645568] hub 1-0:1.0: USB hub found
    [105216.645648] hub 1-0:1.0: 1 port detected
    [105217.166426] usb 1-1: new high-speed USB device number 2 using musb-hdrc
    [105222.386392] usb 1-1: device descriptor read/64, error -110
    [105236.733257] musb-hdrc musb-hdrc.1: remove, state 1
    [105236.733302] usb usb1: USB disconnect, device number 1
    [105237.607562] usb usb1-port1: attempt power cycle
    [105237.950426] musb-hdrc musb-hdrc.1: USB bus 1 deregistered
    [105247.982876] musb-hdrc musb-hdrc.1: MUSB HDRC host driver
    [105247.982934] musb-hdrc musb-hdrc.1: new USB bus registered, assigned bus number 1
    [105247.983484] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [105247.983496] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [105247.983504] usb usb1: Product: MUSB HDRC host driver
    [105247.983511] usb usb1: Manufacturer: Linux 4.9.69-lbb1 musb-hcd
    [105247.983518] usb usb1: SerialNumber: musb-hdrc.1
    [105247.988047] hub 1-0:1.0: USB hub found
    [105247.998124] hub 1-0:1.0: 1 port detected
    [105248.508424] usb 1-1: new high-speed USB device number 2 using musb-hdrc
    [105253.668997] usb 1-1: device descriptor read/64, error -110
    [105268.091410] musb-hdrc musb-hdrc.1: remove, state 1
    [105268.091456] usb usb1: USB disconnect, device number 1
    [105268.890072] usb usb1-port1: attempt power cycle
    [105269.233002] musb-hdrc musb-hdrc.1: USB bus 1 deregistered
    [105279.254008] musb-hdrc musb-hdrc.1: MUSB HDRC host driver
    [105279.254066] musb-hdrc musb-hdrc.1: new USB bus registered, assigned bus number 1
    [105279.255740] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [105279.255757] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [105279.255765] usb usb1: Product: MUSB HDRC host driver
    [105279.255772] usb usb1: Manufacturer: Linux 4.9.69-lbb1 musb-hcd
    [105279.255779] usb usb1: SerialNumber: musb-hdrc.1
    [105279.259137] hub 1-0:1.0: USB hub found
    [105279.259477] hub 1-0:1.0: 1 port detected
    [105279.771072] usb 1-1: new high-speed USB device number 2 using musb-hdrc
    [105284.951064] usb 1-1: device descriptor read/64, error -110
    [105300.312196] usb 1-1: device descriptor read/64, error -110
    [105300.572529] usb 1-1: new high-speed USB device number 3 using musb-hdrc
    [105305.752634] usb 1-1: device descriptor read/64, error -110

  • Hi Carl,

    Thanks for the kernel log. It basically tells the usb driver/controller is not in the right state, I am unable to tell what is wrong, we need to debug it more.

    Just to confirm - when you capture the dmesg log above, you only removed and reattached the camera, but didn't reload the usb drivers or do anything related to the USB port, right? The log shows the usb bus is deregistered and registered again. I never saw this happen before, not sure what caused this.

    Please do another test when the lockup issue happens -

    - please run the following command on the board to get the sysfs entry for usb regdump

    # find /sys/kernel/debug -name regdump

    I got the following for MUSB1 port in kernel v4.19.

    /sys/kernel/debug/musb-hdrc.1/regdump

    - then run the following command to get a few USB register dump

    # grep -i 'power\|devctl' /sys/kernel/debug/musb-hdrc.1/regdump

  • root@lbb-1:~# find /sys/kernel/debug -name regdump
    /sys/kernel/debug/musb-hdrc.1/regdump
    /sys/kernel/debug/musb-hdrc.1.dsps/regdump
    /sys/kernel/debug/musb-hdrc.0/regdump
    /sys/kernel/debug/musb-hdrc.0.dsps/regdump
    root@lbb-1:~# grep -i 'power\|devctl' /sys/kernel/debug/musb-hdrc.1/regdump
    Power       : f0
    DevCtl      : 5d

    The deregister/reregister seems to happen in the Linux kernel's drivers/usb/core/hub.c `hub_port_connect` function.

  • Hi Carl,

    The register dump shows the USB controller itself is in the correct state which detected the camera.

    Now there are two tests which results I like to see.

    1. test the camera on Beaglebone Black or other AM335x EVM which doesn't have the USB redriver and long cable;

    2. test with kernel v4.19 in TI Processor SDK v6.3. Around kernel v4.9 and v4.12 time frame, kernel had major PM function re-work in ARM-OMAP subsystem, which caused some issues in MUSB module, not sure if it would be related to this issue, so better to test with new kernel to see if the issue also happens.

  • I've managed to reproduce it on an EVM (AM335x Starter kit), running Linux kernel 4.19.94 via the image provided at https://software-dl.ti.com/processor-sdk-linux/esd/AM335X/latest/exports/am335x-evm-linux-06.03.00.106.img.zip

    AM335x console output:

    am335x-evm login: root
    root@am335x-evm:~# [  188.944011] usb 2-1.4.4.3: new high-speed USB device number 6 using musb-hdrc
    [  189.082400] usb 2-1.4.4.3: New USB device found, idVendor=0408, idProduct=c002, bcdDevice= 2.00
    [  189.092201] usb 2-1.4.4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [  189.103742] usb 2-1.4.4.3: Product: DC54 
    [  189.107839] usb 2-1.4.4.3: Manufacturer: Amba
    [  189.488604] uvcvideo: Found UVC 1.00 device DC54  (0408:c002)
    [  189.510524] uvcvideo: Failed to query (GET_INFO) UVC control 2 on unit 5: -32 (exp. 1).
    [  189.526650] uvcvideo: Unable to create debugfs 2-6 directory.
    [  189.536084] uvcvideo 2-1.4.4.3:1.0: Entity type for entity Extension 10 was not initialized!
    [  189.544804] uvcvideo 2-1.4.4.3:1.0: Entity type for entity Processing 5 was not initialized!
    [  189.553408] uvcvideo 2-1.4.4.3:1.0: Entity type for entity Camera 1 was not initialized!
    [  189.570650] input: DC54 : DC54  as /devices/platform/ocp/47400000.usb/47401c00.usb/musb-hdrc.1/usb2/2-1/2-1.4/2-1.4.4/2-1.4.4.3/2-1.4.4.3:1.0/input/input2
    [  189.590027] usbcore: registered new interface driver uvcvideo
    [  189.597355] USB Video Class driver (1.1.1)
    
    root@am335x-evm:~# CameraTestApp-armv7 -c 6 -d 2 --spam=fill
    [  236.854135] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  237.374210] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  237.894583] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  238.414175] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  238.934202] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  239.454155] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  239.974179] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  240.494276] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  241.014206] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  241.534258] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  242.054185] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  242.574187] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  243.094190] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  243.614191] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  244.134190] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  244.654279] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    [  245.174291] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    ^C[  245.694278] uvcvideo: Failed to query (SET_CUR) UVC control 23 on unit 10: -110 (exp. 128).
    
    root@am335x-evm:~# CameraTestApp-armv7 -c 6 -d 2 -g STATUS
    [  469.296166] uvcvideo: Failed to query (GET_LEN) UVC control 23 on unit 10: -110 (exp. 2).
    Could not get Cam Info
    root@am335x-evm:~# uname -r
    4.19.94-gbe5389fd85
    root@am335x-evm:~# 

    CameraTestApp is a program to send various commands to our cameras. -c 6 selects the camera type, -d 2 selects the /dev/video2 device, --spam=fill sends a data structure with data the camera uses internally. This structure is sent ever 5ms at most (due to the delay mentioned above).

    I see the same pattern in the TotalPhase capture. Somehow I don't seem to be able to attach that file though.

  • Hi Carl

    It is great you can reproduce the issue on the EVM.

    Before we go deeply into debugging it, can please try to rebuild the kernel with MUSB CPPI41 DMA disabled to see if the issue still happens on the EVM?

    What happened when you attached the trace file?

    - Click "Insert -> Image/Video/File"
    - Click "Upload"
    - Select the file to upload
    - Click "OK"

  • Here's the tdc capture on google drive, I'll try to get the kernel rebuilt with that option disabled.

  • Hi Carl,

    I reviewed the rdc capture trace. Now I don't think disabling CPPI41 DMA will have any effect.

    The trace shows the USB host is sending a SETUP transaction following by a OUT transaction and a IN transaction in every SOF, which is the SET_CUR communication. Until transaction index 7186345 which is (the first?) OUT transaction on EP2, then at transaction index 7194300 the camera stops responding to the PING packet (which is for the OUT transaction). It seems the camera is locked up at this point.

    Do you know what the EP2 OUT transaction is for?

    Do you have other platform (not AM3352) which shows the camera works okay with the same software?

  • I've managed to cause this same behavior from a laptop running Debian Bullseye. So it's not an AM335x issue. It's some sort of violation of the USB standard by the camera, and is something to resolve with the camera vendor. Marking this as resolved, since it's not TI's problem.