Coder Social home page Coder Social logo

simcom_wwan-setup's Introduction

Setup the Waveshare SIM7600G for Jetson Nano

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

  1. Power off the Jetson Nano
  2. Install your activated SIM card in the holder on the underside of the SIM7600G-H hat.
  3. Install the SIM7600G-H hat by seating it firmly on the J-41 40-pin header making sure it's aligned properly.
  4. Connect the provided USB - micro USB adapter between the Nano and the hat.
  5. Remove the protective tape covering the RXD and TXD dip switch to set them both to ON
  6. Power on the Jetson Nano.
  • The PWR indicator should come on.
  • After a moment, the NET light should start blinking.
  1. Log into your Jetson Nano over ssh and complete the rest of the steps.

Software Setup

  1. $ sudo apt-get update
  2. $ sudo apt-get install p7zip python3-serial minicom Jetson.GPIO -y
  3. $ wget https://www.waveshare.com/w/upload/9/9b/SIM7600X_4G_for_JETSON_NANO.7z
  4. $ p7zip --uncompress SIM7600X_4G_for_JETSON_NANO.7z

Enable the Hardware (only necessary for testing before the kernel module is installed)

  1. $ echo 200 > /sys/class/gpio/export
  2. $ echo out > /sys/class/gpio/gpio200/direction
  3. $ echo 1 > /sys/class/gpio/gpio200/value
  4. $ 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.

  1. $ sudo minicom -s will greet you with a configuration menu
            +-----[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        |
            +--------------------------+
  1. Arrow down to Modem and Dialing and press enter
  2. 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. |
 +----------------------------------------------------------------------------+
  1. Escape to the configuration menu
  2. Select Screen and keyboard and press enter.
  3. Press q to toggle Local echo to Yes
  4. Escape to the configuration menu
  5. Select Save setup as dfl and press enter
  6. Select Exit from Minicom and press enter

On To Testing

For a full list of commands, see the AT Command Manual.

With minicom

  1. $ sudo minicom -D /dev/ttyUSB2
  2. Enter ATI
  3. If you can't see your local echo, you may need to enable it:
    1. Press ctrl+a then z to bring up the options menu.
    2. Press e to enable echo
    3. esc to return to the console
ATI

Manufacturer: SIMCOM INCORPORATED
Model: SIMCOM_SIM7600G-H
Revision: SIM7600M22_V2.0
IMEI: 868822040061788
+GCAP: +CGSM

OK

With Python

  1. $ cd SIM7600X_4G_for_JETSON_NANO/AT
  2. $ sudo python3 AT.py

If you wait long enough, you'll get the following output:

SIM7600X is ready
Please input the AT command:
  1. Enter ATI to 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

  1. ssh into your Jetson Nano.
  2. Start listening to the SIM7600G-H serial device: $ cat < /dev/ttyUSB2
  3. Open a second terminal window and ssh into your Jetson Nano and complete the following steps.
  4. Switch to root user: $ sudo su
  5. Send a request for product identification info: # echo -e 'ATI\r' > /dev/ttyUSB2
  6. Now check the first terminal window for the output.

4G connection

Download

  1. $ cd
  2. $ mkdir Simcom_wwan
  3. $ cd Simcom_wwan
  4. $ wget https://www.waveshare.com/w/upload/4/46/Simcom_wwan.zip
  5. $ unzip Simcom_wwan.zip

Compile, and Install Driver

Got help figuring this one out from here.

  1. 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
  1. Press ctrl+x then y then enter to save and exit.
  2. $ sudo make clean
  3. $ sudo make
  4. $ sudo make install
    • note: try sudo make install ./simcom*.* /lib/modules/4.9.140-tegra on the latest image release if the above fails.
  5. $ sudo depmod
  6. $ sudo modprobe -v simcom_wwan
  7. Check for simcom_wwan to confirm successful installation: $ sudo lsmod
  8. 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

  1. Check if the wwan0 interface is present: $ ifconfig wwan0
  2. Enable the wwan0 interface: $ sudo ifconfig wwan0 up
  3. Switch to root user: $ sudo su
  4. Define network mode as automatic: # echo -e 'AT+CNMP=2\r' > /dev/ttyUSB2
  5. Connect the NIC to the network: # echo -e 'AT$QCRMCALL=1,1\r' > /dev/ttyUSB2
  6. 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.

  1. $ git clone https://github.com/phillipdavidstearns/simcom_wwan-setup.git
  2. $ cd simcom_wwan-setup
  3. $ chmod +x install.sh uninstall.sh update.sh
  4. To install: $ sudo ./install.sh
  5. To uninstall: $ sudo ./uninstall.sh
  6. To update: $ git pull; sudo ./update.sh

To make sure the Jetson Nano loads the simcom_wwan kernel module driver:

  1. $ sudo nano /etc/modules-load.d/modules.conf
  2. Add simcom_wwan to this file if it's not already there.
  3. Ctrl-X, Y, Enter (Save and close)

To make the sim_comwwan@wwan0 service wait for the USB device:

  1. $ sudo nano /etc/udev/rules.d/99-usb-4g.rules
  2. Add the line: SUBSYSTEM=="tty", KERNEL=="ttyUSB2", TAG+="systemd", ENV{SYSTEMD_WANTS}+="[email protected]"
  3. Ctrl-X, Y, Enter (Save and close)

Test the changes

  1. $ sudo reboot

simcom_wwan-setup's People

Contributors

phillipdavidstearns avatar shaynem avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.