This Application Note will enable you to use a Cellular Framework module in your own design. Upon
completion of this application project, you will be able to add this module to your own design, configure it
correctly for the target application, and write code using the included application code as a reference and
starting point. References to more detailed API descriptions and suggestions of other applications, that
describe advanced uses of the module are available on the Renesas Synergy
referenced in the reference section of this document and should be a valuable resource for creating more
complex designs.
The Cellular Framework module is a high-level application layer interface for the cellular modem integration
on the SSP Application Framework and provides sets of APIs to provision, configure and to communicate
with the cellular network for data communication. Cellular Framework uses the SSP Application Framework
(console framework) to communicate with the Cellular modems with serial interface by using AT commands
internally. SSP Application framework also creates the serial data pipe over serial interface for the data
™
communication, leverag ing the PP P W AN protoc ol pro vi ded b y NetX
. Any TCP/IP communication can be
established over this Wide Area Network (WAN) link using the sockets, NetX Application protocols, and IoT
protocols such as MQTT or COAP.
The Cellular Framework also provides the framework level Socket APIs to communicate with the TCP/IP
stack present on-chip (inside cellular hardware module) in certain cellular hardware modules and there by
communicating with the inter net network, using the socket APIs.
™
Knowledge Base as
Required Resources
To build and run the Cellular Framework Application example, you need:
• Renesas Synergy™ PK-S5D9 kit
2
• e
studio ISDE v7.3.0 or later, or IAR Embedded Workbench® for Renesas Synergy™ v8.23.3 or later
• Synergy Software Package (SSP) 1.6.0 or later, or Synergy Standalone Config ur ator (S SC) 7.3.0 or later
• SEGGER J-Link
• Renesas Synergy USB CDC driver for Windows
®
and its associated USB driver
®
7 (attached in the bundle)
• Windows 7/10 test PC with Console Application like Tera Term or equivalent application installed.
• NimbeLink
™
LTE CAT3 Cellular modem with PMOD adaptor module (Part Num. NL-SW-LTE-TSVG for
• Quectel BG 96 CATM1 Cellular modem with Arduino shield (Rev F board)
• SIM card from the service provider
• Micro USB cables
• Download all the required Renesas (SSP) from the Renesas Synergy
™
Gallery
(https://synergygallery.renesas.com).
Prerequisites and Intended Audience
This application note assumes you have some experience with e
well as the Synergy Software Package (S SP). Bef ore per f orming application note procedures, build and run
the Blinky project in the SSP User Manual. Doing so enables you to become familiar with e
SSP, and ensure that the debug connection to your board functions properly.
2
studio ISDE or IAR EW for Synergy, as
2
studio and the
In addition, this application note assumes you have some knowledge of Cellular networks, as well as 3GPP
standards and communication protocols. Also helpful is an understanding of TCP/IP and its layered
architecture, LAN technologies, WAN technologies, BSD socket communications, and so on.
The intended audience are users who want to develop applications with a Cellular framework module using
S3, S5, S7 Synergy MCU Series.
10. Cellular Framework Module Next Steps ................................................................................. 67
11. Reference Information ........................................................................................................... 68
Revision History ............................................................................................................................ 70
R30AN0311EU0105 Rev.1.05 Page 2 of 70
Apr.26.19
Renesas Synergy™ Platform Cellular Framework
1. Cellular Framework Module Overview
The Cellular framework provides a generic interface for the applications to communicate with the Cellular
hardware module, from various vendors without writing the vendor specific interface code. The framework
mainly consists of common set of APIs’, to interface to the networking stack and generic interface driver for
the different Cellular hardware modules. This section introduces the Cellular framework’s basic blocks and
key features that enables you to determine whether the intended Cellular application can be developed using
the Cellular framework.
The application is abstracted from the underlying vendor driver code by the framework. With the Generic
API’s and abstraction, the applications developed for the cellular hardware module can be easily ported with
another cellular hardware module. The networking stack NetX is also integrated with the framework using the
Network Software Abstraction Layer (NSAL).
1.1 Major Blocks of the Cellular Framework
The Synergy Cellular Framework consists of the following logical blocks:
The Cellular Framework provides a common set of interfaces for the application to configure, provision and
to communicate with the Cellular hardware module. By using these Generic interfaces, the user can develop
the Cellular based application using Synergy MCUs. The Cellular hardware module has various configuration
parameters as specified by the family of 3GPP standards. It is possible that individual device drivers and/or
Cellular chipsets/modules will not support configuration of all parameters. At a bare minimum, the network
operator, Access Point Name (APN) and security credentials are required to make the module functional.
1.1.2 Network Stack Abstraction Layer
The Cellular Framework provides a network stack abstraction layer (NSAL). NSAL is layer which connects
the NetX and the Cellular driver by using (PPP) stack that is used for the data communication over WAN link.
1.1.3 Socket Interface Layer
The Cellular Framework provides a Socket level API for the application to interact with the on-chip
networking stack present on the Cellular hardware module. This requires the Cellular hardware
module/driver to support an on-chip networking stack and socket interface. When the application uses these
APIs, it uses the on-chip networking stack present on the Cellular hardware module and does not use the
NSAL or the NetX and its Socket APIs and does not use the Networking stack running on the Synergy MCU
Group.
1.1.4 PPP Stack
Point to point protocol (PPP) is widely used WAN protocol in the Data communication. NetX provides the
PPP stack support as part of the SSP. NSAL leverages the PPP stack to communicate over the serial
interface to the cellular service provider’s network. PPP provides options that handles authentication
methods like PAP/CHAP. Although these authentication mechanisms are optional, NSAL makes use of
framework APIs to send/receive data from the Cellular hardware module. NSAL allows the cellular device
driver to be re-used without any changes specific to the network stack.
1.1.5 Cellular Device Driver
Cellular Framework uses the AT command set to interact with the Cellular modem using the serial driver.
The serial interface used to interact with the modem is UART. The UART speed used in the framework
defaults are up to 115200bits/sec.
2. Cellular Framework Module Operational Overview
Figure 1 shows the user application perspective, in which the application can be used in two different paths
for the communication using the framework depending on the support available on the Cellular modems.
Some modules provide options to use the TCP/IP stack at the Host end and other modules provide options
to use the TCP/IP stack present on the Cellular modem itself. In some cases, cellular hardware module
provides both. When the host TCP/IP stack (NetX) is used, the logical layers of NetX, NSAL, PPP are used
as described in the Architecture diagram. When the on-chip stack is used, the Socket APIs are used to
communicate with the TCP/IP stack present on the Cellular modem. However, the user cannot use both at
the same time.
R30AN0311EU0105 Rev.1.05 Page 4 of 70
Apr.26.19
Renesas Synergy™ Platform Cellular Framework
2.1 Cellular Framework Module Initialization
As shown below in the control flow diagram, during the initialization using the configuration supplied by the
user as required for the Cellular modem, NetX nx_ip_create is called that internally invokes the NSAL
driver entry function that takes care of the link level initialization and initializes the cellular hardware module.
In addition, it provisions the module and establishes the Network connection using the PPP interface.
Provisioning of the part of the provisioning structure. The arguments used for provisioning is done using the
control structure and the user configured parameter as the provision of the Cellular modem are the
authentication, APN, username and password. In the case of the Cellular Framework, the callback function
provisions the module. You are required to give the APN name, Authentication type and other details
required for provisioning of the module.
R30AN0311EU0105 Rev.1.05 Page 5 of 70
Apr.26.19
Renesas Synergy™ Platform Cellular Framework
2.3 Application Flow Control Using Socket Interface
The following diagram shows the flow for the on-chip stack path usage with the Cellular Socket interface.
The flow diagram in the below, shows the Packet reception for the Cellular Framework using NetX. In the
case of receive when the data is received on the serial interface, the processing thread triggers the callback
function and the callback functions handles the data and sends it to the NetX layers for further processing.
2.6 Cellular Framework Module Important Operational Notes and Limitations
•The current framework supports the NimbeLink CAT3, CAT1 and Quectel BG96 Cellular hardware
module only.
•Firmware upgrade over air (FOTA) is not supported by NimbeLink CAT3 and CAT1 Cellular hardware
module.
Refer to the latest SSP Release Notes for any additional operational limitations for this module.
3. Cellular Framework Module APIs Overview
The Cellular Framework module defines a set of APIs for interacting with the underlying modules using the
generic interface. The following are the APIs used by the Cellular framework to communicate with the driver
and cellular hardware module. Most of the Cellular framework APIs uses the p_ctrl and p_cfg data
structures as part of the API that are created when the instance is created. For quick and better
understanding of the API, the structure and some of its details are explained here. For more information on
the instance structure refer the SSP User Manual.
R30AN0311EU0105 Rev.1.05 Page 8 of 70
Apr.26.19
Renesas Synergy™ Platform Cellular Framework
sf_cellular_ctrl_t
* p_ctrl;
Pointer to the control structure for the Cellular framework
instance
sf_cellular_cfg_t
const *
p_cfg;
Pointer to the config structure for the cellular framework
instance
sf_cellular_api_t
const *
p_api;
Pointer to the API structure for the cellular framework
sf_cellular_op_select_mo
op_select_mode
Cellular Operator selection mode. There
automatic)
sf_cellular_op_t
op
Cellular operator. Valid when operator
the name format.
uint16_t
num_pref_ops
Number of preferred cellular operators in
preferred Operator list
sf_cellular_op_t
pref_ops
COUNT]
Array of structures describing preferred
sf_cellular_timezone_upd
tz_upd_mode
TimeZone update mode policy. This is the
update(enable/disable)
uint8_t
* p_sim_pin
SIM Pin. If the SIM has Pin which is
here
uint8_t
* p_puk_pin
PUK Pin. Personal Unlocking Key (PUK),
of PIN protection.
ssp_err_t
(* p_prov_callback)
ck_args_t * p_args)
Pointer to provisioning callback function,
This instance structure encompasses everything that is needed to use an instance for the Cellular framework
interface. Most of the API uses the control and config structure as parameters when it is used from the
application.
typedef struct st_sf_cellular_instance
{
instance
} sf_cellular_instance_t;
The following structure shows the Cellular configuration parameters that are part of the configuration
structure. Some of these parameters are configured via the configurator. This config information is used by
the underlying drivers when the API’s are called.
typedef struct st_sf_cellular_cfg
{
de_t
ate_mode_t
[SF_CELLULAR_MAX_
PREFFERED_OPERATOR_
are 4 different options available for the
operation mode selection.
Auto (Automatic Operator Selection)
Manual (Manual Operator Selection)
De-register (De-register from the network)
Manual Fallback (Manual with fallback to
selection mode is manual mode. This is
structure within the config structure that
keeps the Cellular Operator Name and
the pref_ops array. User can have
operators
option for automatic time zone
required to unlock, it can be configured
(sf_cellular_callba
R30AN0311EU0105 Rev.1.05 Page 9 of 70
Apr.26.19
is used in 3GPP mobile phones to reset
a personal identification number (PIN) that
has been lost or forgotten. Most Cellular
Modems offer the feature
used in NSAL
Renesas Synergy™ Platform Cellular Framework
void
(* p_recv_callback)
This is the receive callback function used
void
const * p_context
User defined context passed into callback
function
void
const * p_extend
Instance specific configuration for any
sf_cellular_at_cmd_set_t
const * p_cmd_set
Pointer to Instance specific AT command
set
void
* p_driver_handle
Stores information required by underlying Cellular
device driver.
uint8_t
Apn
[SF_CELLULAR_MAX_STRING_LEN]
Access Point Name
sf_cellular_auth_type_t
auth_type
Authentication type:
PAP/CHAP
uint8_t
Username
[SF_CELLULAR_MAX_STRING_LEN]
User name used for
uint8_t
Password
[SF_CELLULAR_MAX_STRING_LEN]
Password used for
sf_cellular_airplane_mode_t
airplane_mode
Airplane mode
uint8_t
context_id
Context ID to be used for
connection
sf_cellular_pdp_type_t
pdp_type
PDP Type for Context
uint8_t
mfg_name[SF_CELLULAR_MFG_NAME_LEN]
Manufacturer name
uint8_t
chipset[SF_CELLULAR_CHIPSET_LEN]
Pointer to string showing Cellular
chipset/driver information.
uint8_t
fw_version[SF_CELLULAR_FWVERSION_LEN]
Cellular firmware version
uint8_t
imei[SF_CELLULAR_IMEI_LEN]
IMEI number
uint16_t
rssi
Received signal strength
indication
uint16_t
ber
Bit rate error
(sf_cellular_callba
ck_args_t * p_args)
} sf_cellular_cfg_t
typedef struct st_sf_cellular_ctrl
{
} sf_cellular_ctrl_t
3.1 Cell ul ar provisioning information structure
typedef struct st_sf_cellular_provisioning
{
by NetX which will take a data packet
from the Cellular hardware module and
hand it over to NetX for further processing
extended configuration
} sf_cellular_provisioning_t
3.2 Cell ul ar info structure information
typedef struct st_sf_cellular_info
{
} sf_cellular_info_t
authentication
authentication
R30AN0311EU0105 Rev.1.05 Page 10 of 70
Apr.26.19
Renesas Synergy™ Platform Cellular Framework
uint32_t
rx_bytes
Bytes received successfully
uint32_t
tx_bytes
Bytes transmitted successfully
uint32_t
rx_err
Bytes receive errors
uint32_t
tx_err
Bytes transmit errors
uint16_t
country_code
Country code
uint16_t
operator_code
Operator code
uint16_t
rssi
RSSI
uint8_t
cid[SF_CELLULAR_CID_LEN]
Cell ID
uint8_t
imsi[SF_CELLULAR_IMSI_LEN]
IMSI
uint8_t
op_name[SF_CELLULAR_MAX_OPERATOR_NAME_LEN]
Operator name
uint8_t
service_domain
Service Domain
Uint8_t
active_band
Active Band
SF_CELLULAR_RESET_TYPE_SOFT
Soft reset module using AT command
SF_CELLULAR_RESET_TYPE_HARD
Hard reset module by toggling Reset Pin
Error Code
Description
SSP_ERR_CELLULAR_CONFIG_FAILED
Cellular module Configuration failed
SSP_ERR_CELLULAR_INIT_FAILED
Cellular module initialization failed.
SSP_ERR_CELLULAR_TRANSMIT_FAILED
Transmission failed
SSP_ERR_CELLULAR_FW_UPTODATE
Firmware is up to date
SSP_ERR_CELLULAR_FW_UPGRADE_FAILED
Firmware upgrade failed
SSP_ERR_CELLULAR_FAILED
Cellular Failed.
3.3 The s ta ti stic and error counters for the cellular instance
typedef struct st_sf_cellular_stats
{
} sf_cellular_stats_t
3.4 The Cellular network status structure
typedef struct st_sf_cellular_network_status
{
} sf_cellular_network_status_t
3.5 Cellular Hardware Module reset type
Typedef enum e_sf_cellular_reset_type
{
} sf_cellular_reset_type_t
Table 1. ssp_err_t (SSP Error Codes):
Note: These are error codes returned by the SSP when the API is used. The table lists error codes specific
to the Cellular framework. For more information and the entire SSP Error codes refer the SSP User Manual or the (synergy/ssp/inc/ssp_common_api.h).
It initializes and enables the Cellular hardware module for data transfers. It does initial driver configuration,
enables the driver link, enables interrupts and makes the device ready for data transfer.
3.6.2 close
Description: It de-initializes and disables the Cellular hardware module for any communication. It deactivates
the PDP context.
Table 1. ssp_err_t (SSP Error Codes):
3.6.3 provisioningGet
Description: It gets the provisioning information for the cellular hardware module
Pointer to the control structure for the
Cellular framework instance
sf_cellular_onchip_stack_cfg_t
const *
p_cfg
Pointer to the config structure for the cellular
framework instance
sf_cellular_onchip_stack_api_t
const *
p_api
Pointer to the API structure for the cellular
sf_cellular_instance_t
*p_lower_lvl_cellular
Pointer to SF Cellular instance
3.6.18 fotaStop
Description: Stops the Firmware upgrade
3.6.19 reset
Reset cellular hardware module
3.7 Cellular Framework Socket Interface API
The Cellular Framework module provides a set of APIs for interacting with the Cellular hardware modules
that have an on-chip stack using the socket interface. The following are the APIs used by the Cellular
Framework to communicate with the on-chip stack on the Cellular hardware module. Framework provides
two sets of APIs to communicate with the on-chip module. The first set of APIs uses the p_ctrl and p_cfg
data structures as part of the API which are created when the instance is created. The second set of APIs
are the socket interface to create TCP/UDP sockets for data communications. For a quick and better
understanding of the API, the structure and its details are explained in the SSP User Manual.
This instance structure encompasses everything that is needed to use an instance for the Cellular framework
interface.
Table 2. On-chip socket API error codes for CAT3 and CAT1
3.7.1 open
Description: It initializes and enables the Cellular hardware module for data transfers. It does initial driver
configuration, enable the driver link, enable interrupts and makes the device ready for data transfer.
3.7.2 close
Description: Pointer to function which un-initialize the network interface and may put it in low power mode or
power it off. Close the driver, disables the driver link, disable interrupt.
R30AN0311EU0105 Rev.1.05 Page 18 of 70
Apr.26.19
Renesas Synergy™ Platform Cellular Framework
Parameter
Name
Direction
Description
p_version
Out
p_version pointer to memory location to return version
Code