OpenLinux as part of SIM7600E-H modules

OpenLinux as part of SIM7600E-H modules

The mechanism for developing a custom application and loading it into the module is available under both the operating system Linuxand a WindowsIn this article, we will take a detailed look at how to use examples from the SDK provided SIMCom Wireless Solutions compile and load the user application into the module.

Before writing the article, one of my friends, who is far from the development of Linux, asked for a detailed description of the process of developing a custom application for the SIM7600E-H module. The criterion for assessing the accessibility of the presentation was the phrase "so I can understand."

I invite you to take a look at what happened.

The article is regularly supplemented and updated.

Prelude

Typically, cellular modules are used only for data transfer, voice calls, SMS messaging, and the like. This is all accomplished via AT commands sent from an external control microcontroller. However, there is a category of modules that allow for the execution of user code loaded externally. In some cases, this significantly reduces the overall cost of the device, allowing for a simpler (and equally cost-effective) microcontroller to be installed on the board, or eliminating it altogether. With the advent of OS-controlled LTE modules Android or Linux With their powerful resources, you can tackle any task that's accessible to popular processors. This article will discuss the SIM7600E-H, which is managed by an OS. LinuxWe'll look at how to download and run an executable application.

The material is largely based on the document “SIM7600 Open Linux "Development Quide," but some additions, especially the Russian-language version, will be useful. This article will help those just beginning to use the module navigate through the download of the demo application and provide the necessary skills for subsequent work.

Briefly about who is SIM7600E-H

SIM7600E-H is a module built on the basis of the ARM Cortex-A7 1.3GHz processor from Qualcomm, with an operating system Linux (kernel 3.18.20) inside, capable of operating in European (including Russian) 2G/3G/LTE frequency bands, supporting Cat.4, and providing maximum download speeds of up to 150 Mbps and upload speeds of up to 50 Mbps. Extensive peripherals, industrial temperature range, and built-in GPS/GLONASS navigation meet all requirements for a modern modular M2M solution.

System overview

The SIM7600E-H module is based on the operating system Linux (kernel 3.18.20). The file system, in turn, is built on the UBIFS (Unsorted Block Image File System) journaling file system.

Important features of this file system include:

  • works with partitions, allows you to create, delete, or resize them;
  • ensures the alignment of the record over the entire volume of the media;
  • works with Bad blocks;
  • minimizes the likelihood of data loss during a power outage or other failures;
  • logging.

Description taken hence, there is more information about such a file system.

Those. this type of file system is ideal for harsh operating conditions of the module and possible power problems. But this does not mean that unstable power conditions will be the expected mode of operation of the module, this only indicates a greater viability of the device.

Remembrance

The distribution of memory areas is built as follows:

OpenLinux as part of SIM7600E-H modules

There are three main areas to highlight:

ubi0:rootfs – is read-only and contains the kernel itself Linux
ubi0:usrfs – mainly used for user program and data storage
ubi0:cahcefs – reserved for FOTA updates. If the available space is not enough to download the update, the system will delete unused files and thus free up space. But for security reasons, you should not place your files there.

All three sections are distributed as follows:

File system
Size
Used
Available
use%
mounted on

ubi0:rootfs
40.7M
36.2M
4.4M
89%
/

ubi0:usrfs
10.5M
360K
10.1M
3%
/date

ubi0:cachefs
50.3M
20K
47.7M
0%
/ cache

Available functionality

As mentioned above, the module is based on Qualcomm's Cortex A7 chipset. It would be wrong not to provide such a high-performance core for processing the user program and offloading the main processor of the device, shifting some part of the program to the module.

For the user program, the following operating modes of the peripherals will be available to us:

Pin no.
Name
Sys GPIO No.
default action
Func1
Func2
Pull
Wakeup interrupt

6
SPI_CLK

UART1_RTS


BPD

7
SPI_MISO

UART1_Rx


BPD

8
SPI_MOSI

UART1_Tx


BPD

9
SPI_CS

UART1_CTS


BPD

21
SD_CMD

