Mikrotik LHG R add device support

I have a Mikrotik LHG R board. I have loaded the wap-r-2nd 21.02.0-rc3 squash upgrade bin and the board boots fine. I used the image builder to build an image with lte drivers and usb support. Board doesn't recognize an EC25-AF card or EM7565 in usb2 mode. I think it has to do with the gpio mapping for this board. Does any one have information for Routerboard LHGR? GPIO pin mappings or dts info?

Just wanted to thank the openwrt community for the support and an awesome product. Log time user, short time hacker.


1 Like

I was wondering if you have been able to get the LHG R to recognize the cards yet? I have been working with Quectel EM06-A and have the same issues.

Yes I did. You have to build from source and modify the mikrotik wapr-2nd.dts to include usb. I don't have access to the modified dts right now, but can post it later.

That would be great if you post it.

Thank you

You have to modify the dts file qca9533_mikrotik_routerboard-wapr-2nd.dts in the openwrt source as shown below. The file is located in the target/linux/ath79/dts folder and then build from there.

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "qca9533_mikrotik_routerboard-16m.dtsi"

/ {
	compatible = "mikrotik,routerboard-wapr-2nd", "qca,qca9533";
	model = "MikroTik RouterBOARD wAPR-2nD (wAP R)";

	aliases {
		led-boot = &led_rssilow;
		led-failsafe = &led_rssilow;
		led-upgrade = &led_rssilow;
		led-running = &led_rssilow;

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";

		led_rssilow: rssilow {
			label = "green:rssilow";
			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;

		rssimedium {
			label = "green:rssimedium";
			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;

		rssihigh {
			label = "green:rssihigh";
			gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;

		wlan {
			label = "green:wlan";
			gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "phy0tpt";

	gpio-export {
		compatible = "gpio-export";

		minipcie {
			gpio-export,name = "minipcie";
			gpio-export,output = <1>;
			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;

&eth0 {
	status = "okay";

	phy-handle = <&swphy0>;

	gmac-config {
		device = <&gmac>;
		switch-phy-swap = <1>;

&eth1 {
	compatible = "syscon", "simple-mfd";

&pcie0 {
	status = "okay";

&usb_phy {
	status = "okay";

	status = "okay";

Here is a link to the openwrt image builder that I built that includes the kernel with the DTS modifications. OPENWRT Image builder Much easier than building from source. Here is the image builder command that I used to build the firmware (It does expose ttyd on a http port and includes socat) to issue AT commands to the modem. Don't forget to set the modem to USB2 mode. The mikrotik board used doesn't support USB3. Good Luck.

make image PROFILE=mikrotik_routerboard-wapr-2nd \
PACKAGES="base-files busybox ca-bundle cgi-io dbus dnsmasq dropbear \
firewall fstools fwtool getrandom glib2 ip6tables ip6tables-extra \
iptables iptables-mod-conntrack-extra iptables-mod-ipopt jshn \
jsonfilter  kernel kmod-gpio-button-hotplug kmod-ifb kmod-ip6tables \
kmod-ip6tables-extra kmod-ipt-conntrack kmod-ipt-conntrack-extra \
kmod-ipt-core kmod-ipt-ipopt kmod-ipt-nat kmod-ipt-offload \
kmod-ipt-raw kmod-lib-crc-ccitt kmod-mii kmod-nf-conntrack \
kmod-nf-conntrack6 kmod-nf-flow kmod-nf-ipt kmod-nf-ipt6 \
kmod-nf-nat kmod-nf-reject kmod-nf-reject6 kmod-nls-base \
kmod-phy-ath79-usb kmod-slhc kmod-usb-core kmod-usb-ehci \
kmod-usb-net kmod-usb-net-cdc-mbim kmod-usb-net-cdc-ncm \
kmod-usb-net-qmi-wwan kmod-usb-ohci kmod-usb-serial kmod-usb-serial-option \
kmod-usb-serial-qualcomm kmod-usb-serial-sierrawireless kmod-usb-serial-wwan \
kmod-usb-wdm kmod-usb2 libattr libblobmsg-json libc libdbus \
libexpat libffi libgcc1 libip4tc2 libip6tc2 libiwinfo-lua \
libjson-c5 libjson-script liblua5.1.5 liblucihttp-lua liblucihttp0 \
libmbim libmnl0 libncurses6 libnl-tiny1 libpthread libqmi \
libqrtr-glib libubox libubus-lua libuci libuclient \
libustream-wolfssl libwolfssl libxtables12 logd lua luci \
luci-app-firewall luci-app-opkg luci-app-ttyd luci-base \
luci-compat luci-lib-base luci-lib-ip luci-lib-jsonc \
luci-lib-nixio luci-mod-admin-full luci-mod-network  luci-mod-status \
luci-mod-system luci-proto-ipv6 luci-proto-modemmanager luci-ssl \
luci-theme-bootstrap luci-theme-material modemmanager mtd netifd \
odhcp6c odhcpd-ipv6only openwrt-keyring opkg procd px5g-wolfssl \
rpcd rpcd-mod-file rpcd-mod-iwinfo rpcd-mod-luci rpcd-mod-rrdns \
rssileds swconfig socat tc-mod-iptables tc-tiny terminfo ttyd \
ubi-utils uboot-envtools ubox ubus ubusd uci uclient-fetch uhttpd \
uhttpd-mod-ubus urandom-seed urngd usign wpad-basic-wolfssl zlib"

Thanks for the device tree entries. My Quectel EP06-A is now operational.

Thanks again

No problem. Glad it worked out.

I have this same antenna. LHG-R without modem. What was the final way to get openwrt/Rooter installed on this device? ive tried the netinstall with tftp. the unit will boot from ram but as soon as i flash it to the rom it goes into a boot loop.

Anyone? I have also tried to netinstall the factory firmware but cat do that either.

Are you using the correct file. Should be mikrotik_routerboard-wapr-2nd-squashfs-sysupgrade.bin...That file should flash if tftp booted.

The wapr-2nd file won't have pcie or modem access unless you build it from source and modify the dts as posted above.

You also need to look on the Mikrotik site. There is a setting in the Router OS that needs to be set. "boot device" I think I set mine to nand-if-fail-then-ethernet.

So i have tried this one as well. but it didnt boot either. but what i did find was i can hold the reset button and let it boot and hit it one more time and it will boot. maybe safemode?

but im still unable to get it to boot without doing that.

Did you set the boot mode from router os before flashing openwrt? If not I believe it tries to boot from ethernet or ubi and never tries to boot from flash. That is your boot problem.

I have only set the boot mode from router os before flashing openwrt. You may be able to try 'rbcfg set boot_device ethnand' or 'rbcfg set boot_device nand' from openwrt. rbcfg is a utility for mikrotik while running openwrt and may need to be installed from opkg.

See https://wiki.mikrotik.com/wiki/Manual:RouterBOARD_settings if you didn't change boot-device before flashing openwrt you will have boot problems.

Ah. you might be on it! i did not change the boot before i went to openwrt. I dont have internet on the device so i think ill have to go back to mikrotik and start over?

i have tried to run opkg install rbcfg and it fails.

This is not correct.
The device comes from the factory set to boot from flash, then eth if that fails. Easiest way to install OpenWrt is to hold in the reset button for ~30 seconds (watch the LED patterns change, see the Mikrotik device guide and RouterBOOT directions to see what these patterns mean) to force netboot, and not change the RouterBOOT settings.

This tool is only available on very old OpenWrt. Now, these settings are accessible in /sys/firmware/mikrotik/soft_config. For OpenWrt master ath79, these settings now cannot be changed in OpenWrt. If you did change RouterBOOT settings in RouterOS, you can reset to default by holding reset button for >5 seconds, <10s at boot. Use LED patterns to confirm timing.

If you are holding in the reset button before applying power, the backup RouterBOOT is used.
If you had installed RouterOS v7, and updated (primary) RouterBOOT to v7, that will not boot OpenWrt from NOR (flash). You would need to netinstall a RouterOS v6, then upgrade (downgrade) RouterBOOT to v6. Reset the RouterBOOT settings first to make sure you are using BOOTP.

The snapshot wapr-2nd image should now include usb: https://github.com/openwrt/openwrt/commit/c29f71ece753d55ddf19a1b87d228499e5165190

So looking at this i did have routeros 7 beta installed before this openwrt. I didnt change the boot order just tftp openwrt (ROOter).
I have tried to install routeros again but failed as netinstall never sees the board. how do you make it where netinstall sees it?

i have have rbcfg installed. Dairyman over at the ROOter forum had a file that i dropped in openwrt. it works but it didnt survive a reboot (the settings)

Looking at the /sys/firmware/mikrotik/soft_config i do see the same settings. But im unable to change any of them. Ive tried to set the backup bootloader to see if it would boot.