Configuration

This is the default configuration of the middleware. When any of the settings shall be modified, it shall be done in dedicated application config lwgsm_opts.h file.

Note

Check Getting started for guidelines on how to create and use configuration file.

group LWGSM_OPT

GSM-AT options.

Defines

LWGSM_CFG_OS

Enables 1 or disables 0 operating system support for GSM library.

Note

Value must be set to 1 in the current revision

Note

Check OS configuration group for more configuration related to operating system

LWGSM_CFG_MEM_CUSTOM

Enables 1 or disables 0 custom memory management functions.

When set to 1, Memory manager block must be provided manually. This includes implementation of functions lwgsm_mem_malloc, lwgsm_mem_calloc, lwgsm_mem_realloc and lwgsm_mem_free

Note

Function declaration follows standard C functions malloc, calloc, realloc, free. Declaration is available in lwgsm/lwgsm_mem.h file. Include this file to final implementation file

Note

When implementing custom memory allocation, it is necessary to take care of multiple threads accessing same resource for custom allocator

LWGSM_CFG_MEM_ALIGNMENT

Memory alignment for dynamic memory allocations.

Note

Some CPUs can work faster if memory is aligned, usually to 4 or 8 bytes. To speed up this possibilities, you can set memory alignment and library will try to allocate memory on aligned boundaries.

Note

Some CPUs such ARM Cortex-M0 don’t support unaligned memory access. This CPUs must have set correct memory alignment value.

Note

This value must be power of 2

LWGSM_CFG_USE_API_FUNC_EVT

Enables 1 or disables 0 callback function and custom parameter for API functions.

When enabled, 2 additional parameters are available in API functions. When command is executed, callback function with its parameter could be called when not set to NULL.

LWGSM_CFG_MAX_CONNS

Maximal number of connections AT software can support on GSM device.

LWGSM_CFG_CONN_MAX_DATA_LEN

Maximal number of bytes we can send at single command to GSM.

Note

Value can not exceed 1460 bytes or no data will be ever send

Note

This is limitation of GSM AT commands and on systems where RAM is not an issue, it should be set to maximal value (1460) to optimize data transfer speed performance

LWGSM_CFG_MAX_SEND_RETRIES

Set number of retries for send data command.

Sometimes it may happen that AT+SEND command fails due to different problems. Trying to send the same data multiple times can raise chances we are successful.

LWGSM_CFG_IPD_MAX_BUFF_SIZE

Maximum single buffer size for network receive data (TCP/UDP connections)

Note

When GSM sends buffer buffer than maximal, multiple buffers are created

LWGSM_CFG_AT_PORT_BAUDRATE

Default baudrate used for AT port.

Note

Later, user may call API function to change to desired baudrate if necessary

LWGSM_CFG_RCV_BUFF_SIZE

Buffer size for received data waiting to be processed.

Note

When server mode is active and a lot of connections are in queue this should be set high otherwise your buffer may overflow

Note

Buffer size also depends on TX user driver if it uses DMA or blocking mode In case of DMA (CPU can work other tasks), buffer may be smaller as CPU will have more time to process all the incoming bytes

Note

This parameter has no meaning when LWGSM_CFG_INPUT_USE_PROCESS is enabled

LWGSM_CFG_RESET_ON_INIT

Enables 1 or disables 0 reset sequence after lwgsm_init call.

Note

When this functionality is disabled, user must manually call lwgsm_reset to send reset sequence to GSM device.

LWGSM_CFG_RESET_ON_DEVICE_PRESENT

Enables 1 or disables 0 reset sequence after lwgsm_device_set_present call.

Note

When this functionality is disabled, user must manually call lwgsm_reset to send reset sequence to GSM device.

LWGSM_CFG_RESET_DELAY_DEFAULT

Default delay (milliseconds unit) before sending first AT command on reset sequence.

LWGSM_CFG_CONN_POLL_INTERVAL

Poll interval for connections in units of milliseconds.

Value indicates interval time to call poll event on active connections.

Note

Single poll interval applies for all connections

group LWGSM_OPT_DBG

Debugging configurations.

Defines

LWGSM_CFG_DBG

Set global debug support.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF

Note

Set to LWGSM_DBG_OFF to globally disable all debugs

LWGSM_CFG_DBG_OUT(fmt, ...)

Debugging output function.

Called with format and optional parameters for printf style debug

LWGSM_CFG_DBG_LVL_MIN

Minimal debug level.

Check LWGSM_DBG_LVL for possible values

LWGSM_CFG_DBG_TYPES_ON

Enabled debug types.

When debug is globally enabled with LWGSM_CFG_DBG parameter, user must enable debug types such as TRACE or STATE messages.

Check LWGSM_DBG_TYPE for possible options. Separate values with bitwise OR operator

LWGSM_CFG_DBG_INIT

Set debug level for init function.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF

LWGSM_CFG_DBG_MEM

Set debug level for memory manager.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF

LWGSM_CFG_DBG_INPUT

Set debug level for input module.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF

LWGSM_CFG_DBG_THREAD

Set debug level for GSM threads.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF

LWGSM_CFG_DBG_ASSERT

Set debug level for asserting of input variables.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF

LWGSM_CFG_DBG_IPD

Set debug level for incoming data received from device.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF

LWGSM_CFG_DBG_PBUF

Set debug level for packet buffer manager.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF

LWGSM_CFG_DBG_CONN

