SIM7600 Series Open Linux Development Guide V2.00 (1)
SIM7600 Series Open Linux Development Guide V2.00 (1)
SIM7600 Series Open Linux Development Guide V2.00 (1)
Linux_Development Guide
LTE Module
GENERAL NOTES
COPYRIGHT
www.simcom.com 2 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Version History
www.simcom.com 3 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 4 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Contents
Version History..................................................................................................................................... 3
This document applies to the following products...................................................................... 4
Contents................................................................................................................................................. 5
Abbreviation........................................................................................................................................10
1 SIM7600 Development Platform Overview........................................................................... 11
1.1 System Overview.................................................................................................................................. 11
1.2 Open Linux selection and function.....................................................................................................12
1.3 Open Linux related PIN definition...................................................................................................... 13
3. Programming Guide...................................................................................................................30
3.1 System basic API.................................................................................................................................. 30
3.2 Embedded AT transceiver................................................................................................................... 30
3.2.1 Send AT command interface.......................................................................................................30
3.3 UART.......................................................................................................................................................30
3.4 GPIO....................................................................................................................................................... 31
3.5 ADC......................................................................................................................................................... 34
3.6 I2C........................................................................................................................................................... 34
3.6.1 Write I2C interface........................................................................................................................ 34
3.6.2 Read I2C interface........................................................................................................................34
3.7 SD Card/EMMC flash...........................................................................................................................35
3.7.1 Partition...........................................................................................................................................35
3.7.2 Format.............................................................................................................................................35
www.simcom.com 5 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.7.3 Mount.............................................................................................................................................. 35
3.7.4 CFDISK Command.......................................................................................................................35
3.8 UIM.......................................................................................................................................................... 37
3.8.1 Check SIM card status.................................................................................................................37
3.8.2 Query SIM card ICCID................................................................................................................. 37
3.8.3 Query SIM card IMSI....................................................................................................................38
3.9 SMS.........................................................................................................................................................38
3.9.1 SMS initialization...........................................................................................................................38
3.9.2 Set receive SMS format...............................................................................................................38
3.9.3 Send messages............................................................................................................................ 39
3.9.4 Callback function handles message reception........................................................................ 39
3.10 Voice Call............................................................................................................................................... 40
3.10.1 Phone initialization........................................................................................................................40
3.10.2 Dial number....................................................................................................................................40
3.10.3 Handle current call........................................................................................................................40
3.10.4 Get the status of the specified call.............................................................................................41
3.10.5 Get all call states...........................................................................................................................41
3.10.6 Callback..........................................................................................................................................42
3.11 NAS......................................................................................................................................................... 42
3.11.1 Query registration network status.............................................................................................. 43
3.11.2 Query signal...................................................................................................................................44
3.12 WDS........................................................................................................................................................ 44
3.12.1 Query APN..................................................................................................................................... 44
3.12.2 Set APN.......................................................................................................................................... 44
3.13 Data Call.................................................................................................................................................45
3.13.1 Initialize the network.....................................................................................................................45
3.13.2 Create data link............................................................................................................................. 45
3.13.3 Get data link parameters............................................................................................................. 46
3.13.4 Release network resources........................................................................................................ 46
3.14 GNSS...................................................................................................................................................... 46
3.14.1 Initialize gnss................................................................................................................................. 47
3.14.2 EnableXTRA.................................................................................................................................. 47
3.14.3 Prohibit XTRA................................................................................................................................47
3.14.4 GNSS Cold Start...........................................................................................................................47
3.14.5 GNSS Hot Start.............................................................................................................................48
3.14.6 GPS Stop....................................................................................................................................... 48
3.14.7 Callback function output brief location information................................................................. 48
3.14.8 Callback function output NMEA statement...............................................................................49
3.15 WIFI......................................................................................................................................................... 49
3.15.1 Get current WIFI mode settings (for W58)............................................................................... 50
3.15.2 Set WIFI mode (for W58)............................................................................................................ 50
3.15.3 WIFI Power.................................................................................................................................... 51
3.15.4 Get WIFI status............................................................................................................................. 51
3.15.5 Set WIFI hotspot name................................................................................................................ 51
3.15.6 Get WIFI hotspot name................................................................................................................52
www.simcom.com 6 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 7 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 8 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 9 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Abbreviation
AT ATtention; the two-character abbreviation is used to start a command line to be sent from
TE/DTE to TA/DCE
DCE Data Communication Equipment; Data Circuit terminating Equipment
DCS Digital Cellular Network
DTE Data Terminal Equipment
DTMF Dual Tone Multi–Frequency
EDGE Enhanced Data GSM Environment
EGPRS Enhanced General Packet Radio Service
GPIO General–Purpose Input/Output
GPRS General Packet Radio Service
GSM Global System for Mobile communications
HSDPA High Speed Downlink Packet Access
HSUPA High Speed Uplink Packet Access
I2C Inter–Integrated Circuit
IMEI International Mobile station Equipment Identity
IMSI International Mobile Subscriber Identity
ME Mobile Equipment
MO Mobile–Originated
MS Mobile Station
MT Mobile–Terminated; Mobile Termination
PCS Personal Communication System
PIN Personal Identification Number
PUK Personal Unlock Key
SIM Subscriber Identity Module
SMS Short Message Service
SMS–SC Short Message Service–ServiceCenter
TA Terminal Adaptor; e.g. a data card (equal to DCE)
TE Terminal Equipment; e.g. a computer (equal to DTE)
UE User Equipment
UMTS Universal Mobile Telecommunications System
USIM Universal Subscriber Identity Module
WCDMA Wideband Code Division Multiple Access
FTP File Transfer Protocol
HTTP Hyper Text Transfer Protocol
RTC Real Time Clock
NAS Network Access Service
WDS Wireless Data Service
QMI Qualcomm Messaging Interface
www.simcom.com 10 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
The development platform of SIM7600 module is Linux system, its frame is as follows:
The SIM7600 is based on the ARM Cotex-A7 1.3GHz CPU and runs the Linux operating system. The kernel
version is 3.18.20. The file system uses the UBIFS file system. The Linux-managed ubi file system contains
three logical partitions:
-ubi0:rootfs:
The rootfs logical partition is read-only and holds the Linux code.
-ubi0:usrfs:
Usrfs stores the Linux file system, which is generally used for Open Linux of user applications on this
partition.
-ubi0:cachefs:
Cachefs is generally used for FOTA upgrades. If there is not enough cache space during the upgrade, the
upgrade program will release some of the space for FOTA upgrade by deleting unopened files. So for
security reasons, it is best not to put the user's data on the cache partition.
Mounted
Filesystem Size Used Available Use%
on
www.simcom.com 11 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
According to the needs of the market, we have introduced several models of 4G modules that support
Open Linux. Customers can choose the best cost-effective solution based on their own product definition.
Specific support functions are as follows:
SIM7600E-H
Platform MDM9x07
Memory(bit) 2+2
Protocols TCP/IP/IPV4/IPV6/Multi PDP/FTPS/HTTPS/DNS/COAP/MQTT
CALL .
ECALL .
SMS .
TLS1.2 .
Audio Record/Play .
TTS .
DTMF .
LBS .
FOTA .
Security
Routing policy 4G,WIFI and Ehternet port
NDIS/RNDIS .
Bluetooth BLE4.2(External w58 module)
WIFI 2.4G(External w58 module)
GNSS GPS/GLONASS/BEIDOU
SGMII HSCI turn to LAN9730(100M)
UART 2* High UARTs
USB2.0 .
OTG .
HSIC .
Audio PCM 1*PCM
1input+1output
Audio Analog
(Common access with PCM)
GPIO At least 5*GPIO
www.simcom.com 12 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
SIM7600E-H
PI
Wakeup
N SYS Default Function
PINNAME Function2 Pull Interrup
No GPIO No. Function 1
t
.
6 SPI_CLK -- B-P
UART1_RTS -- --
D
7 SPI_MISO -- B-P
UART1_RX -- --
D
8 SPI_MOSI -- B-P
UART1_TX -- --
D
B-P
9 SPI_CS -- UART1_CTS -- --
D
B-P
21 SD_CMD -- SD Card -- --
D
B-P
22 SD_DATA0 -- SD Card -- --
D
B-P
23 SD_DATA1 -- SD Card -- --
D
B-P
24 SD_DATA2 -- SD Card -- --
D
B-P
25 SD_DATA3 -- SD Card -- --
D
B-N
26 SD_CLK -- SD Card -- --
P
SDIO_DATA B-P
27 -- WLAN -- --
1 D
SDIO_DATA B-P
28 -- WLAN -- --
2 D
B-P
29 SDIO_CMD -- WLAN -- --
D
SDIO_DATA B-P
30 -- WLAN -- --
0 D
www.simcom.com 13 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
SDIO_DATA B-P
31 -- WLAN -- --
3 D
B-N
32 SDIO_CLK -- WLAN -- --
P
GPIO_102 MIFI_POWER_E MIFI_POWER_E B-P
33 GPIO3 GPIO
0 N N U
GPIO_102 MIFI_SLEEP_CL MIFI_SLEEP_CL B-P
34 GPIO6 GPIO
3 K K D
46 ADC2 ADC --
B-P
47 ADC1 ADC
U
B-P
48 SD_DET GPIO_26 GPIO GPIO SD_DET
D
B-P
49 STATUS GPIO_52 Status GPIO Status
D
B-P
50 GPIO43 GPIO_36 MIFI_COEX GPIO MIFI_COEX
D
B-P
52 GPIO41 GPIO_79 BT GPIO BT *
D
B-P
55 SCL -- I2C_SCL -- --
D
B-P
56 SDA -- I2C_SDA -- --
U
B-P
66 RTS -- UART2_RTS -- --
D
B-P
67 CTS -- UART2_CTS -- --
D
B-P
68 RXD -- UART2_RX -- --
D
B-P
69 RI -- GPIO(RI) -- --
D
B-P
70 DCD -- GPIO -- --
D
B-P
71 TXD -- UART2_TX -- --
D
B-P
72 DTR -- GPIO(DTR) -- -- *
D
B-P
73 PCM_OUT -- PCM -- --
D
B-P
74 PCM_IN -- PCM -- --
D
B-P
75 PCM_SYNC -- PCM -- --
D
76 PCM_CLK -- PCM -- -- B-P
www.simcom.com 14 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
U
B-P
87 GPIO77 GPIO_77 BT GPIO BT
D
www.simcom.com 15 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Open Linux has both Windows and Linux environments. Customers can choose their own familiar
environment for development. If you only develop one application using Windows will be faster. If you are
concerned with Kernel changes, it is must use the Linux environment.
The development of SIM7600 is actually the development of embedded Linux. You can choose to build an
ARM-Linux compiler compatible with SIM7600 platform for compiling applications under the Windows
operating system.
Tools for installing applications for compiling SIM7600 under Windows system is Sourcery CodeBench for
ARM GNU/Linux
Download link:https://sourcery.mentor.com/public/gnu_toolchain/
Installation method:
www.simcom.com 16 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 17 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
In order to simplify the compilation of the application and facilitate the management of the application's code
engineering, it is recommended to compile the program using make. Cygwin's make program can be used
under Windows environment. Customers can download the free Cygwin from cygwin's official website.
After the installation, then add the Cygwin/bin/ path to the environment variable. As shown in the following
figure:
www.simcom.com 18 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Using sudo tar command to extract sdk archive, such as extracting to the current directory command as
follow:
sudo tar xzf sim_open_sdk.tar.gz
Then initialize the environment variable in the sim_open_sdk directory, the command is as follows:
source sim_crosscompile/sim-crosscompile-env-init
Executing make command in the sim_open_sdk directory. All the images generated after the compilation is
completed are in the sim_open_sdk/output directory, as follows.
www.simcom.com 19 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
1)Executing make kernel_menuconfig in sim_open_sdk directory to configure the kernel, and then pop up
the graphical configuration interface. If you need to add new configuration optionsselect the corresponding
configuration in the graphical configuration interface, then save and exit. If you do not add new
configuration just quit. After the configuration is complete, the .config file will be generated in the
sim_kernel/build/ directory.
2)Executing make kernel to compile the kernel. The generated kernel image is in the sim_open_sdk/output
directory.
Executing make rootfs in the sim_open_sdk directory and the generated image is in the
sim_open_sdk/output directory.
Executing make kernel_module to compile the driver module. After the compilation is successful, it will be
automatically installed in the corresponding directory of sim_rootfs, so then execute make rootfs to
regenerate the rootfs file system image.
www.simcom.com 20 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Executingmake demo to compile the demo program and the generated image is in the
sim_open_sdk/output directory.
2.2.1.8 Question
1) If you execute make kernel_menuconfig to configure the kernel, the following error occurs.
error: ../scripts/kconfig/lxdialog/dialog.h:: fatal error: curses.h: No such file or directory
Executing sudo apt-get install libncurses5-dev.
It needs to provide both the current version package source and the target version package target to make
ota upgrade package. Both source and target need to be placed under the sim_open_sdk/sim_ota directory.
1) generation of target
When the application is ready, the bootloader, kernel and system are all compiled. That is after
appsboot.mbn, boot.img and system.img have been generated in the output directory, make ota command
will be executed in the sim_open_sdk directory, and then the prepared target can be seen in the
sim_open_sdk/sim_ota directory.
2) The source prepared by the customer is put into the sim_open_sdk/sim_ota directory, and the source
structure is the same as the target structure.
3) Executing ota.sh under the sim_open_sdk directory will generate the ota upgrade package, which is
under the sim_open_sdk/output directory, as follows:
www.simcom.com 21 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
The differential modes oftwo packages are different. When update please using update_ota2+1.zip.
After connecting the SIM7600's USB to the computer, some USB virtual devices will appear and drivers will
need to be installed. Please use the corresponding Windows driver installation package to install. After
installation will as shown below:
The adb device of SIM7600 is closed by default. It needs to be opened by AT command setting, and then
restart the module to take effect.The command is AT+CUSBADB=1
After the command returns OK, you need to restart the module manually. You can see an Android
www.simcom.com 22 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Composite ADB Interface device from the Windows device manager, which indicates that the adb device
can be used.
Note:
If the computer is installed with the ADB device for the first time, then add the adb_usb.ini file in the
‘.android’ directory under the current login account in the ‘user’ on the C drive, and add the VID of the
SIM7600 to 0x1E0E in the file.
NOTE:
Module software version must be open linux development version can only be in accordance with the
instructions below to use fastboot to download each partitions. If not the open linux development version, it
www.simcom.com 23 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
needs to upgrade to an open linux development version before the operation. Through the at command ati,
you can check whether it is open linux development version or not. If the version information contains
keywords OL, it is an open linux development version.
You must use the tool to download a full open linux development version when download version for the first
time. It may cause some function can't be normal used if update part version files using fastboot.
Regardless of the application or compiled image file, it is recommended to use windows to download and
debug.
Application debugging uses the adb tool and image download uses the fastboot tool. These two tools can
be downloaded from the Internet or use the environment compression package provided by us.
The adb tool can push the app program into the module. The app runs in the foreground and can print all
app's log. Same as standard linuxdmesg can print all the kernel's logs.
Fastboot tool can download appsboot.mbn, modem.img, boot.img, system.img, recovery.img and
recoveryfs.img.
Use AT command at+bootldr or adb command adb reboot bootloader to enter fastboot mode, you can
download the above image.
www.simcom.com 24 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 25 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Note:All ‘demo’mentioned in this article are in the SDK. The directory is simcom-demo.
1) Demo program compiled under windows
Copy the Makefile_win file in the tools directory to the simcom-demo directory and rename it to Makefile.
Next compile directly with make command and generate demo_app application in the simcom-demo/bin
directory. The compiled executable file is imported into the data directory of the SIM7600 Linux system by
adb push, and the execute permission is added. Thenthe adb shell can be used to enter the SIM7600 Linux
console to manually debug the execution program.During the debugging phase, the client starts and
debugs the application through the control terminal of the adb shell. The code can use the printf method to
debug the log and information.
www.simcom.com 26 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
1) Compile helloworld
Executing make helloworld, and the generated application is in the sim_open_sdk/output directory.
2) Helloword Self-starting settings
Copy the application helloworld compiled above to the sim_open_sdk/sim_usrfs directory. Then copy the
sim_open_sdk/helloworld/start_helloworld file to the sim_open_sdk/sim_rootfs/etc/init.d/ directory and
executes the following command in the sim_open_sdk directory.
sudo ln -sf ../init.d/start_simcom_demosim_rootfs/etc/rc5.d/S99start_simcom_demo
Then regenerate the rootfs image according to Section 2.2.1.4.
In system partition, system, data and cacheare divided into one physical partition. The size of the three
logical partitions can be dynamically adjusted. The adjusted file is
sim_open_sdk/tools/ubinize_system_userdata.cfg
[sysfs_volume]
mode=ubi
image=./mdm9607-perf-sysfs.ubifs
vol_id=0
vol_type=dynamic
vol_name=rootfs
vol_size=55MiB // Adjust the size of the system partition here
[usrfs_volume]
mode=ubi
image=./usrfs/mdm9607-perf-usrfs.ubifs
vol_id=1
vol_type=dynamic
vol_name=usrfs
vol_flags = autoresize//Data partition size is set automatically
[cache_volume]
mode=ubi
vol_id=2
vol_type=dynamic
vol_name=cachefs
vol_size=45MiB //Adjust the size of the cache partition here
All necessary files in the system must be placed in the system directory. The temporarily generated files are
placed in the data directory. Note that system is a read-only directory. The data files stored as temporary
files may be lost under certain extreme conditions.
When the system is running, in order to ensure the security of the process the scheme of /data and /cache
www.simcom.com 27 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
SIMCom provides a tool for the production line to download customer developed applications. As shown
below:
www.simcom.com 28 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
The basic principle of this tool is that the customer selects his own compiled application file and then selects
Down File. The tool will place this program in the module /data and /usr/bin directory and rename it
‘helloworld’, and then automatically modify it to executable permissions. The next time the module is booted,
it will automatically check if there is helloworld under data. If so, it will automatically execute and complete
the client's program startup.
Providing production line tools for customers to download and use directly. You can download them in four
places at the same time. After the tools are installedthere will be instructions for use.
www.simcom.com 29 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3. Programming Guide
The basic API of the SIM7600 Linux system is the same as all Linux systems. But timer and RTC timer are
different. The RTC timer is still accurate after the system sleeps. TCP (socket) demo with the use of Linux
can refer to the specific code DEMO.
The Open Linux application can use the functions of all AT commands. AT command communication is
supported by using the tty device node /dev/smd8 in Linux.
Interface int sendATCmd(char* atCmd, char* finalRsp, char *buff, uint32_t buffSize,
long timeout_ms)
Input atCmd:AT command
finalRsp: Expected return value with string
buff:AT returns value all content pointer
buffSize:AT returns value All content pointer size, at least 100 bytes
timeout_ms:AT timeout
Output None
Return vaule 0:success -1:failureOther:AT returns content length
NOTE
3.3 UART
www.simcom.com 30 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Setting
Parameters Value ranges Defaults
method
Start bit 1bit 1bit ioctl
Data bit 7bit,8bit 8bit
Stop bit 1bit,2bit 1bit
Check digit Odd,Even,Space, None None
Baud rate 300,600,1200,2400,4800,9600,19200,38400,57600,115200, 115200 ioctl
230400,460800,921600,1000000,1152000,1500000,300000
0,3200000,3686400
Single frame 512B 512B
send size
Single frame (1-10)ms (The time that Host needs to wait after each 1ms(recom
response single frame is sent synchronously) mend)
delay
Maximum 10KB 10KB
buffer
3.4 GPIO
PI Wakeup
SYS Default Functio
N PINNAME Function 1 Pull Interrup
GPIO No. Function n0
No t
GPIO_102 MIFI_POWER_E MIFI_POWER_E B-P
33 GPIO3 GPIO
0 N N U
34 GPIO6 GPIO_102 MIFI_SLEEP_CL GPIO MIFI_SLEEP_CL B-P
www.simcom.com 31 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3 K K D
B-P
48 SD_DET GPIO_26 GPIO GPIO SD_DET *
D
B-P
49 STATUS GPIO_52 Status GPIO Status *
D
B-P
50 GPIO43 GPIO_36 MIFI_COEX GPIO MIFI_COEX
D
B-P
51 NETLIGHT GPIO_18 NETLIGHT GPIO NETLIGHT
D
B-P
52 GPIO41 GPIO_79 BT_PCM GPIO BT_PCM *
D
FLIGHTMOD B-P
54 GPIO_76 BT_PCM GPIO BT_PCM *
E D
B-P
69 UART_RI GPIO_50 GPIO(RI) GPIO GPIO
D
B-P
70 UART_DCD GPIO_51 GPIO GPIO GPIO
D
B-P
72 UART_DTR GPIO_74 GPIO(DTR) GPIO GPIO *
D
B-P
86 COEX3 GPIO_78 BT_PCM GPIO BT_PCM
D
B-P
87 GPIO77 GPIO_77 BT_PCM GPIO BT_PCM
D
Note:
If it doesn’t need the BT_PCM function, you can export the corresponding SYS GPIO No to using as
GPIO.
If the UART is configured to low speed serial ports, the CTS and RTS can be using as GPIO.
The following is a description of the SIM7600E-H GPIO controllable PIN:
The following is a description of the SIM7600E-H GPIO controllable PIN:
PI Wakeup
SYS Default Functio
N PINNAME Function 1 Pull Interrup
GPIO No. Function n0
No t
GPIO_102 MIFI_POWER_E MIFI_POWER_E B-P
33 GPIO3 GPIO
0 N N U
GPIO_102 MIFI_SLEEP_CL MIFI_SLEEP_CL B-P
34 GPIO6 GPIO
3 K K D
B-P
48 SD_DET GPIO_26 GPIO GPIO SD_DET *
D
B-P
49 STATUS GPIO_52 Status GPIO Status *
D
52 GPIO41 GPIO_79 BT GPIO BT B-P *
www.simcom.com 32 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
D
B-P
50 GPIO43 GPIO_36 MIFI_COEX GPIO MIFI_COEX
D
B-P
69 UART_RI GPIO_50 GPIO(RI) GPIO GPIO
D
UART_DC B-P
70 GPIO_51 GPIO GPIO GPIO
D D
B-P
72 UART_DTR GPIO_74 GPIO(DTR) GPIO GPIO *
D
B-P
87 GPIO77 GPIO_77 BT GPIO BT
D
Note:
PIN50, PIN52, and PIN87 boot phases are used as BOOT_CFG. So if you want to use these GPIOs
for development, they only serve as outputs.
PIN69 is fixed as the PIN pin for waking up the MCU and PIN72 is fixed as the PIN pin for the MCU
wake-up module.
Instance:
1)GPIOConfiguration
About GPIO operation method:
Via the /sys/class/gpio/*** file node. This method requires attention to the correspondence between PIN No.
and SYS GPIO No.
1)). Dynamically establish GPIO file node and write GPIO number to /sys/class/gpio/export file.For example
using PIN50:
echo 36 > /sys/class/gpio/export
2)). Pull up or pull down GPIO and set GPIO as output first, then set output high and low.
For example pull up PIN50:
echo 36 >/sys/class/gpio/export
echo out> /sys/class/gpio/gpio36/direction
echo 1> /sys/class/gpio/gpio36/value
3)). Read GPIO-first set GPIO as input and then read the status.
echo in> /sys/class/gpio/gpio36/direction
cat /sys/class/gpio/gpio36/value
www.simcom.com 33 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.5 ADC
The module provides two ADC analog-to-digital conversion interfaces corresponding to the module
PIN46.PIN47. They correspond to ADC2 and ADC1, respectively. The developer can read the
corresponding device file to obtain the voltage value.
3.6 I2C
SIM7600E-H:SDA and SCL correspond to the PIN55 and PIN56 of the module, respectively. The developer
first opens the /dev/i2c-5 devices to obtain the handle, and then calls the read-write function to operate the
device.
Interface int sim_i2c_write(uint8_t slave_address, uint16_t reg, uint8_t *buf, int len)
Input slave_address Device slave address
reg Device register
buf Data bufferto be written
len Data length
Output None
Return value 0:success -1:failure Other:data length
Interface int sim_i2c_write(uint8_t slave_address, uint16_t reg, uint8_t *buf, int len)
Interface int sim_i2c_read(uint8_t slave_address, uint16_t reg, uint8_t *buf, int len)
Input slave_address Device slave address
www.simcom.com 34 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Through the SDIO PIN (21-26), external SD Card or EMMC, the default mount / etc / card shortcut is /
sdcard. Partitioning and formatting need to be done once on the production line and using the AT command
AT + CFDISK. After the system default mount only the first partition is / sdcard, other partitions need to use
the command to do mount in the APP.
3.7.1 Partition
3.7.2 Format
3.7.3 Mount
The module will automatically mount /dev/mmcblk0p1 to /media/card. For other partitions, users need to
mount.
For example mounting /dev/mmcblk0p2 to /mnt:
mount–t auto /dev/mmcblk0p2 /mnt
AT+CFDISK
www.simcom.com 35 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Response
a)If successfully:
Test Command +CFDISK: (1-4)[…]
AT+ CFDISK=? OK
b)If failed:
ERROR
Response
a)If successfully:
Read Command +CFDISK: <num>,<size>
AT+ CFDISK? OK
b)If failed:
ERROR
Response
a)If successfully:
Write Command
OK
AT+ CFDISK=<num>[,<size>,…]
b)If failed:
ERROR
Response
Write Command(Formatting all a)If successfully:
partitions) OK
AT+ CFDISK b)If failed:
ERROR
Defined values
<num> Partition number
Partition size.The unit is KB.
<size> NOTE:The last partition size does not need to be set. The size of the last
partition is the size of the disk remaining.
Examples
AT+CFDISK=?
OK+CFDISK: (1-4)[...]
OK
AT+CFDISK=4,50000,50000,50000
OK
AT+CFDISK
OK
AT+CFDISK?
+CFDISK: 1,50040
+CFDISK: 2,50048
+CFDISK: 3,50048
+CFDISK: 4,3708288
OK
www.simcom.com 36 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.8 UIM
Customers can use UIM's related functions to obtain some information about the SIM card, such as ICCID
and IMSI.
www.simcom.com 37 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.9 SMS
www.simcom.com 38 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 39 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Make and receive voice calls while monitoring the status of voice calls.
www.simcom.com 40 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
NOTE
www.simcom.com 41 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
8:Hanging
9:Hang up
2.3 Direction:
1:Exhale
2:Call in
2.4 Number
Return value 0:success -1:failure
NOTE
3.10.6 Callback
3.11 NAS
NAS interface is mainly used to obtain some information about the status of the network, such as
www.simcom.com 42 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
selected_network;network types
- 0x00 –Unknown
- 0x01 –3GPP2
- 0x02 –3GPP
www.simcom.com 43 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.12 WDS
www.simcom.com 44 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
It is used to complete setting/inquiry for APN, dialing username and password under CDMA network. With a
connection to the network, disconnect the network connection and other functions. Up to 8 links are
supported at the same time. The data link used by the APP suggests starting with the 7th profile.
www.simcom.com 45 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.14 GNSS
It enables the opening and closing of GNSS, the use of XTRA, and the output of NMEA and latitude and
longitude.
www.simcom.com 46 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.14.2 EnableXTRA
www.simcom.com 47 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
typedef struct {
double latitude;
double longitude;
double altitude;
float speed;
float bearing;
float accuracy;
//time[0] = year-2000
//time[1] = month
www.simcom.com 48 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
//time[2] = day
//time[3] = time
//time[4] = minute
//time[5] = second
uint8_t time[6];
} GpsInfo;
3.15 WIFI
Description of function:
Recommend customers choose W58 module, which encapsulates Qualcomm QCA9377 WIFI chip.
Specifications of W58 module:
SDIO 3.0 interface,RelatedPIN(27-32)
20MHz/40MHz(2.4GHz)
As AP mode, it connects 30 nodes.
1X1 Single antenna design so has low cost solution.
Software function:
Support WIFI AP/station mixed mode
Supports communication between devices connected to WIFI hotspots and connected Module
devices
Support hidden WIFI hotspot function
Provides AT commands for configuring WIFI and routing protocols
Special Instructions:
get_wifi_mode and set_wifi_mode apply toW58, W58L cannot use.
sta_init and get_sta_status apply to W58L, W58 cannot use.
www.simcom.com 49 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
In general, if the WIFI mode of the device design is fixed, it is better to preset the WIFI mode.
Preset WIFI mode methods:
a. Modify the nodes in sim_open_sdk/sim_usrfs/mobileap_cfg.xml and
sim_open_sdk/sim_rootfs/etc/default_mobileap_cfg.xml:
b. <WlanMode>AP-AP</WlanMode> value:
AP mode: AP
Dual APmode:AP-AP
AP+STA mode: AP-STA
c. modify sim_open_sdk/sim_usrfs/mobileap_enable_cfgvalue
AP mode:0
AT+AP mode: 1
AP+STA mode: 2
Note:aand b models must be consistent.
If the WIFI mode of the device needs to be dynamically switched according to the scenario, you can call the
following interface to adjust:
www.simcom.com 50 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
2:AP+STA mode
Output None
Return value Boolean type:
TRUE or FALSE
NOTE
www.simcom.com 51 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
AP-AP mode,0 or 1
STA-AP mode,2
Output
Return value Boolean type:
TRUE or FALSE
NOTE
www.simcom.com 52 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
2.When the auth type input is 2, the input value of encrypt mode can only be
1;
3.When the input value of the auth type is greater than 3, the input value of
the encrypt mode must be greater than or equal to 2;
4.When the encrypt mode input is 0, it does not need to enter the password;
5.When the encrypt mode input is 1, the password must be entered.
The format of the password input must satisfy: an ASCIIencoded string of
length 5 or 13 or a hexadecimal encoded string of length 10 or 26.
6.When the input value of the encrypt mode is greater than or equal to 2, the
password must be input.
The format of the password input must satisfy: an ASCII encoded string of
length 8 to 63 or a hexadecimal encoded string of length 64.
Default value :
int authType = 5;
int encryptMode = 4;
ap_index_type: 0-> ap
0-> ap & ap
2-> ap & sta
www.simcom.com 53 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
2. ap_index:ap_index_type
AP mode,1
AP-AP mode,0 or 1
STA-AP mode,2
Output None
Return value Boolean type:
TRUE or FALSE
NOTE
www.simcom.com 54 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.15.15 Set IP obtained after the STA connects to the external hotspot
www.simcom.com 55 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 56 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 57 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Output None
Return value None
NOTE
www.simcom.com 58 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
Interface Uint8wifi_get_err_code()
Input None
output None
Return value Uint8 type:
0– success
1– invalid parameter
2–malloc memory error
3–send/receive message error
4–open file error
5–read/write file error
6–invalid return value
7–invalid AP ID
8–get information error
9–not W58L
10–other error
NOTE The result code retain the last operation result.
You could call the API to get the current operation result code if call a API
which return failed.
www.simcom.com 59 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 60 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.16 SPI
SIM7600E-H:SPI interface cannot be used on the standard version. You need to update the version that
supports SPI. You can configure UART1 or UART2 as SPI. For details, please refer to the SIM7600 Open
Linux UART & SPI Documentation. The module's SPI supports only the Master mode and does not support
the Slave mode. After the SPI version is started, the /dev/spidev2.0 device node is generated. The default
SPI interface can only connect to a single peripheral device.
It requires peripheral circuit design. Currently it only supports U disk. SDK is default support.
3.18 Bluetooth
It is recommended that customers select the W58 module and package the Qualcomm QCA9377
Bluetooth chip.
This chapter describes how to implement SPP data sending and receiving, GATT data transmission and etc.
by calling the Bluetooth API.
SPP data send and receive data. First turn on Bluetooth. If you do not pair with the peer Bluetooth, you
need to pair first. After the pairing is completed, start the SPP server for the peer Bluetooth connection or
directly connect the peer Bluetooth SPP server to complete the data transfer.
www.simcom.com 61 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 62 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 63 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 64 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 65 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
description.
Return value 0:success -1:failure
NOTE This interface is executed when the callback function
BT_ACCEPT_COMMAND message is received.
3.18.10 Query whether the peer Bluetooth is enabled with SPP Server
www.simcom.com 66 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 67 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
NOTE
www.simcom.com 68 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 69 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 70 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 71 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 72 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
NOTE
www.simcom.com 73 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.18.36 Return the host to write data requests from the local
3.18.37 Callback
www.simcom.com 74 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
case BT_CONNECT_COMMAND:
Report the message that other Bluetooth devices via SPP connection module.
break;
case BT_DISCONNECT_COMMAND:
Report the message that non-module actively disconnect SPP connection.
break;
case BT_SPP_RECV_COMMAND:
SPP Receive data
data_len: receive data len
data: receive data
break;
case BT_GATT_CONNECT_COMMAND:
Report the message thatGATT has connected.
break;
case BT_GATT_READ_IND_COMMAND:
Report the message that other devices try to read module data via Bluetooth.
break;
case BT_GATT_WRITE_IND_COMMAND:
Report the message that other devices try to write module data via Bluetooth.
break;
}
}
3.19 ETH
www.simcom.com 75 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
0: ETH_LAN Peripherals access the module through the Internet and the peripheral IP is allocated via
the HDCP module.
1: ETH_WAN The module accesses the Internet via Ethernet.
2:ETH_LAN_STATIC Peripherals access the Internet through the module. Module ETH and peripheral IP
set to static IP
In general, the functionality of Ethernet is pre-defined at design time. So you can set the mode before
compiling the SDK.Modify the preset mode by modifying the value of the SDK source
mdm-init/wlan/lan_mode. The corresponding value of the pattern is the above list value.
If the client is using windows development, downloading the default file to the system using the tool requires
downloading two files: Copy ‘lan_mode’ and change the name to ‘default_lan_mode’.
The dynamic switching mode can set the network mode with AT+CLANMODE=0/1/2 command. However,
this setting only modifies the lan_mode value in the data directory. If the lan_mode in the data directory is
destroyed, it will revert to the default value (default_lan_mode value). Therefore, if the ETH mode designed
by the customer is fixed, it is recommended to directly preset the initial mode.
www.simcom.com 76 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.19.7 Set IP
www.simcom.com 77 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
This section mainly introduces the network access modes and network settings supported by the module.
There are three main ways to access the external network module:
1. Mobile network
2. WIFI_STAWIFI opens STA
3. ETH_WANEthernet as WAN port
www.simcom.com 78 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
The first three modes:The connection between the master device and the module is connected in the form
of a local area network. A 192.168.225.* IP will be obtained from module HDCP. After the IP is successfully
obtained the master can connect to the external network through the module, and can also communicate
with the internal process of the module (APP) through the LAN IP.
The last mode:It needs to be set by the customer APP and the master to set the IP, gateway, NDS.
IP: 192.168.*.* (Same network segment as IP set by APP to ETH_LAN_STATIC)
Gateway: 192.168.*.* (Same as the IP set by the APP for ETH_LAN_STATIC)
DNSserver: 192.168.225.1 (regular)
The module selects a default route based on the current module status and profile settings.
For example:
In the current setting, when the module has both WLAN_STA and ETH_WAN connected, the default route
will be set to ETH_WAN. This means that accessing the external network will be accessed via ETH.
The setting does not change. If the Ethernet cable is unplugged, the default route will become WLAN. Insert
the Ethernet cable. After the Ethernet connection is successful, the default route will be switched to
ETH_WAN.
If the customer wants to use ETH_WAN preferentially when both WLAN_STA and ETH_WAN are
connected, their order can be adjusted. Similarly, if the customer wants to pass 4G network when the 4G
network dials successfully, then jump the 4G priority to the highest.
www.simcom.com 79 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.22 ALSA
www.simcom.com 80 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 81 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.24 DMS
3.24.1 Initialization
www.simcom.com 82 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
3.24.6 Release
www.simcom.com 83 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
www.simcom.com 84 / 85
SIM7600 Series_Open Linux_Development Guide_V2.00
The customer version is saved in the file /etc/simcom_ap_ver.ini; the max length of the version string is 35
bytes. It can querry the version information throuth the following methods:
1) Cat the file content.
2) Call AT+CSUB=1.
www.simcom.com 85 / 85