GPIO

Introduction

The section describes the AT commands used to configure the GPIO pins provided by u-blox cellular modules.

GPIO functions

On u-blox cellular modules, GPIO pins can be opportunely configured as general purpose input or output. Moreover GPIO pins of u-blox cellular modules can be configured to provide custom functions via +UGPIOC AT command. The custom functions availability can vary depending on the u-blox cellular modules series and version: see Table 19 for an overview of the custom functions supported by u-blox cellular modules.
Table 19. GPIO custom functions overview
<gpio_mode>OutputInputNetwork status indicationExternal GNSS supply enableExternal GNSS data readyExternal GNSS RTC sharingJamming detection indicationSIM card detectionHeadset detectionGSM Tx burst indicationModule status indicationModule operating mode indicationI2S digital audio interfaceSPI serial interfaceClock outputUART (DSR, DTR, DCD and RI) interfaceWi-Fi enableRing indicatorLast gaspExternal GNSS antenna / LNA controlTime pulse GNSSTime pulse outputTime stamp of external interruptFast power-offLwM2M pulseHardware flow control (RTS, CTS)Antenna dynamic tuningExternal GNSS time pulse inputExternal GNSS time stamp of external interruptDTR mode for power saving control32.768 kHz outputSafe memory and power-offUPSV controlSatellite / GNSS Rx indicationSatellite / GNSS Rx/Tx indicationPad disabled
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
18
19
20
21
22
23
24
25
26
27
28
29
30
32
33
34
35
36
255
LEXI-R10 / SARA-R10
*
*
*
*
*
*
*
*
*
*
The configuration of the GPIO pins (i.e. the setting of the parameters of the +UGPIOC AT command) is saved in the NVM and used at the next power-on.
For more details on the antenna dynamic tuning control feature, see the +UATUN AT command.

GPIO mapping

The number of available GPIO pins and their mapping can vary depending on the u-blox cellular modules series and version. The GPIOs mapping for different u-blox cellular modules is reported in the following tables.
See the corresponding module system integration manual for the functions supported by each GPIO.

GPIO mapping

Table 20. LEXI-R10 / SARA-R10 GPIO mapping
<gpio_id>Pin namePin numberFactory-programmed functionRemarks
14
GPIO1
14
Pin disabled
-
15
GPIO2
15
Pin disabled
-
16
GPIO3
16
Pin disabled
-
17
GPIO4
17
Pin disabled
-
18
GPIO5
18
Pin disabled
-
29
GPIO6
29
Pin disabled
Only pin 29 can be configured for "SIM card detection" functionality
23
GPIO7
23
Pin disabled
-
24
GPIO8
24
Pin disabled
-
25
GPIO9
25
Pin disabled
-
26
GPIO10
26
Pin disabled
-

Additional notes

SARA-R10
SARA products don’t support GPIO7, GPIO8, GPIO9, GPIO10.
See the corresponding module system integration manual for the complete overview of all allowed configurations.

Network status indication

When a GPIO pin is configured to provide network status indication, its progress depends on the CS network registration state (see +CREG) and on the module transmission state:
  • No service: indicates no network coverage or not registered state
  • Registered home network 2G: indicates registered state on home network in 2G RAT
  • Registered home network 3G: indicates registered state on home network in 3G RAT
  • Registered home network 4G: indicates registered state on home network in 4G RAT
  • Registered home network NB-IoT: indicates registered state on home network in NB-IoT
  • Registered roaming 2G: indicates registered state with visitor 2G network (roaming in 2G RAT)
  • Registered roaming 3G: indicates registered state with visitor 3G network (roaming in 3G RAT)
  • Registered roaming 4G: indicates registered state with visitor 4G network (roaming in 4G RAT)
  • Registered roaming NB-IoT: indicates registered state with visitor NB-IoT network (roaming in NB-IoT)
  • Data transmission: indicates voice or data call active either in 2G, 3G or 4G RAT
  • Data transmission roaming: indicates voice or data call active either in 2G, 3G or 4G RAT with visitor network
