Need help with creating USB gadgets on Jetson Nano

Hello. I would like to create a USB gadget using configfs on my Jetson Nano 2GB.

However, when I run the mkdir command in “/sys/kernel/config/usb_gadget”, I get the error “Cannot allocate memory” and cannot create the directory. Just like in this topic.

I followed the solution in the topic, but the link to the patch file was broken and I couldn’t figure out what to do.
I tried with Linux Kernel 4.9 (32.5.1 and 32.4.3), but both failed.

Please let me know how to solve this error. Thank you.

Hi @masayukid306,

Could you try running that command when you have stopped/deleted the gadgets created by default by the jetson scripts, you can do that by using:

sudo systemctl stop nv-l4t-usb-device-mode.service

I ran into a similar problem and this fixed the issue as it cleaned up the created devices and let me start from scratch.

Best Regards,
Roberto Gutierrez,
Embedded Software Engineer,

Running the command and stopping the default gadget solved this issue.