Peripheral Driver AT Command Set
This chapter describes the peripheral driver AT command set. Adaptation varies by module; see Firmware Versions and Feature Differences for details.
AT+SYSIOMAP: Query or set IO mapping table
AT+SYSGPIOWRITE: Set GPIO output level
AT+SYSGPIOREAD: Read GPIO level
AT+PWMCFG: Configure PWM
AT+PWMCFG: Configure PWM
AT+PWMSTOP: Disable PWM
AT+PWMDUTYSET: Update PWM duty cycle
AT+PWMDUTYSETS: Update PWM duty cycle
AT+SYSIOMAP: Query or set IO mapping table
Execute Command
Command:
AT+SYSIOMAP=<PinNumber>,<pin1>,<pin2>,...,<pinN>
Response:
OK
Parameters
<pinNumber>: Total number of IOs to configure.
- <pinxx>: Module IO pin
(Numbered counterclockwise from the top-left corner of the module, starting at 1) Chip pin number (1–254, per the chip datasheet). Set to NC if the module has no corresponding chip pin.
Notes
Set IO pin mapping.
Example
AT+SYSIOMAP=4,3,5,NC,1
OK
//这个指令含义一共设置 4 个 IO 的映射关系
//模组的 1 号引脚对应芯片的 3 号引脚;
//模组的 2 号引脚对应芯片的 5 号引脚;
//模组的 3 号引脚没有连接到芯片或者该引脚禁止使用 AT 指令控制
//模组的 4 号引脚对应芯片的 1 号引脚
Query Command
Command:
AT+SYSIOMAP?
Response:
+SYSIOMAP:PinNumber:<PinNumber>,PinMap:<pin1>,<pin2>,...,<pinN>
Parameters
<PinNumber>: Number of mapping entries in the current table.
- <pinxx>: Module IO pin
(Numbered counterclockwise from the top-left corner of the module, starting at 1) Chip pin number (1–254, per the chip datasheet). Set to NC if the module has no corresponding chip pin.
Notes
Query IO pin mapping table
Example
AT+SYSIOMAP?
+SYSIOMAP:PinNumber:6,PinMap:NC,5,20,NC,15,NC
OK
AT+SYSGPIOWRITE: Set GPIO output level
Execute Command
Command:
AT+SYSGPIOWRITE=<pin>,<level>
Response:
OK
Parameters
- <pin>: Module IO pin number.
Numbered counterclockwise from the top-left corner of the module, starting at 1
- <level>: Pin level.
0: Low level
1: High level
Notes
Set GPIO output level
Example
AT+SYSGPIOWRITE=4,1
AT+SYSGPIOREAD: Read GPIO level
Execute Command
Command:
AT+SYSGPIOREAD=<pin>
Response:
+SYSGPIOREAD:<pin>,<level>
Parameters
- <pin>: Module IO pin number
Numbered counterclockwise from the top-left corner of the module, starting at 1
- <level>: Pin level.
0: Low level
1: High level
Notes
Read GPIO level
Example
AT+SYSGPIOREAD=4
+SYSGPIOREAD:4,1
AT+PWMCFG: Configure PWM
Execute Command
Command:
AT+PWMCFG=<pin>,<cycle>,<duty>
Response:
OK
Parameters
- <pin>: Module IO pin number
Numbered counterclockwise from the top-left corner of the module, starting at 1
- <cycle>: PWM period
Unit: us
- <duty>: Duty cycle
Integer 0–100
Notes
Ai-WB2 series modules provide 5 PWM channels. When enabling multiple channels simultaneously, the IO pin number modulo 5 must be unique; otherwise only one takes effect. For example, if IO1/2/6 are configured, only IO2/6 take effect and IO1 is overridden by IO6.
Note: This command sets the chip period register directly; the same parameters may behave differently on different modules. If precision requirements allow, prefer AT+PWMCFGS, which yields consistent results across modules (a few us difference may exist between chips).
Example
AT+SYSIOMAP=38,NC,NC,NC,NC,11,NC,NC,14,17,3,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,4,NC,NC,NC,5,NC,NC,NC,NC,12,NC,NC
AT+PWMCFG=27,3000,80
AT+PWMCFG: Configure PWM
Execute Command
Command:
AT+PWMCFGS=<pin>,<cycle>,<duty>
Response:
OK
Parameters
- <pin>: Module IO pin number
Numbered counterclockwise from the top-left corner of the module, starting at 1
- <cycle>: PWM period
Unit: us
- <duty>: Duty cycle
Integer 0–100
Notes
Ai-WB2 series modules provide 5 PWM channels. When enabling multiple channels simultaneously, the IO pin number modulo 5 must be unique; otherwise only one takes effect. For example, if IO1/2/6 are configured, only IO2/6 take effect and IO1 is overridden by IO6.
Note: This command sets the chip period register directly; the same parameters may behave differently on different modules. If precision requirements allow, prefer AT+PWMCFGS, which yields consistent results across modules (a few us difference may exist between chips).
Example
AT+SYSIOMAP=38,NC,NC,NC,NC,11,NC,NC,14,17,3,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,NC,4,NC,NC,NC,5,NC,NC,NC,NC,12,NC,NC
AT+PWMCFGS=27,3000,80
AT+PWMSTOP: Disable PWM
Execute Command
Command:
AT+PWMSTOP=<pin>
Response:
OK
Parameters
- <pin>: Module IO pin number
Numbered counterclockwise from the top-left corner of the module, starting at 1
Notes
Disable PWM
Example
AT+PWMSTOP=27
AT+PWMDUTYSET: Update PWM duty cycle
Execute Command
Command:
AT+PWMDUTYSET=<pin>,<duty>
Response:
OK
Parameters
- <pin>: Module IO pin number
Numbered counterclockwise from the top-left corner of the module, starting at 1
- <duty>: Duty cycle
Integer 0–100
Notes
Update PWM duty cycle
Example
AT+PWMDUTYSET=27,60
OK
AT+PWMDUTYSETS: Update PWM duty cycle
Execute Command
Command:
AT+PWMDUTYSETS=<pin>,<duty>
Response:
OK
Parameters
- <pin>: Module IO pin number
Numbered counterclockwise from the top-left corner of the module, starting at 1
- <duty>: Duty cycle
Integer 0–100
Notes
Update PWM duty cycle
Example
AT+PWMDUTYSETS=27,60
OK