The following figures report the allowed progresses for GPIO pin set as network indication: VH and VL values are provided in the corresponding module data sheet in the "Generic Digital Interfaces pins" section.

No service (no network coverage or not registered)

  • Continuous Output / Low
Introduction 0
Figure 1. GPIO pin progress for no service

Registered home network 2G

  • Cyclic Output / High for 100 ms, Output / Low for 2 s
Introduction 1
Figure 2. GPIO pin progress for registered home network 2G

Registered home network 3G

  • Cyclic Output / High for 50 ms, Output / Low for 50 ms, Output / High for 50 ms, Output / Low for 2 s
Introduction 2
Figure 3. GPIO pin progress for registered home network 3G

Registered home network 4G

  • Cyclic Output / High for 75 ms, Output / Low for 75 ms, Output / High for 75 ms, Output / Low for 75 ms, Output / High for 75 ms, Output / Low for 3 s
Introduction 9
Figure 4. GPIO pin progress for registered home network 4G

Registered home network NB-IoT

  • Cyclic Output / High for 100 ms, Output / Low for 30 s
Introduction 7
Figure 5. GPIO pin progress for registered home network NB-IoT

Registered roaming 2G

  • Cyclic Output / High for 100 ms, Output / Low for 100 ms, Output / High for 100 ms, Output / Low for 2 s
Introduction 3
Figure 6. GPIO pin progress for registered roaming 2G

Registered roaming 3G

  • Cyclic Output / High for 50 ms, Output / Low for 50 ms, Output / High for 50 ms, Output / Low for 100 ms
Introduction 4
Figure 7. GPIO pin progress for registered roaming 3G

Registered roaming 4G

  • Cyclic Output / High for 150 ms, Output / Low for 150 ms, Output / High for 150 ms, Output / Low for 3 s
Introduction 10
Figure 8. GPIO pin progress for registered roaming 4G

Registered roaming NB-IoT

  • Cyclic Output / High for 100 ms, Output / Low for 100 ms, Output / High for 100 ms, Output / Low for 30 s
Introduction 8
Figure 9. GPIO pin progress for registered roaming NB-IoT

Data transmission

  • Continuous Output / High
Introduction 5
Figure 10. GPIO pin progress for data transmission

Data transmission roaming

  • Cyclic Output / High for 800 ms, Output / Low for 200 ms
Introduction 6
Figure 11. GPIO pin progress for data transmission roaming
Data transmission pattern is hooked up to +CSCON events, which return details of the current terminal’s radio connection status.

UART (DSR, DTR, DCD e RI) interface

The UART interface lines (DSR, DTR, DCD and RI) can be set on GPIO pins. For more details, see the corresponding module system integration manual.

Module status indication

When a GPIO pin is configured to provide module status indication, its progress depends on the current module status (power-off mode, i.e. module switched off, or deep-sleep mode versus idle, active or connected mode, i.e. module switched on):
  • Output / High, when the module is switched on (any operating mode during module normal operation: idle, active or connected mode)
  • Output / Low, when the module is switched off (power-off mode)

Module operating mode indication

When a GPIO pin is configured to provide module operating mode indication, its progress depends on the current module operating mode (the low power idle mode versus active or connected mode):
  • Output / High, when the module is in active or connected mode
  • Output / Low, when the module is in idle mode (that can be reached if the power saving is enabled by the +UPSV AT command)

GPIO select configuration command +UGPIOC

+UGPIOC
Modules
All products
Attributes
Syntax
PIN required
Settings saved
Can be aborted
Response time
Error reference
partial
No
No

Description

