USB Serial Gadget cable removal problem on i.MX7/i.MX6ULL


Removing USB cable while Serial USB Gadget Tx buffer is not empty makes iMX7/iMX6ULL Colibri dead. Serial console is dead, all TCP/IP communications, ping are dead. The issue is the same using kernel versions 4.9, 4.14, 5.4 down stream.
What’s interesting I had no issue using the same code and even the same kernel 4.14 on VF50/VF61. On VF everything just keeps going, though communications are in progress and USB Tx buffers thus are not empty. Rechecked it many times.

Any advice how to fix it? As I understand iMX USB driver is somehow broken. Since there’s no kernel dump I don’t know where to look.

gadget schema

Sorry for noise. Fixed. Looks like I’ve switched USB controller from otg to peripheral on VF. Porting to iMX7D I thought it is not necessary. Well, difference is serious. Hope it will help someone.


HI @Edward

Perfect that you solve the issue. Thanks very much for your Input.

Best regards,

Hi All,

On Colibri IMX6 we observe similar behavior, and fix it by switching USB driver from OTG to peripheral. We use BSP 5.1. Also some clue we found here Solved: Re: USB gadget drivers hangs when the USB connecto… - NXP Community

Hi @Anton,

thanks for the contribution.

Best Regards