ITKarma picture

The mechanism for developing a custom application and loading it into the module is available both under the Linux and Windows operating systems. In this article, we will take a detailed look at how to compile and load the user application into the module using the SDK examples provided by SIMCom Wireless Solutions .

Before writing this article, a friend of mine, far from development for Linux, asked me to go as far as possible to the question of describing the process of developing my own application for the SIM7600E-H module. The criterion for assessing the availability of submission of material was the phrase “so that I understand.”

I invite you to get acquainted with what happened.
The article is regularly updated and updated


Prelude


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

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

Briefly about who SIM7600E-H is


SIM7600E-H is a module based on Qualcomm’s ARM Cortex-A7 1.3GHz processor, has a Linux operating system (kernel 3.18.20) inside, capable of working with European (including Russian) frequency ranges 2G/3G/Cat.4-supported LTE, providing maximum download speeds of up to 150Mbps and uploads of up to 50Mbps. The rich peripherals, industrial temperature range and the presence of integrated GPS/GLONASS navigation cover any requirements for a modern modular solution in the M2M theme.

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 Unsorted Block Image File System (UBIFS) journaled file system.

Important features of this file system include:

  • works with partitions, allows you to create, delete, or resize them;
  • aligns the recording across the entire volume of the medium;
  • works with bad blocks;
  • minimizes the likelihood of data loss during a power outage or other failure;
  • logging.

The description is taken from here , there is also more detailed 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 the conditions of unstable power 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 constructed as follows:

ITKarma picture

Three main areas need to be highlighted:

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

All three sections are distributed as follows:
Filesystem Size Used Available Use% Mounted on
ubi0: rootfs 40.7M 36.2M 4.4M 89% /
ubi0: usrfs 10.5M 360K 10.1M 3% /data
ubi0: cachefs 50.3M 20K 47.7M 0% /cache

Available Functionality


As already mentioned above, the module is based on the Qualcomm Cortex A7 chipset. It would be wrong not to provide such a high-performance kernel for processing the user program and unloading the main processor of the device by transferring some part of the program to the module.

For the user program, the following peripheral operating modes will be available to us:
Pin No. Name Sys GPIO No. Default action Func1 Func2 Pull Wakeup interrupt
6 SPI_CLK - UART1_RTS - - B-PD -
7 SPI_MISO - UART1_Rx - - B-PD -
8 SPI_MOSI - UART1_Tx - - B-PD -
9 SPI_CS - UART1_CTS - - B-PD -
21 SD_CMD - SD-Card - - B-PD -
22 SD_DATA0 - SD-Card - - B-PD -
23 SD_DATA1 - SD-Card - - B-PD -
24 SD_DATA2 - SD-Card - - B-PD -
25 SD_DATA3 - SD-Card - - B-PD -
26 SD_CLK - SD-Card - - B-PN -
27 SDIO_DATA1 - WLAN - - B-PD -
28 SDIO_DATA2 - WLAN - - B-PD -
29 SDIO_CMD - WLAN - - B-PD -
30 SDIO_DATA0 - WLAN - - B-PD -
31 SDIO_DATA3 - WLAN - - B-PD -
32 SDIO_CLK - WLAN - - 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 B-PD -
46 ADC2 - ADC - - - -
47 ADC1 - ADC - - B-PU -
48 SD_DET GPIO_26 GPIO GPIO SD_DET B-PD X
49 STATUS GPIO_52 Status GPIO Status B-PD X
50 GPIO43 GPIO_36 MIFI_COEX GPIO MIFI_COEX B-PD -
52 GPIO41 GPIO_79 BT GPIO BT B-PD X
55 SCL - I2C_SCL - - B-PD -
56 SDA - I2C_SDA - - B-PU -
66 RTS - UART2_RTS - - B-PD -
67 CTS - UART2_CTS - - B-PD -
68 RxD - UART2_Rx - - B-PD -
69 RI - GPIO(RI) - - B-PD -
70 DCD - GPIO - - B-PD -
71 TxD - UART2_Tx - - B-PD -
72 DTR - GPIO(DTR) - - B-PD X
73 PCM_OUT - PCM - - B-PD -
74 PCM_IN - PCM - - B-PD -
75 PCM_SYNC - PCM - - B-PD -
76 PCM_CLK - PCM - - B-PU -
87 GPIO77 GPIO77 BT GPIO BT B-PD -


Согласитесь, перечень внушительный и обратите внимание: часть периферии используется для работы модуля в качестве роутера.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 outputs, one of them is a Wi-Fi antenna. However, this is a topic for a separate article.

Wednesday (not the day of the week)