Configures the GPIO pins as input, output, or to handle a custom function. When a GPIO pin is configured as an output pin (<gpio_mode>=0), it is possible to set the output value <gpio_out_val> which will be returned in the information text response to +UGPIOR read command (where supported). When a GPIO pin is configured as an input pin (<gpio_mode>=1), it is possible to set the input value <gpio_in_pull> which will be returned in the information text response to +UGPIOR read command (where supported). When the GPIO pin is configured as a SIM card detection (<gpio_mode>=7), it is possible to set the SIM polarity <gpio_sim_det_logic>; the parameter setting will be returned in the information text response to +UGPIOC read command.
The test command provides the list of the supported GPIOs, the supported functions and the status of all the GPIOs.
Not all the GPIO functions can be assigned to each GPIO pin. If the configuration is not allowed, an error result code will be returned (error result code 1502 - "+CME ERROR: Select GPIO mode error"). Where supported, the following custom functions cannot be simultaneously configured on 2 GPIOs:
  • Network status indication
  • External GNSS supply enable
  • External GNSS data ready
  • External GNSS RTC sharing
  • Jamming detection indication
  • SIM card detection
  • Headset detection
  • GSM Tx burst indication
  • Module status indication
  • Module operating mode indication
  • Ring indicator
  • Last gasp
  • External GNSS antenna / LNA control
  • Time pulse GNSS
  • Time pulse output
  • Time stamp of external interrupt
  • Fast power-off
  • External GNSS time pulse input
  • External GNSS time stamp of external interrupt
  • DTR mode for power saving control
  • 32.768 kHz output
  • Safe memory and power-off
  • UPSV control
  • Primary UART DTR line on GPIO pin
  • Satellite / GNSS Rx indication
  • Satellite / GNSS Rx/Tx indication
For more details regarding the custom functions supported by the u-blox cellular modules and the factory-programmed settings, see GPIO functions and GPIO mapping.

Syntax

TypeSyntaxResponseExample
Generic syntax
Set
AT+UGPIOC=<gpio_id>,<gpio_mode>[,<param_val>]
OK
AT+UGPIOC=42,7,1
OK
GPIO output mode
Set
AT+UGPIOC=<gpio_id>,0[,<gpio_out_val>]
OK
AT+UGPIOC=42,0,1
OK
GPIO input mode
Set
AT+UGPIOC=<gpio_id>,1[,<gpio_in_pull>]
OK
AT+UGPIOC=42,1,1
OK
SIM card detection mode
Set
AT+UGPIOC=<gpio_id>,7[,<gpio_sim_det_logic>]
OK
AT+UGPIOC=42,7,1
OK
Other GPIO modes
Set
AT+UGPIOC=<gpio_id>,<gpio_mode>
OK
AT+UGPIOC=42,2
OK
Read
AT+UGPIOC?
+UGPIOC:
<gpio_id>,<gpio_mode>
[<gpio_id>,<gpio_mode>
[…​.]]
OK
+UGPIOC:
20,255
21,3
23,255
24,255
42,7,1
OK
Test
AT+UGPIOC=?
+UGPIOC: (list of supported <gpio_id>),(list of supported <gpio_mode>),(list of supported <gpio_out_val>\<gpio_in_pull>\<gpio_sim_det_logic>)
[<gpio_id1>,<gpio_mode>
…​
<gpio_idN>,<gpio_mode>]
OK
+UGPIOC: (20,21,23,24,42),(0-5,7,9,255),(0-2)
OK

Defined values

ParameterTypeDescription
<gpio_id>
Number
GPIO pin identifier: pin number
See the GPIO mapping for the available GPIO pins, their mapping and factory-programmed values on different u-blox cellular modules series and product version.
<gpio_mode>
Number
Mode identifier: configured function
See the GPIO functions for custom functions supported by different u-blox cellular modules series and product version.
Allowed values:
  • 0: output
  • 1: input
  • 2: network status indication
  • 3: external GNSS supply enable
  • 4: external GNSS data ready
  • 5: external GNSS RTC sharing
  • 6: jamming detection indication
  • 7: SIM card detection
  • 8: headset detection
  • 9: GSM Tx burst indication
  • 10: module status indication
  • 11: module operating mode indication
  • 12: I2S digital audio interface
  • 13: SPI serial interface
  • 14: clock output
  • 15: UART (DSR, DTR, DCD e RI) interface
  • 16: Wi-Fi enable
  • 18: ring indicator
  • 19: last gasp
  • 20: external GNSS antenna / LNA control enable
  • 21: time pulse GNSS
  • 22: time pulse output
  • 23: time stamp of external interrupt
  • 24: fast power-off
  • 25: LwM2M pulse
  • 26: hardware flow control (RTS, CTS)
  • 27: antenna dynamic tuning
  • 28: external GNSS time pulse input
  • 29: external GNSS time stamp of external interrupt
  • 30: DTR mode for power saving control
  • 32: 32.768 kHz output
  • 33: safe memory and power-off
  • 34: UPSV control
  • 35: Satellite / GNSS Rx indication
  • 36: Satellite / GNSS Rx/Tx indication
  • 255: pad disabled