SD card


BPD

22
SD_DATA0

SD card


BPD

23
SD_DATA1

SD card


BPD

24
SD_DATA2

SD card


BPD

25
SD_DATA3

SD card


BPD

26
SD_CLK

SD card


B-PN

27
SDIO_DATA1

WiFi


BPD

28
SDIO_DATA2

WiFi


BPD

29
SDIO_CMD

WiFi


BPD

30
SDIO_DATA0

WiFi


BPD

31
SDIO_DATA3

WiFi


BPD

32
SDIO_CLK

WiFi


B-PN

33
GPIO3
GPIO_1020
MIFI_POWER_EN
GPIO
MIFI_POWER_EN
B-PU

34
GPIO6
GPIO_1023
MIFI_SLEEP_CLK
GPIO
MIFI_SLEEP_CLK
BPD

46
ADC2

ADC



47
ADC1

ADC


B-PU

48
SD_DET
GPIO_26
GPIO
GPIO
SD_DET
BPD
X

49
STATUS
GPIO_52
Status
GPIO
Status
BPD
X

50
GPIO43
GPIO_36
MIFI_COEX
GPIO
MIFI_COEX
BPD

52
GPIO41
GPIO_79
BT
GPIO
BT
BPD
X

55
SCL

I2C_SCL


BPD

56
SDA

I2C_SDA


B-PU

66
RTS

UART2_RTS


BPD

67
CTS

UART2_CTS


BPD

68
RxD

UART2_Rx


BPD

69
RI

GPIO(RI)


BPD

70
DCD

GPIO


BPD

71
TxD

UART2_Tx


BPD

72
DTR

GPIO(DTR)


BPD
X

73
PCM_OUT

PCM


BPD

74
PCM_IN

PCM


BPD

75
PCM_SYNC

PCM


BPD

76
PCM_CLK

PCM


B-PU

87
GPIO77
GPIO77
BT
GPIO
BT
BPD

Agree, the list is impressive and pay attention: part of the peripherals is used to operate the module as a router. Those. on the basis of such a module, you can make a small router that will distribute the Internet via Wi-Fi. By the way, there is a ready-made solution called SIM7600E-H-MIFI and is a miniPCIE card with a soldered SIM7600E-H module and several antenna pins, one of them is a Wi-Fi antenna. However, this is a topic for a separate article.

Wednesday (not a day of the week)

SIMCom Wireless Solutions provide the opportunity for developers to choose the most familiar development environment for themselves Linux or WindowsIf we are talking about one executable application on a module, then it is better to choose Windows, it will be faster and easier. If you expect a complex application architecture and subsequent upgrades, it is better to use LinuxWe will also need Linux To compile executable files for subsequent loading into a module, a virtual machine is quite sufficient for compilation.

From what you need, not available for download in the public domain - SDK, which can be requested from your distributor.

Installing utilities for working with the module

From here on we will work under Windows as the most familiar OS to most users.

We will need to install the necessary software in a few simple steps for the subsequent development of working with the module:

  1. GNU/Linux
  2. Cygwin
  3. Drivers
  4. ADB

Installing GNU/Linux

To build the application, you can use any ARM-compatible platform.Linux compiler. We'll use SourceryCodeBenchLiteARM GNU/Linuxtranslator available for download at link.

In order for all components to be installed correctly, I will leave a few screenshots of the installation process. In principle, there is nothing complicated in the installation.

In order for all components to be installed correctly, I will leave a few screenshots of the installation process. In principle, there is nothing complicated in the installation.

  1. We accept the license agreement
    OpenLinux as part of SIM7600E-H modules
  2. Specify the installation folder
    OpenLinux as part of SIM7600E-H modules
  3. We leave the necessary components unchanged
    OpenLinux as part of SIM7600E-H modules
  4. Leave as is
    OpenLinux as part of SIM7600E-H modules
  5. Several times “Next”, “Install” and basically everything
    OpenLinux as part of SIM7600E-H modules

Installing Cygwin