SIMCom Wireless Solutions give developers the opportunity to choose the most familiar development environment for Linux or Windows. If we are talking about one executable application on a module, then it is better to choose Windows, it will turn out faster and easier. If you intend to have a complex application architecture and subsequent upgrades, it is better to use Linux. We also need Linux to compile the executable files for subsequent loading into the module, a virtual machine is quite enough to compile.

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

Installing utilities for working with the module


Hereinafter we will work under Windows as the most familiar OS for most users.

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

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

Installing GNU/Linux


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

To ensure that all components are installed correctly, I will leave a few screenshots of the installation process. In principle, there is nothing complicated in the installation.

So that all components are installed correctly, I will leave a few screenshots of the installation process. In principle, the installation is nothing complicated.
  1. Accept License Agreement
    ITKarma picture
  2. Specify the installation folder
    ITKarma picture
  3. We leave the necessary components unchanged
    ITKarma picture
  4. Leave as is
    ITKarma picture
  5. Several times “Next”, “Install” and basically everything
    ITKarma picture


Installing Cygwin


Further, for development, you will need a set of libraries and utilities from the set provided by 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, version 3.1.5 was available, and we used it when preparing the material.

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

Driver Installation


After the module is connected to the PC, you will need to install the driver. They can be requested from your distributor (recommended). I do not recommend searching on the Internet myself, as It may take a long time to search for what the device conflict was related to.

ITKarma picture

Среди выделенных портов мы видим следующие:
Windows Linux Описание
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

Как вы наверняка обратили внимание, среди портов на скриншоте нет USB ADB, это по причине того, что ADB порт в модуле по умолчанию закрыт и его нужно включить, отправив команду ‘AT+CUSBADB=1’ в АТ-порт модуля и перезагрузить его (это можно сделать командой ‘AT+CRESET’).

В итоге получим нужный интерфейс в диспетчере устройств:

ITKarma picture

С драйверами закончили, переходим к ADB.

Установка ADB


Заходим на официальный сайт Android Developer по ссылке . Не будем качать громоздкий Android Studio, нам достаточно командной строки, доступную для скачивания по ссылке «Download SDK Platform-Tools for Windows».

ITKarma picture

Качаем и распаковываем полученный архив в корень диска C.

Переменные среды


После установки Cygwin потребуется добавить путь Cygwin/bin/в переменные среды разработки (Классическая Панель управления → Система → Дополнительные параметры системы → Дополнительно → Переменные среды → Системные переменные → Path → Изменить) так как показано на скриншоте ниже:

ITKarma picture

Аналогичным образом добавляем путь к скачанному и распакованному архиву ADB в корень диска C.

ITKarma picture

Несколько раз нажимаем ОК и перезагружаем компьютер.

После перезагрузки можно легко проверить корректно ли работает ADB, открыв командную строку (Win+R → cmd) и набрав команду ‘adb version’. Получим примерно такой результат:

ITKarma picture

Подключим модуль к ПК (если так случилось что отключили) и проверим видит ли его ADB командой ‘adb devices’:

ITKarma picture

Готово, на этом настройка подключения к модулю завершена и мы можем запустить shell для работы с модулем.

ITKarma picture

Распаковка и компиляция SDK


После того как мы получили доступ к shell и можем начать работу с командной строкой модуля, попробуем скомпилировать наше первое приложение для загрузки в модуль.

С этим у многих могут возникнуть сложности! Т.к. модуль работает на операционной системе Linux, во избежание коллизий при компиляции кода под Windows – лучше всего компилировать в родной среде – Linux.

Не будем подробно останавливаться на том, как в отсутствие Linux и желания устанавливать его на свою машину, можно установить его на виртуальную. Мы же воспользуемся VirtualBox, установим Ubuntu версии 20.04 (актуальная версия на момент написания статьи) и уже под ней начнем работу с компиляторами, SDK и т.п.

Переходим в среду Linux и распаковываем архив, полученный от дистрибьютора.

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 has not been installed:

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

Python if it has not been installed as well:

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, we execute the following commands sequentially.

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

Running:

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

Compiling 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 

Compiling 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 

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 to load the demo into our module and see what happens.

Download


In the sim_open_sdk directory we can see the demo_app file. We take it and transfer it to the root of drive C on the PC to which the module is connected. Then run the Windows command line (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 was successfully sent to the module and we can only run it. Let's not hesitate.

Running:

C:\>adb shell 

Extending the rights of the downloaded file:

/# cdhmod 777/data/demo_app 

And 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 see the IMEI of the module, enter 7 (go 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 > 

So we will see the IMEI module.

In conclusion


I hope we were able 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 possibilities offered by the SIM7600E-H platform, as well as how to 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 features should be reflected in subsequent articles.

Source