simcom_wwan-setup
simcom_wwan-setup copied to clipboard
A guide and files for setting up the Waveshare SIM7600G-H Hat for Jetson Nano
[NO LLNGER MAINTAINED] Setup the Waveshare SIM7600G for Jetson Nano
NOTE: This repository is no longer being maintained. Please check most recently updated forks for your issue.
This guide is heavily adapted from the guide published on the waveshare site, available here.
Notes: There seem to be numerous errors and omissions in the instructions as provided by Waveshare. This guide documents my process so that others may avoid many wasted hours of effort. It turns out that you don't need udhcpc if you already have dhclient installed. You also don't need minicom or screen. There is a way to send and view serial using two terminal windows and built in commands cat and echo.
Assumptions
- Your host system is either Linux or OSX
- High degree of comfort with the commandline (i.e. compiling from source)
Requirements
- Jetson Nano B01
- Waveshare SIM7600G-H Hat for Jetson Nano
- Activated SIM with talk/text/data (Mint is tested and works)
- High-speed internet connection (for host and Jetson)
Hardware Setup
- Power off the Jetson Nano
- Install your activated SIM card in the holder on the underside of the SIM7600G-H hat.
- Install the SIM7600G-H hat by seating it firmly on the J-41 40-pin header making sure it's aligned properly.
- Connect the provided USB - micro USB adapter between the Nano and the hat.
- Remove the protective tape covering the
RXDandTXDdip switch to set them both toON - Power on the Jetson Nano.
- The
PWRindicator should come on. - After a moment, the
NETlight should start blinking.
- Log into your Jetson Nano over
sshand complete the rest of the steps.
Software Setup
$ sudo apt-get update$ sudo apt-get install p7zip python3-serial minicom Jetson.GPIO -y$ wget https://www.waveshare.com/w/upload/9/9b/SIM7600X_4G_for_JETSON_NANO.7z$ p7zip --uncompress SIM7600X_4G_for_JETSON_NANO.7z
Enable the Hardware (only necessary for testing before the kernel module is installed)
$ echo 200 > /sys/class/gpio/export$ echo out > /sys/class/gpio/gpio200/direction$ echo 1 > /sys/class/gpio/gpio200/value$ echo 0 > /sys/class/gpio/gpio200/value
Testing
Setting up minicom
NOTE: It's also possible (and possibly easier) to use screen. If you don't have time to deal with this, skip to the "Pure bash shell" instructions at the end of this section.
At this point, the instructions provided by Waveshare call for using minicom, but don't provide any hint that it needs to be setup. Instructions for setup can be found here and are summarized below.
$ sudo minicom -swill greet you with aconfigurationmenu
+-----[configuration]------+
| Filenames and paths |
| File transfer protocols |
| Serial port setup |
| Modem and dialing |
| Screen and keyboard |
| Save setup as dfl |
| Save setup as.. |
| Exit |
| Exit from Minicom |
+--------------------------+
- Arrow down to
Modem and Dialingand pressenter - Remove "Dialing prefix", "Dialing suffix", and "Hang-up string" entries to match:
+--------------------[Modem and dialing parameter setup]---------------------+
| |
| A - Init string ......... |
| B - Reset string ........ |
| C - Dialing prefix #1.... |
| D - Dialing suffix #1.... |
| E - Dialing prefix #2.... |
| F - Dialing suffix #2.... |
| G - Dialing prefix #3.... |
| H - Dialing suffix #3.... |
| I - Connect string ...... CONNECT |
| J - No connect strings .. NO CARRIER BUSY |
| NO DIALTONE VOICE |
| K - Hang-up string ...... |
| L - Dial cancel string .. ^M |
| |
| M - Dial time ........... 45 Q - Auto bps detect ..... No |
| N - Delay before redial . 2 R - Modem has DCD line .. Yes |
| O - Number of tries ..... 10 S - Status line shows ... DTE speed |
| P - DTR drop time (0=no). 1 T - Multi-line untag .... No |
| |
| Change which setting? Return or Esc to exit. Edit A+B to get defaults. |
+----------------------------------------------------------------------------+
- Escape to the
configurationmenu - Select
Screen and keyboardand pressenter. - Press
qto toggleLocal echotoYes - Escape to the
configurationmenu - Select
Save setup as dfland pressenter - Select
Exit from Minicomand pressenter
On To Testing
For a full list of commands, see the AT Command Manual.
With minicom
$ sudo minicom -D /dev/ttyUSB2- Enter
ATI - If you can't see your local echo, you may need to enable it:
- Press
ctrl+athenzto bring up the options menu. - Press
eto enable echo escto return to the console
- Press
ATI
Manufacturer: SIMCOM INCORPORATED
Model: SIMCOM_SIM7600G-H
Revision: SIM7600M22_V2.0
IMEI: 868822040061788
+GCAP: +CGSM
OK
With Python
$ cd SIM7600X_4G_for_JETSON_NANO/AT$ sudo python3 AT.py
If you wait long enough, you'll get the following output:
SIM7600X is ready
Please input the AT command:
- Enter
ATIto get product identification info:
Please input the AT command:ATI
Manufacturer: SIMCOM INCORPORATED
Model: SIMCOM_SIM7600G-H
Revision: SIM7600M22_V2.0
IMEI: 868822040061788
+GCAP: +CGSM
OK
Pure bash shell
sshinto your Jetson Nano.- Start listening to the SIM7600G-H serial device:
$ cat < /dev/ttyUSB2 - Open a second terminal window and
sshinto your Jetson Nano and complete the following steps. - Switch to root user:
$ sudo su - Send a request for product identification info:
# echo -e 'ATI\r' > /dev/ttyUSB2 - Now check the first terminal window for the output.
4G connection
Download
$ cd$ mkdir Simcom_wwan$ cd Simcom_wwan$ wget https://www.waveshare.com/w/upload/4/46/Simcom_wwan.zip$ unzip Simcom_wwan.zip
Compile, and Install Driver
Got help figuring this one out from here.
- Modify the Makefile (basically rewrite it):
$ nano Makefile
obj-m:=simcom_wwan.o
simcom_wwanmodule-objs:=module
MAKE:=make
PWD=$(shell pwd)
VER=$(shell uname -r)
KERNEL_BUILD=/lib/modules/$(VER)/build
INSTALL_ROOT=/
default:
$(MAKE) -C $(KERNEL_BUILD) M=$(PWD) modules
clean:
$(MAKE) -C $(KERNEL_BUILD) M=$(PWD) clean
install:
$(MAKE) -C $(KERNEL_BUILD) M=$(PWD) INSTALL_MOD_PATH=$(INSTALL_ROOT) modules_install
- Press
ctrl+xthenythenenterto save and exit. $ sudo make clean$ sudo make$ sudo make install- note: try
sudo make install ./simcom*.* /lib/modules/4.9.140-tegraon the latest image release if the above fails.
- note: try
$ sudo depmod$ sudo modprobe -v simcom_wwan- Check for
simcom_wwanto confirm successful installation:$ sudo lsmod - Check kernel messages for successful installation:
$ sudo dmesg | grep simcom
[ 1689.111826] simcom_wwan: loading out-of-tree module taints kernel.
[ 1689.122659] simcom usbnet bind here
[ 1689.125414] simcom_wwan 1-2.3:1.5 wwan0: register 'simcom_wwan' at usb-70090000.xusb-2.3, SIMCOM wwan/QMI device, f6:2d:53:fe:c8:5c
[ 1689.125486] usbcore: registered new interface driver simcom_wwan
Setup Network Interface wwan0
- Check if the
wwan0interface is present:$ ifconfig wwan0 - Enable the
wwan0interface:$ sudo ifconfig wwan0 up - Switch to root user:
$ sudo su - Define network mode as automatic:
# echo -e 'AT+CNMP=2\r' > /dev/ttyUSB2 - Connect the NIC to the network:
# echo -e 'AT$QCRMCALL=1,1\r' > /dev/ttyUSB2 - Allocate IP:
$ sudo dhclient -1 -v wwan0
Now you can use 4G network!
Installing as systemd service
There are scripts included in this repo that allow you to install 4G connectivity at boot using systemd service files, a preup script and a poststop script to automate the steps in the "Setup Network Interface wwan0" section above.
It's recommended that you clone the repo locally on the Jetson Nano.
$ git clone https://github.com/phillipdavidstearns/simcom_wwan-setup.git$ cd simcom_wwan-setup$ chmod +x install.sh uninstall.sh update.sh- To install:
$ sudo ./install.sh - To uninstall:
$ sudo ./uninstall.sh - To update:
$ git pull; sudo ./update.sh
- This service is disabled by default and will not start at boot.
- To enable, run
$ sudo systemctl enable [email protected] - To disable, run
$ sudo systemctl disable [email protected] - To start the service and 4G LTE connectivity:
$ sudo systemctl start [email protected] - To stop the service and 4G LTE connectivity:
$ sudo systemctl stop [email protected] - To check the status of the service:
$ sudo systemctl status [email protected]
To make sure the Jetson Nano loads the simcom_wwan kernel module driver:
$ sudo nano /etc/modules-load.d/modules.conf- Add
simcom_wwanto this file if it's not already there. - Ctrl-X, Y, Enter (Save and close)
To make the sim_comwwan@wwan0 service wait for the USB device:
$ sudo nano /etc/udev/rules.d/99-usb-4g.rules- Add the line:
SUBSYSTEM=="tty", KERNEL=="ttyUSB2", TAG+="systemd", ENV{SYSTEMD_WANTS}+="[email protected]" - Ctrl-X, Y, Enter (Save and close)
Test the changes
$ sudo reboot