Mikrotik R11e-LTE-US with Openwrt

Hi Everyone,
Just thought I would start a thread to document this, as I couldn't find any information about this online.
This device requires both kmod-usb-acm and kmod-usb-net-cdc-ether.
When setup, it presents itself as two serial ports, and a ethernet device, in my case
/dev/ttyACM0
/dev/ttyACM1
and usb0 for the ethernet interface.

to get this device to connect, it needs to be initialized using AT commands. I haven't created a proper script for this, but this is what seams to work

AT E0 V1 

AT+CFUN=1,1 

AT E0 V1 

AT+GMI 

AT+GMM 

AT+GMR 

AT+CGSN 

AT+CFUN=4 

AT+CMEE=1 

AT+CREG=2 

AT+CGREG=2 

AT+CEREG=2 

AT+CGEREP=2,0 

AT+CMGF=0 

AT+CNMI=1,1,0,1,0 

AT+CFUN=1 

AT+CPIN? 

AT+CPMS="SM","SM","SM" 

AT+CFUN? 

AT+CNUM 

AT+CIMI 

AT+CPIN? 

AT+COPS=0 

AT+CGDCONT=1,"IP","pda.bell.ca" 

AT$QCPDPP=1,0 

AT+CEREG=2 

AT+COPS? 

AT+CFUN? 

AT+CSQ 

AT+COPS? 

AT+CFUN? 

QAT$QCRSRP? 

QAT$QCRSRQ? 

at$ecmcall=1 

at$ecmcall? 

AT+CGCONTRDP=1 

You should of course replace pda.bell.ca with the APN of your carrier.
After initializing the device with the AT commands, you can get an address on usb0 using dhcp.

I have gotten this working properly with a couple of edits to comgt-directip.

/lib/netifd/proto/directip.sh

#!/bin/sh

[ -n "$INCLUDE_ONLY" ] || {
        . /lib/functions.sh
        . ../netifd-proto.sh
        init_proto "$@"
}

proto_directip_init_config() {
        available=1
        no_device=1
        proto_config_add_string "device:device"
        proto_config_add_string "apn"
        proto_config_add_string "pincode"
        proto_config_add_string "auth"
        proto_config_add_string "username"
        proto_config_add_string "password"
        proto_config_add_defaults
        proto_config_add_string "ifname"
}

proto_directip_setup() {
        local interface="$1"
        local chat devpath devname

        local device apn pincode ifname auth username password ifname $PROTO_DEFAULT_OPTIONS
        json_get_vars device apn pincode auth username password ifname $PROTO_DEFAULT_OPTIONS

        [ -n "$ctl_device" ] && device=$ctl_device

        device="$(readlink -f $device)"
        [ -e "$device" ] || {
                proto_notify_error "$interface" NO_DEVICE
                proto_set_available "$interface" 0
                return 1
        }


        #devname="$(basename "$device")"
        #devpath="$(readlink -f /sys/class/tty/$devname/device)"
        #ifname="$( ls "$devpath"/../../*/net )"

        [ -n "$ifname" ] || {
                proto_notify_error "$interface" NO_IFNAME
                proto_set_available "$interface" 0
                return 1
        }

        gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | grep -q "MikroTik" || {
                proto_notify_error "$interface" BAD_DEVICE
                proto_block_restart "$interface"
                return 1
        }
        logger -p daemon.info -t "directip[$$]" "ConHCP"

        if [ -n "$pincode" ]; then
                PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
                        proto_notify_error "$interface" PIN_FAILED
                        proto_block_restart "$interface"
                        return 1
                }
        fi
        # wait for carrier to avoid firmware stability bugs
        gcom -d "$device" -s /etc/gcom/getcarrier.gcom || return 1

        local auth_type=0
        case $auth in
        pap) auth_type=1;;
        chap) auth_type=2;;
        esac

        logger -p daemon.info -t "directip[$$]" "ConHCP"

        USE_APN="$apn" USE_USER="$username" USE_PASS="$password" USE_AUTH="$auth_type" \
                        gcom -d "$device" -s /etc/gcom/directip.gcom || {
                proto_notify_error "$interface" CONNECT_FAILED
                proto_block_restart "$interface"
                return 1
        }

        logger -p daemon.info -t "directip[$$]" "Connected, starting DHCP"
        proto_init_update "$ifname" 1
        proto_send_update "$interface"

        json_init
        json_add_string name "${interface}_4"
        json_add_string ifname "@$interface"
        json_add_string proto "dhcp"
        proto_add_dynamic_defaults
        ubus call network add_dynamic "$(json_dump)"

        json_init
        json_add_string name "${interface}_6"
        json_add_string ifname "@$interface"
        json_add_string proto "dhcpv6"
        json_add_string extendprefix 1
        proto_add_dynamic_defaults
        ubus call network add_dynamic "$(json_dump)"

        return 0
}

proto_directip_teardown() {
        local interface="$1"

        local device
        json_get_vars device

        [ -n "$ctl_device" ] && device=$ctl_device

        gcom -d "$device" -s /etc/gcom/directip-stop.gcom || proto_notify_error "$interface" CONNECT_FAILED

        proto_init_update "*" 0
        proto_send_update "$interface"
}

[ -n "$INCLUDE_ONLY" ] || {
        add_protocol directip
}

/etc/gcom/directip.gcom


opengt
set com 115200n81
set comecho off
set senddelay 0.05
waitquiet 1 0.2

:start
 if $env("USE_AUTH") = "0" goto connect
 send "AT$QCPDPP=3,"
 send $env("USE_AUTH")
 send ",\""
 if $env("USE_USER") <> "" send $env("USE_USER")
 send "\",\""
 if $env("USE_PASS") <> "" send $env("USE_PASS")
 send "\"^m"
 waitfor 5 "OK"
 if % = 0 goto connect
 print "WWAN error. Auth failed.\r\n"
 exit 1

:connect
 send "AT+CFUN=1^m"
 send "AT+CGDCONT=1,\"IP\",\""
 send $env("USE_APN")
 send "\"^m"
 send "at$ecmcall=1^m"
 waitfor 5 "OK"
 if % = 0 goto dialok
 print "WWAN error. Connection failed.\r\n"
 exit 1

:carriererr
 print "WWAN error. No carrier.\r\n"
 exit 1

:dialok
 print "WWAN connection established.\r\n"
 exit 0

Way cool @silverchris !! I've got an RBM33G Routerboard and just place a R11e-LTE-US in miniPCIe slot 1 (leaving slot 0 for when my R11e-HacD card shows up). I've pulled my Verizon SIM from its Jetpack and popped it in. Booted and logged in via ssh, and just just ran a dmesg. Still not exactly sure where to begin. Completely new to OpenWRT, but a linux head no less. Are modding this scripts all there is to it?

@silverchris could I trouble you to elaborate on how you managed to get yours working? All AT commands I've send via minicom showed OK, except for one which returned No Service. I've set the APN to vzwinternet for Verizon.

When executing comgt -d /dev/ttyACM0 I get:
SIM ready
Waiting for Registation... 120 sec max.....
Failed to register

The SIM works fine in my Verizon Jetpack.

Stumped.. wee hours of the morning.

Waiting on pigtails and a 3dbi cellular antennae to show up, hopefully it will register then. Didn't think one would be needed but maybe so.

What command do you get no service on?

I also ran into my provider locking the SIM to a specific IMEI number, so I had to get them to update it to the LTE modems IMEI, which wouldn't let it register on the network.

Just seeing this, thanks! I'll look into that.