Further, for development, you will need a set of libraries and utilities from the set provided Cygwin. Everything is simple here, the current version of Cygwin can be downloaded for free on the official website of the project, at the time of writing the article, version 3.1.5 was available, and we used it when preparing the material.

There is nothing difficult in installing Cygwin, the only thing you need to choose is the mirror from which the installer will download the necessary files, select any and install, as well as a set of utilities and libraries, leave all available libraries and utilities selected.

Installing drivers

After the module is connected to the PC, you will need to install drivers. They can be requested from your distributor (recommended). I do not recommend searching the Internet on your own, because. it may take a long time to find what the device conflict was related to.

OpenLinux as part of SIM7600E-H modules

Among the dedicated ports we see the following:

Windows
Linux
Description

SimTech HS-USB Diagnostics
USB Serial
diagnostic interface

SimTech HS-USB NMEA
USB Serial
GPS NMEA Interface

SimTech HS-USB AT Port
USB Serial
AT port Interface

SimTech HS-USB Modem
USB Serial
Modem Port Interface

SimTech HS-USB Audio
USB Serial
USB audio interface

SimTech HS-USB WWAN Adapter
USB Net
NDIS WWAN Interface

Android Composite ADB Interface
USB ADB
Android add debug port

As you probably noticed, there is no USB ADB among the ports in the screenshot, this is due to the fact that the ADB port in the module is closed by default and you need to enable it by sending the command 'AT+CUSBADB=1' to the module's AT port and reboot it ( this can be done with the 'AT+CRESET' command).

As a result, we get the desired interface in the device manager:

OpenLinux as part of SIM7600E-H modules

Finished with the drivers, go to ADB.

Installing ADB

We go to the official website Android Developer by linkLet's not download the bulky one. Android Studio, we only need the command line, available for download at the link "Download SDK Platform-Tools for Windows».

OpenLinux as part of SIM7600E-H modules

Download and unpack the resulting archive to the root of drive C.

Environment Variables

After installing Cygwin, you will need to add the Cygwin/bin/ path to your development environment variables (Classic Control Panel → System → Advanced System Settings → Advanced → Environment Variables → System Variables → Path → Edit) as shown in the screenshot below:

OpenLinux as part of SIM7600E-H modules

Similarly, add the path to the downloaded and unpacked ADB archive to the root of drive C.

OpenLinux as part of SIM7600E-H modules

Click OK a few times and restart your computer.

After a reboot, you can easily check if ADB is working properly by opening a command prompt (Win+R → cmd) and typing 'adb version'. We get something like this:

OpenLinux as part of SIM7600E-H modules

Connect the module to the PC (if it happened that it was disabled) and check if ADB sees it with the 'adb devices' command:

OpenLinux as part of SIM7600E-H modules

Done, this completes the connection setup to the module and we can start the shell to work with the module.

OpenLinux as part of SIM7600E-H modules

Unpacking and compiling the SDK

Now that we have access to the shell and can start working with the module's command line, let's try to compile our first application to load into the module.

This can be a challenge for many people! Because the module runs on an operating system. Linux, to avoid collisions when compiling code under Windows – it is best to compile in the native environment – Linux.

We will not dwell in detail on how in the absence of Linux and if you don't want to install it on your machine, you can install it on a virtual machine. We'll use VirtualBox, install Ubuntu version 20.04 (the current version at the time of writing) and we will begin working with compilers, SDK, etc. under it.

Moving on to Wednesday Linux and unpack the archive received from the distributor.

simcom@VirtualBox:~/Desktop/OpenLinux$ sudo tar -xzf MDM9x07_OL_2U_22_V1.12_191227.tar.gz 

Go to the sim_open_sdk directory and add the environment:

simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ cd sim_open_sdk
simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ source sim_crosscompile/sim-crosscompile-env-init 

We remain in the same folder and execute the following commands while in it.
Install the libncurses5-dev library if it was not installed:

simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ sudo apt-get update && sudo apt-get install libncurses5-dev -y

Python, if not already installed:

simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ sudo apt-get install python -y

and gcc:

simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ sudo apt-get install gcc

Compilation:

Now we need to compile several files, execute the following commands in sequence.

If the kernel configuration window pops up during compilation - just select Exit and return to the console, we do not need to configure the kernel now.

We carry out:

simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ make

Compiling the bootloader:

simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ make aboot

Compiling the kernel:

simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ make kernel_menuconfig
simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ make kernel

Compile the root file system:

simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ make rootfs

For users Linux It will be relevant to compile the module driver:

simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ make kernel_module

Let's compile the demo:

simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ make demo

After that, several new files will appear in the sim_open_sdk/output directory:

simcom@VirtualBox:~/Desktop/OpenLinux/sim_open_sdk$ ls output/
appsboot.mbn  boot.img  demo_app  helloworld  system.img

Demo

Let's try loading the demo into our module and see what happens.

Download

In the sim_open_sdk directory, we can see the demo_app file. Extract it and move it to the root of the C drive on the PC to which the module is connected. Then, launch the command line. Windows (Win+R -> cmd) and enter:

C:>adb push C:demo_app /data/

The console will tell us:

C:demo_app: 1 file pushed, 0 skipped. 151.4 MB/s (838900 bytes in 0.005s)

This means that the file has been successfully sent to the module and we just have to run it. Let's not delay.

We carry out:

C:>adb shell

Expand the rights of the downloaded file:

/ # cdhmod 777 /data/demo_app

And we run:

/ # /data/demo_app

In the same console, the module will tell us the following:

SDK_VER : SIM_SDK_VER_20191205
DEMO_VER: SIM_SDK_VER_20191205

Please select an option to test from the items listed below.

1. WIFI                       2. VOICE CALL
3. DATA CALL                  4. SMS
5. WDS(APN)                   6. NAS
7. AT                         8. OTA
9. TTS                        10. GPIO
11. GPS                       12. Bluetooth
13. TCP/UDP                   14. Timer
15. ADC                       16. I2C
17. UIM(SimCard)              18. DMS(IMEI,MEID)
19. UART                      20. SPI
21. Version                   22. Ethernet
23. FTP                       24. SSL
25. HTTP(S)                   26. FTP(S)
27. MQTT(S)                   28. ALSA
29. DEV                       30. AUDIO
31. JSON                      32. LBS
99. EXIT
Option >   

Let's look at the IMEI of the module, enter 7 (switch to command mode) and then enter 5:

Please select an option to test from the items listed below.

1. WIFI                       2. VOICE CALL
3. DATA CALL                  4. SMS
5. WDS(APN)                   6. NAS
7. AT                         8. OTA
9. TTS                        10. GPIO
11. GPS                       12. Bluetooth
13. TCP/UDP                   14. Timer
15. ADC                       16. I2C
17. UIM(SimCard)              18. DMS(IMEI,MEID)
19. UART                      20. SPI
21. Version                   22. Ethernet
23. FTP                       24. SSL
25. HTTP(S)                   26. FTP(S)
27. MQTT(S)                   28. ALSA
29. DEV                       30. AUDIO
31. JSON                      32. LBS
99. EXIT
Option > 7

Please select an option to test from the items listed below.

1. get Module Version         2. get CSQ
3. get CREG                   4. get ICCID
5. get IMEI                   6. get CIMI
99. back
Option > 5
IMEI: 867584030090489

Please select an option to test from the items listed below.

1. get Module Version         2. get CSQ
3. get CREG                   4. get ICCID
5. get IMEI                   6. get CIMI
99. back
Option >

Thus, we will see the IMEI of the module.

As a conclusion

I hope we managed to get a general idea of ​​how to get started with the module. In the following articles, we will take a closer look at the capabilities that the SIM7600E-H platform provides, as well as how you can remotely update your own application in the module.

I invite you to ask questions in the comments, as well as indicate which aspect of the module's capabilities should be reflected in subsequent articles.

Source: habr.com

Buy reliable hosting for sites with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster