Adding support for MikroTik hAP ac3 LTE6 kit (D53GR_5HacD2HnD)

Can it be that we are still missing some USB config from the DTS? For now the usb-power-off and mpcie-power-off GPIOs will remain ACTIVE_HIGH if noone has an objection.

@robimarko if and when you have a bit of time and have an idea what you want me to try, or you need data from the device running ROS, please let me know.

What you need to do is remove those hogs and use gpiod tools to manually experiment with the USB power as well with various reset pins

What I tried quickly is that I changed the usb_power and mpcie_power pins from active_high to active_low and in this case even the user facing USB port stopped working.

manually experiment with the USB power as well with various reset pins

OK, I understand this part. Question is: can we narrow this down in any way by reading values under ROS for example?

I dont think they have debugfs, so you have no way really of reading the pin values

You mean these readouts are useless/not accurate?

Oh, so they are actually exporting them, that's new.

I assume they are correct

The interesting thing is for the USB power (GPIO 44) they set it to active_low, but if I do the same the USB port stops working. I assume this means other pins also needs to be set or set differently?

Some more data:

/sys/class/gpio # ls -l
total 0
button -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/button
export
gpiochip0 -> ../../devices/platform/soc/1000000.pinctrl/gpio/gpiochip0
led1 -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/led1
led2 -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/led2
led3 -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/led3
led4 -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/led4
led5 -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/led5
lte-ant-sw1 -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/lte-ant-sw1
lte-ant-sw2 -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/lte-ant-sw2
lte-reset -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/lte-reset
mode-button -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/mode-button
mpcie-power-off -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/mpcie-power-off
poe-led -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/poe-led
system-eth-led -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/system-eth-led
system-led:blue -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/system-led:blue
system-led:green -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/system-led:green
system-led:red -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/system-led:red
system-wlan-led -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/system-wlan-led
unexport
usb-power-off -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/usb-power-off
wps-button -> ../../devices/platform/soc/1000000.pinctrl/gpiochip0/gpio/wps-button

I am not entirely sure what other GPIOs can be interesting to toggle, maybe the ones we need are not even present in this list and ROS sets them internally?

@robimarko some good news: the modem finally works.

root@OpenWrt:/# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux 5.15.68 xhci-hcd xHCI Host Controller
Bus 004 Device 001: ID 1d6b:0003 Linux 5.15.68 xhci-hcd xHCI Host Controller
Bus 001 Device 003: ID 2cd2:0004 MikroTik R11e-LTE6
Bus 001 Device 001: ID 1d6b:0002 Linux 5.15.68 xhci-hcd xHCI Host Controller
Bus 003 Device 001: ID 1d6b:0002 Linux 5.15.68 xhci-hcd xHCI Host Controller

I already tried on the ttyACM0 serial line and the modem responds.

Some more checks will follow (SIM card, data session etc.), but at least the device is reachable via USB.

This was the missing part in the DTS:

                usb3@8af8800 {
                        status = "okay";
                };
2 Likes

Good to hear that

I pushed the latest modifications if anyone wants to take a look:

1 Like

Hm... Strange thing is that the modem is not willing to connect to any network. When I try to do a network search via serial (AT+COPS=?) nothing comes up but an error after 2 minutes (+CME ERROR: 0)

The modem does detect the SIM correctly as the IMSI and ICCID are both readable and correct.

Another interesting thing is that this modem supports serial and MBIM according to MikroTik, yet the MBIM interface is not coming up despite the fact the MBIM driver is loaded.Maybe we need to add the modem's vendor and device ids?

MOD: a Quectel EC25 is fully functional in the same slot, modem attaches to LTE just fine, so the mPCI-E slot does work correctly. It seems MikroTik does some trick even with the modem initialization...

OK. So more findings:

It seems the MikroTik LTE modem's default state is "flight mode", this can be verified by issuing:

at+cfun?
+CFUN: 4

OK

CFUN=4 is flight mode.

Issuing AT+CFUN=1 the modem goes to full power mode, and network attach will happen:

AT+CFUN=1
+CPAS: 2

OK

*RADIOPOWER: 1

+CESQ: 99,99,255,255,255,255

*CESQ: 99,99,255,255,255,255,0

+CEREG: 1,"0001","0007d03d",7

+CGREG: 0

+CIREPI: 1

+CESQ: 63,99,255,255,24,84

*CESQ: 63,99,255,255,24,84,34

+CPAS: 0

+CREG: 1,"0001","0007d03d",7

$CREG: 1,"0001","0007d03d",7,"03d"

+CSQ: 31,99

+CESQ: 63,99,255,255,24,84

*CESQ: 63,99,255,255,24,84,34

+CEN1: 1, 101, 10

+CNEC_ESM: 50,5

+CGEV: EPS PDN ACT 5

*COPN:0,TestLTE

+ZNITZ: 2022,09,23,20,10,53,32,0

+NITZ: 0,+8,22/09/23,18:10:53

And again, an EC25 modem was working just fine in the same slot, so it is not likely that this is a pin control issue....

This should never be necessary. The driver will match oi the interface class/subclass/protocol if it is MBIM.

I believe the OEM firmware used the modem in RNDIS mode, ref the

[  410.946089] rndis_host 1-1:1.0 wwan0: register 'rndis_host' at usb-xhci-hcd.0.auto-1, RNDIS device, ac:50:43:1a:ee:fd

you posted earlier. Could you post the output of

cat /sys/kernel/debug/usb/devices

? This will tell us which configurations and functions the modem supports.

root@OpenWrt:~# cat /sys/kernel/debug/usb/devices

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 5.15
S:  Manufacturer=Linux 5.15.67 xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=xhci-hcd.0.auto
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  5 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=2cd2 ProdID=0004 Rev=ff.ff
S:  Manufacturer=MikroTik
S:  Product=R11e-LTE6
S:  SerialNumber=000000000000
C:* #Ifs= 8 Cfg#= 1 Atr=e0 MxPwr=  2mA
A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=03
A:  FirstIf#= 2 IfCount= 2 Cls=02(comm.) Sub=02 Prot=01
A:  FirstIf#= 4 IfCount= 2 Cls=02(comm.) Sub=02 Prot=01
I:* If#= 0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=(none)
E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=1ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=cdc_acm
E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=cdc_acm
E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:* If#= 5 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 6 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=ff Driver=(none)
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 7 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=ff Driver=(none)
E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=5000 MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 3.00 Cls=09(hub  ) Sub=00 Prot=03 MxPS= 9 #Cfgs=  1
P:  Vendor=1d6b ProdID=0003 Rev= 5.15
S:  Manufacturer=Linux 5.15.67 xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=xhci-hcd.0.auto
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 5.15
S:  Manufacturer=Linux 5.15.67 xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=xhci-hcd.1.auto
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=04 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=5000 MxCh= 0
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 3.00 Cls=09(hub  ) Sub=00 Prot=03 MxPS= 9 #Cfgs=  1
P:  Vendor=1d6b ProdID=0003 Rev= 5.15
S:  Manufacturer=Linux 5.15.67 xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=xhci-hcd.1.auto
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

So this in in RNDIS mode I guess.... Is there a way to switch it to MBIM?

If there is, then it is well hidden. Only one visible configuration. I guess only Mikrotik knows. But the fact that their own OS uses RNDIS is a strong indication that we should as well. It's what they've tested...

OK, I will compile an image with RNDIS enabled.... TO be honest I never used RNDIS, and the modems I encountered can be set to MBIM or QMI easily via AT command.

Btw, after issuing AT+CFUN=1 the /dev/ttyACM0 interface can be used for dialup, and it works.

1 Like

From a pull request point of view: what is the standard procedure? If we have an in-built LTE modem, the base image should contain the necessary drivers and tools for the modem to work? Another question is how to handle this AT+CFUN=1 necessity from a packaging point of view?

@bmork I set up the RNDIS dependencies, interface came up, when I set up a DHCP client on the RNDIS interface it gives me an internal IP (?) instead of the one assigned by the mobile operator. And it is not able to forward traffic towards the internet. Is this the expected behavior? :slight_smile:

[ 1681.207387] rndis_host 1-1:1.0 eth2: register 'rndis_host' at usb-xhci-hcd.0.auto-1, RNDIS device, ac:50:43:1a:ee:fd

eth2      Link encap:Ethernet  HWaddr AC:50:43:1A:EE:FD
          inet addr:192.168.1.139  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::ae50:43ff:fe1a:eefd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:41 errors:0 dropped:0 overruns:0 frame:0
          TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3610 (3.5 KiB)  TX bytes:8224 (8.0 KiB)