Jump to content

Banana Pi M2 Zero OTG port not working with keyboard


Recommended Posts



I recently purchased a Banana Pi M2 zero, and I can't seem to get the OTG port to work with any kind of operating system. I have tried all of the normal remedies like cable issues, power supply, etc. With no luck. I know Armbian is usually the best OS for these little boards, but I can't seem to get a keyboard or mouse to work with it. Although it boots up just fine. Any help would be greatly appreciated!

Link to comment
Share on other sites

The correct answer(s) (harder and harder to stumble upon these days) documented here:

Banana Pi forums: BPI-M2-Zero Can’t get keyboard to work


Quick synopsis for posterity:

1. Armbian disables micro-USB host mode since 5.17

=> as mentioned by Erik, use images under the heading "... support emmc, usb wifi, emac" 

OR as mentioned by August, if you know how to edit /etc/modules (on the flashed micro-SD card as root), comment out g_serial


2. as mentioned by Mickey, BPi-M2-Zero OTG port does not work with ALL OTG cables (ask me how I know!! <= wasted hours ...)


Hope that helps.

Keep tinkering.


Edited by pepar
Link to comment
Share on other sites

Answers to your questions below the addendum.


As an addendum to my previous comment (seems that I am not ALLOWED to edit it???), a third option to re-enable micro-USB host exists:

OR as mentioned by Tomash here, you can modify the Device Tree Blob by editing/recompiling the .dts file (the main advantage being, it should withstand/survive updates better)



Yes, images listed under that heading have USB host mode enabled (amongst other features).


Not necessarily.

First, depending on your level of comfort with SBCs/BPi-M2-Zero/linux cli, pick your method to address the USB host mode (flashing an aforementioned image being the "easiest") and then boot your BPi-M2-Zero. 

Now try with your supplied OTG cable => keyboard should work. If not, without rebooting, try a different OTG cable.


Be methodical, one known issue at a time ...


Hope that helps.

Keep tinkering.


Edited by pepar
Link to comment
Share on other sites

9 hours ago, pepar said:

seems that I am not ALLOWED to edit it???

Fairly new users to the forums are only allowed to edit their posts for a short period of time. With time and created postings this time span will increase. Until then it is perfectly fine to create a fresh posting for adding information.

Link to comment
Share on other sites

Ok, so I'm a little confused. Did Tomash build his own Armbian image and alter the specific lines or did he alter the code in an existing image. If it was the later, how would I go about doing that? Sorry, I'm kind of new at this. I'm also trying all of the different images in the Drive folder. Most of them when booting up say "Failed to start console-setup.service - Set console font and keymap. Does this have anything to do with my issue? Also, on some of the other images it says that it can't enumerate the USB device. At least it recongizes it, but it gets stuck in the loop of saying that the USB device cannot be enumerated. I tried other keyboards to see if anything would change, but nothing so far. 


Thank you so much for your help, I'm kind of new to this side of the SBC world.

Link to comment
Share on other sites

No. You don't need to build an image. You modify the DTB by editing the files on the micro-SD file system (you need to mount it/work as root from another linux system). But it should be the last option you try since you are "kind of new to this ...".


Don't worry about the "Failed to start console-setup...." it mostly affects the way the console "looks" on your HDMI monitor.


The USB enumeration is more of a problem. It suggests that your port/cable is not working properly.


Since you are "new" at this, may I suggest a few things:

1. power the board using the "DC_IN" micro-USB port with a good USB supply/cable 5V/2A.

2. use the "OTG" port with your OTG cable and USB keyboard only (important).

3. use KISS: flash and boot the simplest images (no desktop, I like debian, ...)

4. test the keyboard (ONLY device attached to the OTG cable, no hub/mouse/... ). IF it does not work, try a different OTG cable with the same keyboard and without rebooting.

5. if it still does not work for you then flash an Armbian "current" image (maybe Armbian_23.8.1_Bananapim2zero_bookworm_current_6.1.47_minimal.img.xz), then edit /etc/modules and comment the "g_serial" line (as root, on the micro-SD card, put '#' as the FIRST character on the line) and repeat the previous steps.


As I mentioned earlier, be VERY methodical (work on one issue at a a time), it will work.


By the way, how are you reading the boot log messages? USB serial/UART cable or mini HDMI to monitor cable?


P.S. If your networking skills are good AND you have a USB-Ethernet adapter, you can use it instead of the keyboard and check your router for the IP lease issued to the USB-Ethernet MAC address, then you can SSH into the BPi-M2-Zero using that IP ...

ie. once you get the micro-USB host mode enabled/restored, a lot of USB devices will "just work".



Hope that helps.

Keep tinkering.


Link to comment
Share on other sites

Is there a way to enable this port again as usb host for 6.1+ kernels?

I was using before a custom overlay but it's not working anymore.

I'm using Orange Pi One with Allwinner H3 and before with 5.15 kernel I was getting this:


dmesg | grep musb
[    3.589043] musb-hdrc musb-hdrc.4.auto: MUSB HDRC host driver
[    3.589082] musb-hdrc musb-hdrc.4.auto: new USB bus registered, assigned bus number 9
[    3.589483] usb usb9: Manufacturer: Linux 5.15.93-sunxi musb-hcd
[    3.589491] usb usb9: SerialNumber: musb-hdrc.4.auto

Now with 6.1+ kernels I get this


musb-sunxi 1c19000.usb: Disabling musb host side code due to re-routed phy


I don't find any g_serial with lsmod so no need to disable the module. Neither it's present in /etc/modules.


Link to comment
Share on other sites

@surenz Seems like discord went down. So posting here instead


As the overlay you are using seems ok, could you try creating your own custom image using https://github.com/armbian/build. I think there is a kernel patch that might be causing the conflict. Try editing patch/kernel/archive/sunxi-6.1/series.conf file to add a - (hyphen) at the start of the line that contains patches.megous/phy-allwinner-sun4i-usb-Add-support-for-usb_role_switch.patch. Then compile using ./compile.sh BOARD=orangepione BRANCH=current. For detailed instruction on setting up build environment and creating an image, see https://docs.armbian.com/Developer-Guide_Build-Preparation/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines