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 a module is available under both Linux and Windows operating systems. In this article, we will take a closer look at how, using the examples from the SDK provided SIMCom Wireless Solutions compile and load the user application into the module.

Before writing the article, one of my acquaintances, who is far from developing under Linux, asked me to approach the issue of describing the process of developing my own application for the SIM7600E-H module in as much detail as possible. The criterion for evaluating the accessibility of the presentation of the material was the phrase "so that I understand."

I invite you to take a look at what happened.

The article is regularly supplemented and updated.

Prelude

Typically, cellular communication modules are used only for data transmission, voice calls, SMS transmission and the like. All this is done through AT commands sent from an external control microcontroller. But there is a category of modules that allow you to execute custom code loaded from outside. In some cases, this significantly reduces the overall budget of the device, allowing you to put a simpler (and equally budgetary) microcontroller on the board or abandon it altogether. With the advent of LTE modules controlled by Android or Linux OS and their powerful resources, it is possible to solve any tasks that are available to popular processors. This article will talk about SIM7600E-H, controlled by Linux OS. We'll look at how to download and run the executable application.

In many ways, the material is based on the “SIM7600 Open Linux development quide” document, but some additions, and especially the Russian version, will be useful. The article will help those who are just starting to master the module to understand how to download the demo application and will give the necessary skills for further work.

Briefly about who is SIM7600E-H

SIM7600E-H is a module based on ARM Cortex-A7 1.3GHz processor from Qualcomm, with Linux operating system (kernel 3.18.20) inside, able to work with European (including Russian) 2G/3G/ LTE supporting Cat.4, providing maximum download speed up to 150Mbps and upload speed up to 50Mbps. Rich peripherals, industrial temperature range and built-in GPS/GLONASS navigation cover any requirements for a modern M2M modular solution.

System overview

The SIM7600E-H module is based on the Linux operating system (kernel 3.18.20). In turn, the file system is based 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.

Memory

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 - read-only and contains the Linux kernel itself
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
Pullover
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 an opportunity for developers to choose the most familiar development environment for Linux or Windows. If we are talking about a single executable application on a module, then it is better to choose Windows, it will be faster and easier. If a complex application architecture and subsequent upgrades are expected, it is better to use Linux. We also need Linux to compile executable files for subsequent loading into the module, a virtual machine is enough 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

Hereinafter, 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

You can use any compiler compatible with ARM-Linux to build the application. We will use SourceryCodeBenchLiteARM GNU/Linuxtranslater 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

Go to the official website of Android Developer link. We will not download the cumbersome Android Studio, the command line is enough for us, 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 difficult for many! Because the module works on the Linux operating system, in order to avoid collisions when compiling code under Windows, it is best to compile in the native environment - Linux.

We will not dwell on how, in the absence of Linux and the desire to install it on your machine, you can install it on a virtual one. We will use VirtualBox, install Ubuntu version 20.04 (the current version at the time of this writing) and already under it we will start working with compilers, SDKs, etc.

We pass into the Linux environment 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 Linux users, 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. We pick it up and transfer it to the root of drive C on the PC to which the module is connected. Then open the Windows Command Prompt (Win+R -> cmd) and type:

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

Add a comment