├── HelloWorld ├── main.c ├── CMakeLists.txt ├── build.sh └── .gitignore ├── .gitignore ├── LICENSE └── README.md /HelloWorld/main.c: -------------------------------------------------------------------------------- 1 | #include "stdio.h" 2 | 3 | int main(void){ 4 | 5 | printf("Hello QuecOpen \r\n"); 6 | 7 | return 0; 8 | } -------------------------------------------------------------------------------- /HelloWorld/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 2.6) 2 | 3 | set(APP_NAME HelloWorld) 4 | 5 | project (${APP_NAME} ) 6 | 7 | add_executable(${APP_NAME} main.c) 8 | target_link_libraries (${APP_NAME} ) -------------------------------------------------------------------------------- /HelloWorld/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Create build directory 4 | if [ ! -d build ]; then 5 | echo "Create build folder \r\n" 6 | mkdir build 7 | fi 8 | 9 | cd build 10 | 11 | if [ ! -f Makefile ]; then 12 | echo "Makefile is not exist. Run Cmake ... " 13 | cmake .. 14 | fi 15 | 16 | echo "Build program ... \r\n" 17 | make 18 | -------------------------------------------------------------------------------- /HelloWorld/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | 54 | # Remove SDK folder 55 | build/ 56 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Macfiles 2 | .DS_Store 3 | 4 | # Prerequisites 5 | *.d 6 | 7 | # Object files 8 | *.o 9 | *.ko 10 | *.obj 11 | *.elf 12 | 13 | # Linker output 14 | *.ilk 15 | *.map 16 | *.exp 17 | 18 | # Precompiled Headers 19 | *.gch 20 | *.pch 21 | 22 | # Libraries 23 | *.lib 24 | *.a 25 | *.la 26 | *.lo 27 | 28 | # Shared objects (inc. Windows DLLs) 29 | *.dll 30 | *.so 31 | *.so.* 32 | *.dylib 33 | 34 | # Executables 35 | *.exe 36 | *.out 37 | *.app 38 | *.i*86 39 | *.x86_64 40 | *.hex 41 | 42 | # Debug files 43 | *.dSYM/ 44 | *.su 45 | *.idb 46 | *.pdb 47 | 48 | # Kernel Module Compile Results 49 | *.mod* 50 | *.cmd 51 | .tmp_versions/ 52 | modules.order 53 | Module.symvers 54 | Mkfile.old 55 | dkms.conf 56 | 57 | # Remove SDK folder 58 | ql-ol-sdk/ 59 | *.tar.bz2 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 HaiBac Ngo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Quectel_EC2x_QuecOpen_Examples 2 | 3 | This is QuecOpen examples for Quectel EC2X modules 4 | 5 | ## Requirements 6 | 7 | In order to play with samples, there are some consumptions: 8 | 9 | - EC2X QuecOpen SDK from your local Quectel contact 10 | - Ubuntu machine running LTS Ubuntu 14.04 or 16.04 or 18.04 11 | - EC2X module is flashed with firmware which is same prefix name with the SDK number. In this guide, I will use `EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001_SDK.tar.bz2` for SDK and base FW `EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001.zip` 12 | - Able to use ADB to communicate with the module 13 | 14 | ## Clone the repo 15 | 16 | Clone the repo with --recursive param, so it could also clone the submodule: 17 | 18 | ```bash 19 | git clone --recursive https://github.com/ngohaibac/Quectel_EC2x_QuecOpen_Examples.git 20 | cd Quectel_EC2x_QuecOpen_Examples 21 | ``` 22 | 23 | ## Preparation 24 | 25 | ### Step 1: Upgrade base firmware 26 | 27 | In order to work with QuecOpen, the module needs to be flashed with QuecOpen base firmware EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001.zip. 28 | 29 | Note: the SDK and the base firmware must be matched 30 | 31 | - Base firmware: EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001.zip 32 | - SDK: EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001_SDK.tar.bz2 33 | 34 | ### Step 2: Install driver and extract SDK 35 | 36 | 1. Install driver and test ADB 37 | 38 | Suggested dev environment is: Ubuntu LTS 18.04 or 16.04. 39 | 40 | In order to support all futher Quectel modules, it is suggested to install drivers and configure the system to recognize ADB port. Follow the instruction in folder `Quectel_Module_ADB_Issue'. This is the most important step. 41 | 42 | Now, you should see the device with command: `adb devices`, and also see 4 serial ports: 43 | 44 | - /dev/ttyUSB0 - DM port for upgrade firmware and get the device log 45 | - /dev/ttyUSB1 - get NMEA message output 46 | - /dev/ttyUSB2 - for AT command communication 47 | - /dev/ttyUSB3 - for PPP connections or AT communication 48 | 49 | You also able to login to the device using: 50 | 51 | ```bash 52 | adb shell 53 | ``` 54 | 55 | 1. SDK Copy the SDK and extract: 56 | 57 | ```bash 58 | cp /path/EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001_SDK.tar.bz2 . 59 | tar xjvf EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001_SDK.tar.bz2 60 | ``` 61 | 62 | Folder structure: 63 | 64 | ```bash 65 | tree -L 2 66 | . 67 | |-- EC21EFAR06A01M4G_OCPU_01.001.01.001.zip 68 | |-- EC21EFAR06A01M4G_OCPU_01.001.01.001_SDK.tar.bz2 69 | |-- Quectel_EC2x_QuecOpen_Examples 70 | | |-- HelloWorld 71 | | |-- LICENSE 72 | | `-- README.md 73 | `-- ql-ol-sdk 74 | |-- Makefile 75 | |-- ql-ol-crosstool 76 | |-- ql-ol-extsdk 77 | |-- ql-ol-kernel 78 | |-- ql-ol-rootfs.tar.gz 79 | `-- ql-ol-usrdata 80 | ``` 81 | 82 | In order to prepare cross platform environment, please execute this before each build session. 83 | 84 | ```bash 85 | source ql-ol-sdk/ql-ol-crosstool/ql-ol-crosstool-env-init 86 | ``` 87 | 88 | ## Step 3: Compile the example 89 | 90 | ### Compile the source 91 | 92 | Inside each folder, run bash script or cmake to create Makefile: 93 | 94 | ```bash 95 | cd HelloWorld 96 | sh build.sh 97 | ``` 98 | 99 | OR 100 | 101 | ```bash 102 | cd HelloWorld 103 | mkdir build 104 | cd build 105 | cmake .. 106 | make 107 | ``` 108 | 109 | Result is in build/ folder. 110 | 111 | ### Run and debug inside QuecOpen 112 | 113 | Inside the build directory, copy the program into /usrdata 114 | 115 | ```bash 116 | adb push HelloWorld /usrdata 117 | adb shell 118 | ``` 119 | 120 | Inside the shell: 121 | 122 | ```bash 123 | cd /usrdata 124 | ./HelloWorld 125 | ``` 126 | 127 | ## EC2x available resources and notes 128 | 129 | Inside EC2x, chipset is Qualcomm 9x07 and application is running on the ARM-Cortex A7. There are 2 available libraries in QuecOpen: 130 | 131 | - Qualcomm dependent libs: located inside ql-ol-extsdk, which are provided by Quectel 132 | - Standard Linux dependent libs: follow the Linux standard with compiled binary files and header files are located in ql-ol-crosstool/sysroots/. If the application needs extra function which is not yet compiled, user could compile and put into the rootfs 133 | 134 | Available resource: 135 | 136 | - RAM: 100MB 137 | - Flash: Root partition 100MB 138 | - User partiton: 100MB, is mouted under `/usrdata` 139 | 140 | Current DTS has following peripheral info: 141 | 142 | - SPI6 - `/dev/spi` 143 | - I2C-2 - `/dev/i2c-2` 144 | - I2C-4 - `/dev/i2c-4` 145 | - UART-5 - `/dev/ttyHSL1` (disabled by default) 146 | - UART-2 - `/dev/ttyHSL0` (enabled by default; for debug port) 147 | - UART-6 - `/dev/ttyHSL2` (disabled by default; with SPI) 148 | - UART-3 - `/dev/ttyHS0` (enabled by default) 149 | 150 | To communicate with the baseband core, use: `/dev/smd8` --------------------------------------------------------------------------------