USB role switch with chipidea on i.MX8QXP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB role switch with chipidea on i.MX8QXP

Jump to solution
2,398 Views
afridi20
Contributor III
Hi NXP team,
 
When we are changing the role of the imx8 from host to gadget we are losing the connection which could be expected but its not reattaching (enumerating) the connected mobile device
 
In case of CarPlay we are changing the role of the imx8 from host to gadget  and sending role switch custom command to Apple phone to reverse its role as Host but we could observe its disconnected. Possible cause of disconnection occurs because of NACK. Apart from this, supplying the power from imx8 to the Apple phones irrespective of the role is also something we are facing issue with -
 
Kindly help on this issue. Also, provide role switch working binary if it is available for imx8qxp/qm mek.
Thanks a lot in advance.
 
I have added the below details with respective to usb roleswitch application which we have tested.
 
Steps followed in Roleswitch test:
 
   1. Keep iPhone  connected
   2. Send roleswitch command to iphone
   3. Do HU roleswitch
   4. Verify iPodout0 node is created
   5. Disconnect and verify switch back to host mode
 
 
1) Keep iPhone  connected
 
    Initialized the required values for iPhone roleswitch:
                vendor = strtoul("0x05ac", NULL, 16);
                product = strtoul("0x12a8", NULL, 16);
                bmRequestType = strtoul("0x40", NULL, 16) & 0xFF;
                bRequest = strtoul("0x51", NULL, 16) & 0xFF;
                wValue = strtoul("0x01", NULL, 16) & 0xFFFF;

    To check whether iphone got connected based upon vendor and product id:
                hdev = libusb_open_device_with_vid_pid(NULL, vendor, product);

 
2) Send roleswitch command to iphone
 
    API called to send roleswitch command to iphone:     
                libusb_control_transfer(hdev, bmRequestType, bRequest, wValue,0, 0, 0, DEFAULT_TIMEOUT) 
 
    Command sent:
                40 51 01 00 00 00
 
 
3) Do HU roleswitch
 
    To change the role of imx8dx(chip idea USB) to gadget:  
                system ("echo gadget > /sys/bus/platform/devices/ci_hdrc.0/role");

 4) Verify iPodout0 node is created
 
     Condtion to check ipodout node got created or not:
                if(access("/sys/class/ipodout", F_OK) != -1) {

 5) Disconnect and verify switch back to host mode
   
    To change the role of imx8dx(chip idea USB) to host:  
                system ("echo host > /sys/bus/platform/devices/ci_hdrc.0/role");
 
 
Note: Attached the usb analyzer log captured during roleswitch operation.
          
Tags (1)
0 Kudos
1 Solution
2,160 Views
afridi20
Contributor III
Role switch is happening using the carplay application and driver.

View solution in original post

0 Kudos
9 Replies
2,357 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

Could you tell us which version of BSP are you using?  We will help confirm.

0 Kudos
2,355 Views
afridi20
Contributor III

Android Q10.0.0_2.6.0 (Linux 5.4.70 kernel)

0 Kudos
2,344 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

MX8 and i.MX6 using same usb2.0 chipidea controller IP. As far as i know, chipidea usb 2.0 controller used by many i.MX6 customer's carplay product. In this case, by checking role_switch_workinglog-, chipidea controller role switch no problem. But issue likely related their test application or their carplay related kernel driver(such as iap). If customer could prove issue related to i.MX8 usb2.0 controller , i can only support on usb2.0 controller kernel driver debug. But if issue related to their carplay application or carplay related driver, such support need access Apple confidential spec and code, I suggest customer using professional services. This is update from our expert team. Hope can do help for you

0 Kudos
2,348 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

Note: Attached the usb analyzer log captured during roleswitch operation.

We do not see your attached files.

0 Kudos
2,205 Views
afridi20
Contributor III

Hi @Rita_Wang , Do we need to pull up the D+ line for role switch to work properly? Explain the reason for D+ pull up if it is required?

0 Kudos
2,217 Views
afridi20
Contributor III

Hi @Rita_Wang , Not able to attach the log file. Attached it screenshot. Please check it.

0 Kudos
2,218 Views
afridi20
Contributor III

Screenshot from 2022-02-28 20-01-59(1)(1).pngScreenshot from 2022-02-28 20-02-23(1).png

0 Kudos
2,161 Views
afridi20
Contributor III
Role switch is happening using the carplay application and driver.
0 Kudos
1,337 Views
Dmitriy_Nikitin
Contributor I

Hi, could u be more detailed in your answer? Need to change linux drivers?

0 Kudos