<gpio_out_val>
Number
GPIO output value (for output function <gpio_mode>=0 only):
  • 0 (default value): low
  • 1: high
<gpio_in_pull>
Number
GPIO input value (for input function <gpio_mode>=1 only):
  • 0 (default value): no resistor activated
  • 1: pull up resistor active
  • 2: pull down resistor active
<gpio_sim_det_logic>
Number
SIM detection polarity (for SIM detection function <gpio_mode>=7 only):
  • 0 (default value): SIM detection high polarity activated
  • 1: SIM detection low polarity activated (reverse SIM detection logic)

Notes

  • <gpio_in_pull> is supported with limitations.
  • The network status indication (<gpio_mode>=2) and ring indicator function (<gpio_mode>=18) can be set on every pin except GPIO3 and GPIO6.
  • The module status indication function (<gpio_mode>=10) can be set on GPIO2 and GPIO4 only.
  • The following features can be set on GPIO3 and GPIO6 only: fast power-off (<gpio_mode>=24), safe memory and power-off (<gpio_mode>=33), UPSV control (<gpio_mode>=34).

GPIO read command +UGPIOR

+UGPIOR
Modules
All products
Attributes
Syntax
PIN required
Settings saved
Can be aborted
Response time
Error reference
full
No
No
No

Description

Reads the current value of the specified GPIO pin, no matter whether it is configured as input or output (see the +UGPIOC AT command to define the GPIO function). The parameters range is shown in the information text response to the test command.

Syntax

TypeSyntaxResponseExample
Set
AT+UGPIOR=<gpio_id>
+UGPIOR: <gpio_id>,<gpio_val>
OK
AT+UGPIOR=20
+UGPIOR: 20,0
OK
Test
AT+UGPIOR=?
+UGPIOR: (list of supported <gpio_id>s)
OK
+UGPIOR: (20, 21)
OK

Defined values

ParameterTypeDescription
<gpio_id>
Number
GPIO pin identifier: pin number
See the GPIO mapping for the available GPIO pins, their mapping and factory-programmed values on different u-blox cellular modules series and version.
<gpio_val>
Number
GPIO value. Allowed values are 0 and 1.

Notes

  • The set command works only if the <gpio_mode> parameter of the +UGPIOC AT command is set to 0 or 1.

GPIO set command +UGPIOW

+UGPIOW
Modules
All products
Attributes
Syntax
PIN required
Settings saved
Can be aborted
Response time
Error reference
full
No
No
No

Description

Sets ("writes") the output of the specified GPIO pin, but only if it is configured in output function (see the +UGPIOC AT command to set the pin as output).

Syntax

TypeSyntaxResponseExample
Set
AT+UGPIOW=<gpio_id>,<gpio_out_val>
OK
AT+UGPIOW=20,1
OK
Test
AT+UGPIOW=?
+UGPIOW: (list of supported <gpio_id>s),(list of supported <gpio_out_val>s)
OK
+UGPIOW: (20, 21),(0-1)
OK

Defined values

ParameterTypeDescription
<gpio_id>
Number
GPIO pin identifier: pin number
See the GPIO mapping for the available GPIO pins, their mapping and factory-programmed values on different u-blox cellular modules series and version.
<gpio_out_val>
Number
GPIO value. Allowed values are 0 and 1.

Notes

  • The set command works only if the <gpio_mode> parameter of the +UGPIOC AT command is set to 0.
Last updated: 13 January 2025
Need help?Contact Support
Questions?Contact us