Professional Documents
Culture Documents
QuecOpen
Quick Start Guide
Version: 1.0
Date: 2021-04-07
Status: Released
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
Our aim is to provide customers with timely and comprehensive service. For any assistance,
please contact our company headquarters:
General Notes
Quectel offers the information as a service to its customers. The information provided is based upon
customers’ requirements. Quectel makes every effort to ensure the quality of the information it makes
available. Quectel does not make any warranty as to the information contained herein, and does not
accept any liability for any injury, loss or damage of any kind incurred by use of or reliance upon the
information. All information supplied herein is subject to change without prior notice.
Disclaimer
While Quectel has made efforts to ensure that the functions and features under development are free
from errors, it is possible that these functions and features could contain errors, inaccuracies and
omissions. Unless otherwise provided by valid agreement, Quectel makes no warranties of any kind,
implied or express, with respect to the use of features and functions under development. To the maximum
extent permitted by law, Quectel excludes all liability for any loss or damage suffered in connection with
the use of the functions and features under development, regardless of whether such loss or damage
may have been foreseeable.
Duty of Confidentiality
The Receiving Party shall keep confidential all documentation and information provided by Quectel,
except when the specific permission has been granted by Quectel. The Receiving Party shall not access
or use Quectel’s documentation and information for any purpose except as expressly provided herein.
Furthermore, the Receiving Party shall not disclose any of the Quectel's documentation and information
to any third party without the prior written consent by Quectel. For any noncompliance to the above
requirements, unauthorized use, or other illegal or malicious use of the documentation and information,
Quectel will reserve the right to take legal action.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 1 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
Copyright
The information contained here is proprietary technical information of Quectel. Transmitting, reproducing,
disseminating and editing this document as well as using the content without permission are forbidden.
Offenders will be held liable for payment of damages. All rights are reserved in the event of a patent grant
or registration of a utility model or design.
Copyright © Quectel Wireless Solutions Co., Ltd. 2021. All rights reserved.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 2 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
Revision History
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 3 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
Contents
1 Introduction ......................................................................................................................................... 8
2 Preparations ........................................................................................................................................ 9
2.1. Host System ............................................................................................................................... 9
2.2. Compiler and Debugging Tool.................................................................................................... 9
2.3. Developer Experience................................................................................................................ 9
2.4. Hardware .................................................................................................................................... 9
2.5. QuecOpen SDK ....................................................................................................................... 10
3 QuecOpen® SDK................................................................................................................................ 11
5 Compilation ....................................................................................................................................... 17
5.1. Compilation Process ................................................................................................................ 17
5.2. Compilation Output .................................................................................................................. 17
6 Download ........................................................................................................................................... 18
6.1. Download through TE-A ........................................................................................................... 18
6.2. Download through Debug Port of QuecOpen Modules ........................................................... 18
7 Debugging ......................................................................................................................................... 20
7.1. Serial Port Printing Debugging ................................................................................................ 20
7.2. Debug and Download with CoolWatcher ................................................................................. 20
7.2.1. Debug Application Program with CoolWatcher ............................................................. 20
7.2.2. Download Application Program with CoolWatcher ....................................................... 24
9 Quick Programming.......................................................................................................................... 26
9.1. GPIO Programming.................................................................................................................. 26
9.1.1. Confirm the Header Files to be Included ...................................................................... 26
9.1.2. GPIO Programming....................................................................................................... 26
9.1.3. Control Timer and LED Light......................................................................................... 27
9.1.4. Run the Application ....................................................................................................... 31
9.2. GPRS Programming ................................................................................................................ 31
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 4 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
10 Precautions........................................................................................................................................ 38
10.1. External WatchDog .................................................................................................................. 38
10.2. Reboot Solution........................................................................................................................ 38
10.3. Add User Task .......................................................................................................................... 38
10.4. Timer ........................................................................................................................................ 38
10.5. UART........................................................................................................................................ 39
10.6. GPRS and TCP ........................................................................................................................ 39
10.7. Dynamic Memory Allocation..................................................................................................... 40
10.8. Application Debugging ............................................................................................................. 40
11 Appendix A References.................................................................................................................... 41
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 5 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
Table Index
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 6 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
Figure Index
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 7 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
1 Introduction
Quectel M65, M08-R and MC65 modules support QuecOpen® solution. QuecOpen® is an open-source
embedded development platform based on Linux system. It is intended to simplify the design and
development of IoT applications.
This document introduces how to use the QuecOpen® SDK package to quickly start the development of
QuecOpen® modules, and describes the structure of SDK directory, development environment
construction, compilation, download, debugging, demonstration and quick programming of the application
as well as relevant precautions.
NOTE
"OpenCPU" has already been changed to "QuecOpen". However, "OpenCPU" in some examples or
diagrams remains unchanged to avoid confusion.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 8 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
2 Preparations
Before design and programming of the QuecOpen application, it is necessary to confirm whether the
following software and hardware components listed in this chapter are ready.
When you need related software package, please contact the Quectel technical support team
(support@quectel.com).
2.4. Hardware
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 9 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
For hardware components, please contact the Quectel technical support team (support@quectel.com).
Please contact the Quectel technical support team (support@quectel.com) to obtain the QuecOpen
SDK package.
⚫ Download tool
The related download tool may be fetched from the folder tools in the SDK package.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 10 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
3 QuecOpen® SDK
The folder structure of QuecOpen SDK can be found after the software package is decompressed. For
example, a typical directory structure of QuecOpen_GS5_SDK_V1.0 is as follows:
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 11 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 12 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
4 Development Environment
Construction
The steps include: create a folder CSDTK4 under root directory of the disk C and decompress the latest
CSDTK tool kit to CSDTK4. When you need the tool kit, please contact the Quectel technical support
team (support@quectel.com).
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 13 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
The steps include: create a folder cooltools under the root directory of the disk C, and decompress the
latest tool kit cooltools which includes CoolWatcher by default to the folder cooltools. When you need the
tool kit, please contact the Quectel technical support team (support@quectel.com).
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 14 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
⚫ Run coolwatcher.exe, then select the corresponding platform “8955” in the “Profiles” and enter a
corresponding serial port number (debug port) at “lastcomport”. The previous configuration will be
used by default when CoolWatcher runs. Please reconfigure the platform or serial port if it changes.
⚫ After completing the foregoing settings, click "OK" to enter into CoolWatcher.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 15 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 16 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
5 Compilation
This chapter introduces how to compile QuecOpen application program in the form of command lines.
Shortcut MS-DOS of command lines is included in QuecOpen SDK. SDK codes can be compiled by
executing the following commands. The commands for cleaning compilation files and compiling new
programs are respectively defined as below:
make clean
make new
The following result is output (taking MC65 QuecOpen as an example) if the compilation succeeds. And
the generated files are stored in SDK\build\gcc.
Compilation information is output during compilation in the form of command lines. All warnings and
errors are saved in SDK\build\gcc\build.log. Code errors can be investigated by reviewing error lines and
error tips of file build.log.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 17 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
6 Download
If Quectel TE-A (demonstration board, as shown below) is used, please connect the GSM EVB first, and
then download the program via the Mini USB interface of the TE-A. Before transmitting data through the
Mini USB interface, please ensure that a driver program of the serial port chip (XR21B1411) is correctly
installed.
Figure 7: TE-A
If the module is soldered onto a motherboard of a customer device, please download the program through
the debug port of the module.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 18 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
Before downloading the program, please ensure that the serial port has been connected normally
(DBG_TXD and DBG_RXD are respectively connected to the RXD and TXD of the customer device) and
corresponding serial port driver has been installed correctly.
M65 QuecOpen 39 38
M08-R QuecOpen 25 26
MC65 QuecOpen 29 30
It is recommended that QFlash provided by Quectel is used to download the application program. This
tool can be found in tools of SDK. For detailed usages, please refer to document [1].
Figure 8: QFlash
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 19 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
7 Debugging
There are two ways to debug application program of M65, M08-R and MC65 QuecOpen modules:
The steps are as follows: Call Ql_UART_Open() to open UART 1 (main serial port) or UART 2 (auxiliary
serial port), call Ql_UART_Write() to output debugging information, and then receive debugging
information with QCOM tool (other serial debugging tool is accepted).
Generally, if abnormal rebooting or a network error occurs, it is recommended that the CoolWatcher be
used to capture a log and then to send the log to Quectel for analysis. The log can also be output to the
CoolWatcher through the debug port by calling Ql_Debug_Trace().
The steps are as follows: Select "Plugins" from the menu column in the navigation page of CoolWathcer,
click on "Activate Tracer" to activate the trace tool.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 20 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
Clean up
Save
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 21 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
⚫ Enter the operation interface of the trace tool, click to set the trace levels. Please check the
relevant level in the table on the left side of the picture below.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 22 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
Options Description
Whether to save Trace automatically. Trace is saved automatically if
Auto Save Trace
checking this option.
Bin/Trc Type of Trace file. Bin means binary file and trc means test file.
Size of Trace file. The file will be segmented automatically if the total size
Split Size
is larger than this value.
Directory The saved path.
Save ReceivedTime in Trc Whether to save the time when the tool resolves Trace.
This option needs to stay pace with .lod file. Please check this option If
Tick in Flow ID 0x80
the .lod file has timestamp, otherwise, please uncheck.
Receive Event Whether to receive event.
⚫ Go back to the operation interface of Trace tool, click to enable the Trace function. Trace
information will be displayed in the table as below:
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 23 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
⚫ The printed log can be searched and filtered by entering key information into the textbox in the upper
right corner.
NOTES
1. The .trc file can be opened by using text editor, such as Notepad++.
2. The default configuration of trace tool can be obtained from files under directory rbbase\comm
on\plugins\tracer\.
⚫ Click of CoolWatcher bar, then select .lod file of kernel firmware package or of application
program from the corresponding file loading path.
NOTES
1. It is not neceesary to reboot the module before downloading, and the module reboots automatically
after successful downloading.
2. This method is applicable to code debugging only. QFlash tool should be used for downloading during
mass production.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 24 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
In the SDK\custom\ directory, it is allowed to add new custom folders or sub-directories. the directory
SDK\custom\main.c is designed for custom projects. You only need to add or change codes in main.c or
simply replace this file. Additionally, newly created source files can be added into this directory, and these
newly-added .c files in SDK\custom\ is compiled automatically.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 25 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
9 Quick Programming
This chapter use two examples to demonstrate how to write application program based on QuecOpen
SDK.
This chapter shows how to control the pin level of a GPIO to drive the LED light, that is, to turn on/off the
LED as programmed.
To confirm the header files to be included, basic requirements of the application need to be confirmed first.
For instance, in this demonstration application, the requirement is to implement the on-off control of the
LED light by changing the level of the GPIO periodically. Therefore, the header files to be included are:
#include "ql_stdlib.h"
#include "ql_trace.h" //Related to log printing.
#include "ql_error.h" //Define all return values of APIs in ql_error.h.
#include "ql_system.h" //QuecOpen application has a message loop process.
#include “ql_uart.h” //Related to serial port.
#include "ql_gpio.h" //Related to GPIO.
#include "ql_timer.h" //Related to timer.
The NETLIGHT pin is already connected to an LED light on Quectel GSM EVB. Therefore, you can
implement on-off control of the LED light by controlling NETLIGHT directly.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 26 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
//Initialize GPIO
ret = Ql_GPIO_Init(m_gpioPin, PINDIRECTION_OUT, PINLEVEL_LOW, PINPULLSEL_PULLUP);
if (QL_RET_OK == ret)
{
APP_DEBUG ("<-- Initialize GPIO successfully -->\r\n");
}
else
{
APP_DEBUG ("<-- Fail to initialize GPIO pin, cause=%d -->\r\n", ret);
}
Step 3: Start a timer and periodically change the level of the GPIO to implement LED blinking.
In this demonstration, the program defines a timer with the timeout of 500 ms, making the LED be on for
500 ms and off for 500 ms.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 27 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
In this case, all programming has been completed, and the complete code is shown below.
#include "ql_stdlib.h"
#include "ql_trace.h"
#include "ql_error.h"
#include "ql_system.h"
#include "ql_gpio.h"
#include "ql_timer.h"
#include "ql_uart.h"
//Define APP_DEBUG
#define DEBUG_ENABLE 1
#define APP_DEBUG(FORMAT,...) {\
Ql_memset(DBG_BUFFER, 0, DBG_BUF_LEN);\
Ql_sprintf(DBG_BUFFER,FORMAT,##__VA_ARGS__); \
if (UART_PORT2 == (DEBUG_PORT)) \
{\
Ql_Debug_Trace(DBG_BUFFER);\
} else {\
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 28 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
}\
#else
#define APP_DEBUG(FORMAT,...)
#endif
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 29 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
//Initialize GPIO
ret = Ql_GPIO_Init(m_gpioPin, PINDIRECTION_OUT, PINLEVEL_LOW, PINPULLSEL_PULLUP);
if (QL_RET_OK == ret)
{
APP_DEBUG ("<-- Initialize GPIO successfully -->\r\n");
}else{
APP_DEBUG ("<-- Fail to initialize GPIO pin, cause=%d -->\r\n", ret);
}
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 30 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
{
}
Copy the complete code to SDK\custom\main.c to overwrite the existing code, and compile the code.
Then download the generated executable file (.lod) into the module.
When the application runs, D502 LED on GSM EVB will blink at intervals of 500 ms and the main UART
will output the following log information:
This chapter describes how to start a TCP connection with a GPRS network to send data to a TCP server.
To confirm the header files to be included, requirements of the application need to be confirmed first. For
instance, in this demonstration application, the requirement is to connect the TCP server via socket and
send data to the TCP server.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 31 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
#define PDP_CONTEXT_ID 0
static ST_GprsConfig m_GprsConfig = {
"CMNET", //APN name
"", //User name for APN
"", //Password for APN
0,
NULL,
NULL,
};
The APN is configured as China Mobile "CMNET" in this demonstration and may change depending on
actual situation.
The IP address and port are configured as Quectel public server and socket port and may change
depending on actual situation.
When a socket connection is established, a buffer is needed to receive data from the server.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 32 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
Before using QuecOpen RIL function, the application needs to call Ql_RIL_Initialize() to initialize the
features related to RIL when the main task receives MSG_ID_RIL_READY.
Before accessing GPRS network, it is required to wait for the module to register on GPRS network.
Application receives URC message URC_GPRS_NW_STATE_IND if the module network registration is
completed successfully. Before receiving this URC message, application will receive other URC
messages that indicate module initialization status, such as the status of AT+CFUN, (U)SIM card and
GSM network change, during the system initialization process. Please control these URC messages
depending upon specific requests.
/************************************************************************/
/* The entrance procedure for this example application */
/************************************************************************/
void proc_main_task(s32 taskId)
{
ST_MSG msg;
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 33 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
while(TRUE)
{
Ql_OS_GetMessage(&msg);
switch(msg.message)
{
case MSG_ID_RIL_READY:
Ql_Debug_Trace("<-- RIL is ready -->\r\n");
Ql_RIL_Initialize();
break;
case MSG_ID_URC_INDICATION:
//Ql_Debug_Trace("<-- Received URC: type: %d, -->\r\n", msg.param1);
switch (msg.param1)
{
case URC_SYS_INIT_STATE_IND:
Ql_Debug_Trace("<-- Sys Init Status %d -->\r\n", msg.param2);
break;
case URC_SIM_CARD_STATE_IND:
Ql_Debug_Trace("<-- SIM Card Status:%d -->\r\n", msg.param2);
break;
case URC_GSM_NW_STATE_IND:
Ql_Debug_Trace("<-- GSM Network Status:%d -->\r\n", msg.param2);
break;
case URC_GPRS_NW_STATE_IND:
Ql_Debug_Trace("<-- GPRS Network Status:%d -->\r\n", msg.param2);
if (NW_STAT_REGISTERED == msg.param2)
{
GPRS_Surf();
}
break;
case URC_CFUN_STATE_IND:
Ql_Debug_Trace("<-- CFUN Status:%d -->\r\n", msg.param2);
break;
default:
Ql_Debug_Trace("<-- Other URC: type=%d\r\n", msg.param1);
break;
}
break;
default:
break;
}
}
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 34 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
GPRS programming can be performed after the module registers on GPRS network successfully. The
main steps of GPRS programming are as follows. For detailed GPRS API usage, please refer to the
following steps:
ST_PDPContxt_Callback callback_gprs_func = {
//Callback_GPRS_Actived,
NULL,
Callback_GPRS_Deactived
};
ST_SOC_Callback callback_soc_func = {
//Callback_socket_connect,
NULL,
Callback_Socket_Close,
//Callback_socket_accept,
NULL,
Callback_Socket_Read,
Callback_Socket_Write
};
ret=Ql_GPRS_Config(PDP_CONTEXT_ID, &m_GprsConfig);
if (GPRS_PDP_SUCCESS == ret)
{
Ql_Debug_Trace("<-- Configure GPRS PDP -->\r\n");
}else{
Ql_Debug_Trace("<-- Fail to configure GPRS PDP, ret=%d. -->\r\n", ret);
return;
}
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 35 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
ret=Ql_GPRS_Activate(PDP_CONTEXT_ID);
if (ret == GPRS_PDP_SUCCESS)
{
m_GprsActState = 1;
Ql_Debug_Trace("<-- Activate GPRS successfully. -->\r\n\r\n");
}else{
Ql_Debug_Trace("<-- Fail to activate GPRS, ret=%d. -->\r\n\r\n", ret);
return;
}
ret=Ql_GPRS_Deactivate(PDP_CONTEXT_ID);
Ql_Debug_Trace("<-- Deactivate GPRS, ret=%d -->\r\n\r\n", ret);
After the GPRS PDP context is activated, TCP/UDP socket programming can continue to be performed.
The main steps of socket programming are as follows. For detailed socket API usage, please refer to the
following steps:
ret=Ql_SOC_Register(callback_soc_func, NULL);
if (SOC_SUCCESS == ret)
{
Ql_Debug_Trace("<-- Register socket callback function -->\r\n");
}else{
Ql_Debug_Trace("<-- Fail to register socket callback, ret=%d. -->\r\n", ret);
return;
}
m_SocketId=Ql_SOC_Create(PDP_CONTEXT_ID, SOC_TYPE_TCP);
if (m_SocketId >= 0)
{
Ql_Debug_Trace("<-- Create socket successfully, socket id=%d. -->\r\n", m_SocketId);
}else{
Ql_Debug_Trace("<-- Fail to create socket, ret=%d. -->\r\n", m_SocketId);
return;
}
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 36 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
Data can be transmitted to or received from the server after the socket is connected to the server
successfully.
char pchData[200];
s32 dataLen=0;
u64 ackNum=0;
Ql_memset(pchData, 0x0, sizeof(pchData));
dataLen += Ql_sprintf(pchData + dataLen, "%s", "Q u e c t e l");
ret=Ql_SOC_Send(m_SocketId, (u8*)pchData, dataLen);
if (ret ==dataLen)
{
Ql_Debug_Trace("<-- Send socket data successfully. --> \r\n");
}else{
Ql_Debug_Trace("<-- Fail to send socket data. --> \r\n");
}
The codes above demonstrate how to send data "Q u e c t e l" to the server.
After the data is sent, Ql_SOC_GetAckNumber() can be called to check whether the server has received
the data. Additionally, the socket connection can be disabled by calling Ql_SOC_Close(), and GPRS PDP
can be deactivated by calling Ql_GPRS_DeactivateEx().
The complete code of this example can be found in the file example_tcp_demo.c of SDK, which supports
compilation and running. For detailed usage, please refer to above description.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 37 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
10 Precautions
10.1. External WatchDog
In order to protect the application from logic exceptions from which the application has difficulty in
recovering, it is recommended to add external WatchDog chip during product designing. For related
designs, please refer to document [2] and document [3]. When the external WatchDog overflows, VBAT
pin of the module will be reset, implementing power-off and rebooting to reset the module.
To ensure the continuous stable operation of the module, it is recommended to add reboot solution during
the software design. In case of network errors, the reboot solution can be adopted to expect automatic
recovery of the module.
proc_name is the entry function name of the new task, and subtask1_id is task ID of the new task.
If messages need to be processed in the task, please add a Ql_OS_GetMessage() interface (Callbacks of
interfaces such as timers and TCP are triggered by messages. Without such interface, these functions
would be unavailable) into the task. After calling this interface, if no message needs to be processed, the
task will be blocked here and CPU access stops.
10.4. Timer
Common timer and fast timer are provided in QuecOpen solution. A maximum of 10 common timers are
available for each task, and also 10 fast timers at most are available for the whole application.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 38 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
When registering a common timer, a current task ID needs to be bound. Timer is not supported in ISR.
The task using Ql_Timer_Start() and Ql_Timer_Stop() should be the same as the task during timer
registration. Otherwise, a calling failure occurs.
When the common timer runs, if the Ql_OS_GetMessage() interface cannot be called in the task in a
timely manner to process a timeout message of the timer, the callback function of the timer will not be
processed in a timely manner.
The interrupt of fast timer is triggered by hardware directly, enjoying high real-time performance. However,
please avoid excessive workloads for the interrupt function, otherwise, a system exception may be
caused.
10.5. UART
M65, M08-R and MC65 QuecOpen modules provide three UART ports: a main serial port (UART 1), an
auxiliary serial port (UART 2) and a debug port. UART 1 and UART 2 both can implement the baud rate of
115200 bps by default, and therefore, can be used for application development. The serial data format is
8N1 (8 data bits, no parity and 1 stop bit). The data buffer sizes of the UART ports are 4096 bytes. The
debug port can only be used to download and cooperate with the tool CoolWatcher for debugging
application.
Executing tasks of GPRS and TCP callback functions is registering these callback functions. If received
messages cannot be processed in a timely manner in the current task, execution of these callback
functions will be delayed.
API synchronization of GPRS and TCP in the module will block task execution. In order to avoid long-time
blocking, it is recommended to use asynchronous APIs as interfaces related to general network services.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 39 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
You can call Ql_MEM_Alloc() to specify the volume of dynamic memory or call Ql_MEM_Free() to release
the memory. The maximum volume of the dynamic memory for an application is 500 KB.
In a QuecOpen application, printing a Trace log via a serial port is the main debugging way. Generally,
users can print information into serial port debugging tool via the APP_DEBUG interface and check, by
using the log information, whether the service process is normal. If the module has faults such as
abnormal rebooting, dump, abnormal network registration or data service, it is appreciated that a kernel
log obtained via the tool CoolWatcher can be provided to Quectel for analysis.
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 40 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
11 Appendix A References
Table 5: Related Documents
Abbreviation Description
APP Application
DB Database
ID Identifier
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 41 / 42
GSM/GPRS/GNSS Module Series
M65&M08-R&MC65 QuecOpen Quick Start Guide
M65&M08-R&MC65_QuecOpen_Quick_Start_Guide 42 / 42