# Fibocom FM350-GL 5G Modem Configuration Guide Complete reference for configuring the Fibocom FM350-GL modem on Alpine Linux. ## Working Configuration | Setting | Value | |---------|-------| | **Modem** | Fibocom FM350-GL | | **USB ID** | 0e8d:7126 (Mode 40) | | **AT Port** | /dev/ttyUSB1 | | **Network Interface** | eth1 (RNDIS) | | **APN** | internet (CYTA Cyprus) | ## AT Command Reference ### Sending AT Commands The FM350-GL doesn't need `stty` configuration. Send commands directly: ```bash # Pattern for sending AT commands cat /dev/ttyUSB1 & CAT_PID=$! sleep 0.3 echo -e 'YOUR_COMMAND\r' > /dev/ttyUSB1 sleep 2 kill $CAT_PID 2>/dev/null ``` ### Essential Commands | Command | Purpose | Example Response | |---------|---------|------------------| | `AT` | Test communication | `OK` | | `AT+CGMI` | Manufacturer | `Fibocom Wireless Inc.` | | `AT+CGMM` | Model | `FM350-GL` | | `AT+CSQ` | Signal strength | `+CSQ: 7, 99` (7 = moderate) | | `AT+CREG?` | Network registration | `+CREG: 0,1` (1 = registered) | | `AT+CEREG?` | LTE/5G registration | `+CEREG: 0,1` | | `AT+CCID` | SIM card ID | `+CCID: 893570...` | ### APN Configuration ```bash # Set APN (CYTA Cyprus uses "internet") echo -e 'AT+CGDCONT=1,"IP","internet"\r' > /dev/ttyUSB1 # Verify APN is set echo -e 'AT+CGDCONT?\r' > /dev/ttyUSB1 # Response: +CGDCONT: 1,"IP","internet",""... ``` ### Connection Management ```bash # Activate PDP context (start data connection) echo -e 'AT+CGACT=1,1\r' > /dev/ttyUSB1 # Response: +CGEV: ME PDN ACT 1, OK # Get assigned IP address echo -e 'AT+CGPADDR=1\r' > /dev/ttyUSB1 # Response: +CGPADDR: 1,"10.156.167.104","" # Get full connection details (DNS, MTU) echo -e 'AT+CGCONTRDP=1\r' > /dev/ttyUSB1 # Response includes DNS servers ``` ### USB Mode Control ```bash # Check current USB mode echo -e 'AT+GTUSBMODE?\r' > /dev/ttyUSB1 # Response: +GTUSBMODE: 40 # Available modes echo -e 'AT+GTUSBMODE=?\r' > /dev/ttyUSB1 # Response: +GTUSBMODE: (40,41) # Switch modes (requires modem reset) echo -e 'AT+GTUSBMODE=40\r' > /dev/ttyUSB1 # Reset modem echo -e 'AT+CFUN=1,1\r' > /dev/ttyUSB1 ``` ## USB Modes | Mode | USB Product ID | Description | AT Commands | |------|----------------|-------------|-------------| | 40 | 0e8d:7126 | RNDIS mode | ✅ Work on ttyUSB1 | | 41 | 0e8d:7127 | Extended mode | ❌ Don't work | **Important:** Stay in Mode 40 for reliable AT command access. ## Network Interface Configuration ### Why DHCP Doesn't Work The RNDIS interface (`eth1`) does **not** provide DHCP. The modem manages the connection internally. You must: 1. Get the IP from the modem via `AT+CGPADDR=1` 2. Configure the interface manually ### Manual Configuration ```bash # Get IP from modem (replace with actual value) MODEM_IP="10.156.167.104" # Configure interface ip link set eth1 up ip addr flush dev eth1 ip addr add $MODEM_IP/32 dev eth1 ip route add default dev eth1 metric 50 # Test ping -c 3 8.8.8.8 ``` ## CYTA Cyprus Settings | Setting | Value | |---------|-------| | APN | `internet` | | DNS Primary | 195.14.130.220 | | DNS Secondary | 195.14.154.100 | | Network Name | Vodafone | ## Complete Connection Sequence ```bash #!/bin/sh # Full connection sequence for FM350-GL with CYTA SIM AT_PORT="/dev/ttyUSB1" APN="internet" # 1. Configure APN cat $AT_PORT & PID=$!; sleep 0.3 echo -e "AT+CGDCONT=1,\"IP\",\"$APN\"\r" > $AT_PORT sleep 2; kill $PID 2>/dev/null # 2. Activate connection cat $AT_PORT & PID=$!; sleep 0.3 echo -e "AT+CGACT=1,1\r" > $AT_PORT sleep 3; kill $PID 2>/dev/null # 3. Get IP address MODEM_IP=$(timeout 5 sh -c " cat $AT_PORT & PID=\$! sleep 0.3 echo -e 'AT+CGPADDR=1\r' > $AT_PORT sleep 2 kill \$PID 2>/dev/null " 2>&1 | grep CGPADDR | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1) echo "Modem IP: $MODEM_IP" # 4. Configure interface ip link set eth1 up ip addr flush dev eth1 ip addr add $MODEM_IP/32 dev eth1 ip route add default dev eth1 metric 50 # 5. Test ping -c 3 8.8.8.8 ``` ## Troubleshooting ### AT Commands Not Responding **Symptoms:** No response to AT commands on any port. **Solutions:** 1. Check modem is in Mode 40: `lsusb | grep 7126` 2. If in Mode 41 (7127), AT commands won't work - need physical access to switch back 3. Try different ports: ttyUSB0, ttyUSB1, ttyUSB2 ### ttyUSB3 Shows as Regular File **Symptoms:** `ls -la /dev/ttyUSB3` shows `-rw-r--r--` instead of `crw-rw----` **Fix:** ```bash rm -f /dev/ttyUSB3 mknod /dev/ttyUSB3 c 188 3 chmod 660 /dev/ttyUSB3 chown root:dialout /dev/ttyUSB3 ``` ### stty Errors **Symptoms:** `stty: /dev/ttyUSB1: cannot perform all requested operations` **Solution:** Don't use `stty`. Send AT commands directly with `echo` and `cat`. ### No IP on eth1 **Symptoms:** `ip addr show eth1` shows no inet address after DHCP attempt. **Solution:** RNDIS doesn't use DHCP. Configure IP manually from `AT+CGPADDR=1`. ### ModemManager Not Detecting Modem **Note:** ModemManager doesn't work well with this modem in RNDIS mode. Use AT commands directly instead. ### Signal Strength Interpretation | CSQ Value | dBm | Quality | |-----------|-----|---------| | 0 | -113 or less | No signal | | 1-9 | -111 to -95 | Poor | | 10-14 | -93 to -85 | Fair | | 15-19 | -83 to -75 | Good | | 20-30 | -73 to -53 | Excellent | | 31 | -51 or better | Excellent | | 99 | Unknown | - | ## Kernel Modules These modules should be loaded for MBIM/QMI support (optional): ```bash modprobe cdc-wdm modprobe cdc_mbim modprobe qmi_wwan modprobe cdc_ncm # Verify lsmod | grep -E '(cdc|qmi)' ``` ## Files on Device | Path | Purpose | |------|---------| | `/usr/local/bin/connect-5g.sh` | Auto-connection script | | `/etc/init.d/5g-router` | OpenRC service | | `/var/log/5g-router.log` | Connection log | | `/etc/iptables/rules.v4` | Firewall/NAT rules | ## Service Management ```bash # Check status service 5g-router status # Restart connection service 5g-router restart # View logs tail -f /var/log/5g-router.log # Check if enabled at boot rc-update show | grep 5g-router ```