I recently had to work out how to get a common laptop HSDPA (3G) Modem to work with the MT7620n SOC On OpenWRT. I used my all time favourite development board the WRTNode.
The card is an Ericsson F3307 mobile broadband card. It is PCI-e format, but not technically a PCI-e card. It runs on a USB bus, and uses the WWAN pins of the PCI-e slot. Some of the pins in the slot are reserved for connection to the SIM card. I purchased a mini PCI-E modem adapter similar to this one to allow connection to a regular USB port, and provide a SIM card slot.
The modem identifies itself as a USB CDC ethernet device, with 3x CDC ACM serial ports for control of dialing and connection. To use the modem we need to first bring up the ethernet interface, then the ACM serial interface, then instruct the modem to connect to the mobile network by controlling it over it’s serial interface.
First of all there are a few packages needed, so update the package repository:
opkg update
Install the following packages:
– comgt
– kmod-usb-net
– kmod-usb-net-cdc-ether
– kmod-usb-net-cdc-ncm
– kmod-usb-acm
opkg install comgt kmod-usb-net kmod-usb-net-cdc-ether kmod-usb-net-cdc-ncm kmod-usb-acm
If you have a custom kernel, then all the kmod’s need to be compiled in menuconfig for your given kernel. If you are using an OpenWrt prepackaged distribution
then you can just use the kmod’s from the repository.
Reboot with the modem plugged in to enable the ethernet port and the ttyACMx serial device control nodes.
To bring up the interface, create an entry in /etc/config/network like so:
config interface 'wwan'
option ifname 'wwan0'
option proto 'dhcp'
To start the modem, create a chat script in /etc/chatscripts/telstra.chat (If you use another provider, change the telstra.internet apn to whatever your provider uses.)
ABORT BUSY
ABORT 'NO CARRIER'
ABORT ERROR
TIMEOUT 10
'' AT+CFUN=6 OK
# UNCOMMENT THE NEXT LINE IF YOU HAVE A SIM PIN
#AT+CPIN? READY-AT+CPIN="1234"-PACSP0
\dAT+CPIN? READY \c OK
\dAT+CGDCONT=1,"IP","telstra.internet","0.0.0.0" OK
\dAT*EIAAUW=1,1,"blau","blau",00111,0 OK
\d\d\dAT*ENAP=1,1 OK
Then run this command to initiate the 3g connection:
/usr/sbin/chat -v -f /etc/chatscripts/telstra.chat >/dev/ttyACM0 </dev/ttyACM0
To stop the connection, create another chat script in /etc/chatsrcipts/telstra_stop.chat:
ABORT ERROR
TIMEOUT 5
'' AT+CFUN=4 OK
Then run this command:
/usr/sbin/chat -v -f /etc/chatscripts/telstra_stop.chat >/dev/ttyACM0 </dev/ttyACM0
I placed an init script in /etc/init.d/wwan with the following contents to bring the interface up on boot:
#!/bin/sh /etc/rc.common
# Copyright (C) 2016 FuturePoint Systems
START=50
STOP=50
start() {
/usr/sbin/chat -v -f /etc/chatscripts/telstra.chat >/dev/ttyACM0 </dev/ttyACM0
}
stop() {
/usr/sbin/chat -v -f /etc/chatscripts/telstra_stop.chat >/dev/ttyACM0 </dev/ttyACM0
}
and then linked into rc.d:
ln -s /etc/init.d/wwan /etc/rc.d/S50wwan
ln -s /etc/init.d/wwan /etc/rc.d/K50wwan
Now the modem comes up automatically on boot. I hope this is useful to you. Enjoy!