How to get the OTG working on linux for BPI-M3


(Olivier) #1

Hello, Has anyone been able to make the OTG working ? When connected, my BPI-M3 is not even displayed on the host computer (lsusb), and dmesg reports nothing. I’ve tried compiling myself the kernel and adding OTG support in menuconfig but it doesn’t solve my issue. BTW, what’s the difference between BPI_M3_1080P and BPI_M3_USB_1080P ? Thank you


Using USB OTG with the BPI-M3
(Philippe Trottier) #2

I think the USB and no USB version is for the root media, if you have your root=/dev/sdx then you probably need the USB version.


BPI-M3 using g_ether
(Olivier) #3

Thank you. I finally got the USB OTG working in device mode, with the gadget module g_ether. For a reason that I ignore (I haven’t looked in detail the cause yet), the variable is_udc_enable in sunxi_udc.c is set by default to 0 and nothing ever changes its value. Setting it to 1 makes the USB visible, but I was still not able to use the BPI as a device. The role of the OTG which can be get/set in /sys/bus/platform/devices/sunxi_usb_udc/otg_role is always set to 1 (host) even if the role is forced to 2 (device) in the sys_config.fex . You need to manually set it to 2 (twice ??) with the command : echo 2 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role Hope this will be useful to anybody else.


#4

How could you load the gadget module g_ether? This module does not exists on any image I tried out …


(Olivier) #5

This module is set by default as a built-in in the kernel configuration, so you don’t have to manually load it, it’s automatically loaded at startup. If you really need to load it on demand you can try to set it as a module in the menuconfig but it didn’t work for me.


#6

this board is bullshit and the makers are a bunch of fucking idiots. nothing actually works, i bought the stupid thing for the USB OTG, and obviously it is not working. i’ll return the damn board and stick with raspberry pi, at least they are not bullshitting their customers!


#7

This helped a lot! Many thanks.

I have to perform these steps at startup:

echo -n 0 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role

insmod g_ether.ko

echo -n 2 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role

And the PC detects the board.