Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
All support for Intel NUC 7 - 13 systems has transitioned to ASUS. Read latest update.
12583 Discussions

Problem to use the USB OTG as gadget (peripheral) in linux

Honored Contributor II



I'm using the helio board from macnica with a SoC Cyclone V and I'm trying use the USB OTG of the board as device (gadget) in the linux. 

My target is connect the board to my PC and I want that my PC recognize the board as HID device or CDC device. 


With a little search in the web I discovered that I need enable the module libcomposite.ko and the module g_serial.ko. 


The kernel image that I use is from the site: I have tryed with the kernel 3.13 and 3.18. 


When I use the kernel 3.13, I get the error: 

root@socfpga:~/drivers# insmod libcomposite.ko // OK no error 

root@socfpga:~/drivers# insmod g_serial.ko  

Error: could not insert module g_serial.ko: No such device 


in the dmesg have the message: 

couldn't find an available UDC 


I suppose that the error is because don't have the UDC (USB device controller) driver, I try enable the flag Designware/S3C HS/OtG USB Device controller in the 

→ Device Drivers → USB support → USB Gadget Support → USB Peripheral Controller to enable the driver. 

but when I try it the kernel compilation brike with the error: 

make[3]: *** No rule to make target `drivers/usb/gadget/s3c-hsotg.o', needed by `drivers/usb/gadget/built-in.o'. Stop. 


The most interesting is that in the drivers/usb/dwc2/Makefile have the follow message: 


# NOTE: This driver at present only implements the Host mode 

# of the controller. The existing s3c-hsotg driver supports 

# Peripheral mode, but only for the Samsung S3C platforms. 

# There are plans to merge the s3c-hsotg driver with this 

# driver in the near future to create a dual-role driver. Once 

# that is done, Host mode will become an optional feature that 

# is selected with a config option. 



In the kernel 3.18 this structure of the kernel was changed, but I have the same error when try execute the module the command "insmod g_serial.ko". 


Someone know if the Altera give drivers to use the OTG as peripheral in the linux? If yes how I can do it? 




Willian Henrique
0 Kudos
1 Reply
Honored Contributor II



I have the encountered the same problem. I'm using De1-soc with some modification to use the usb in peripheral mode. Did you find a solution about the problem ?
0 Kudos