Set debug level for connections.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF

LWGSM_CFG_DBG_VAR

Set debug level for dynamic variable allocations.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF

LWGSM_CFG_DBG_NETCONN

Set debug level for netconn sequential API.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF

LWGSM_CFG_AT_ECHO

Enables 1 or disables 0 echo mode on AT commands sent to GSM device.

Note

This mode is useful when debugging GSM communication

group LWGSM_OPT_OS

Operating system dependant configuration.

Defines

LWGSM_CFG_THREAD_PRODUCER_MBOX_SIZE

Set number of message queue entries for procuder thread.

Message queue is used for storing memory address to command data

LWGSM_CFG_THREAD_PROCESS_MBOX_SIZE

Set number of message queue entries for processing thread.

Message queue is used to notify processing thread about new received data on AT port

LWGSM_CFG_INPUT_USE_PROCESS

Enables 1 or disables 0 direct support for processing input data.

When this mode is enabled, no overhead is included for copying data to receive buffer because bytes are processed directly.

Note

This mode can only be used when LWGSM_CFG_OS is enabled

Note

When using this mode, separate thread must be dedicated only for reading data on AT port

Note

Best case for using this mode is if DMA receive is supported by host device

LWGSM_THREAD_PRODUCER_HOOK()

Producer thread hook, called each time thread wakes-up and does the processing.

It can be used to check if thread is alive.

LWGSM_THREAD_PROCESS_HOOK()

Process thread hook, called each time thread wakes-up and does the processing.

It can be used to check if thread is alive.

group LWGSM_OPT_STD_LIB

Standard C library configuration.

Configuration allows you to overwrite default C language function in case of better implementation with hardware (for example DMA for data copy).

Defines

LWGSM_MEMCPY(dst, src, len)

Memory copy function declaration.

User is able to change the memory function, in case hardware supports copy operation, it may implement its own

Function prototype must be similar to:

void *  my_memcpy(void* dst, const void* src, size_t len);

Return

Destination memory start address

Parameters
  • [in] dst: Destination memory start address

  • [in] src: Source memory start address

  • [in] len: Number of bytes to copy

LWGSM_MEMSET(dst, b, len)

Memory set function declaration.

Function prototype must be similar to:

void *  my_memset(void* dst, int b, size_t len);

Return

Destination memory start address

Parameters
  • [in] dst: Destination memory start address

  • [in] b: Value (byte) to set in memory

  • [in] len: Number of bytes to set

group LWGSM_OPT_MODULES

Configuration of specific modules.

Defines

LWGSM_CFG_NETWORK

Enables 1 or disables 0 network functionality used for TCP/IP communication.

Network must be enabled to use all GPRS/LTE functions such as connection API, FTP, HTTP, etc.

LWGSM_CFG_NETWORK_IGNORE_CGACT_RESULT

Ignores 1 or not 0 result from AT+CGACT command.

Note

This may be used for data-only SIM cards where command might fail when trying to attach to network for data transfer

LWGSM_CFG_CONN

Enables 1 or disables 0 connection API.

Note

LWGSM_CFG_NETWORK must be enabled to use connection feature

LWGSM_CFG_SMS

Enables 1 or disables 0 SMS API.

LWGSM_CFG_CALL

Enables 1 or disables 0 call API.

LWGSM_CFG_PHONEBOOK

Enables 1 or disables 0 phonebook API.

LWGSM_CFG_HTTP

Enables 1 or disables 0 HTTP API.

Note

LWGSM_CFG_NETWORK must be enabled to use connection feature

LWGSM_CFG_FTP

Enables 1 or disables 0 FTP API.

Note

LWGSM_CFG_NETWORK must be enabled to use connection feature

LWGSM_CFG_PING

Enables 1 or disables 0 PING API.

Note

LWGSM_CFG_NETWORK must be enabled to use connection feature

LWGSM_CFG_USSD

Enables 1 or disables 0 USSD API.

group LWGSM_OPT_MODULES_NETCONN

Configuration of netconn API module.

Defines

LWGSM_CFG_NETCONN

Enables 1 or disables 0 NETCONN sequential API support for OS systems.

Note

To use this feature, OS support is mandatory.

See

LWGSM_CFG_OS

LWGSM_CFG_NETCONN_RECEIVE_TIMEOUT

Enables 1 or disables 0 receive timeout feature.

When this option is enabled, user will get an option to set timeout value for receive data on netconn, before function returns timeout error.

Note

Even if this option is enabled, user must still manually set timeout, by default time will be set to 0 which means no timeout.

LWGSM_CFG_NETCONN_ACCEPT_QUEUE_LEN

Accept queue length for new client when netconn server is used.

Defines number of maximal clients waiting in accept queue of server connection

LWGSM_CFG_NETCONN_RECEIVE_QUEUE_LEN

Receive queue length for pbuf entries.

Defines maximal number of pbuf data packet references for receive

group LWGSM_OPT_MODULES_MQTT

Configuration of MQTT and MQTT API client modules.

Defines

LWGSM_CFG_MQTT_MAX_REQUESTS

Maximal number of open MQTT requests at a time.

LWGSM_CFG_DBG_MQTT

Set debug level for MQTT client module.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF

LWGSM_CFG_DBG_MQTT_API

Set debug level for MQTT API client module.

Possible values are LWGSM_DBG_ON or LWGSM_DBG_OFF