AT command set for driving peripherals¶
This chapter introduces the AT command set of the drive peripherals. This AT command set will be adapted differently for different modules. For specific differences, please move to:doc:Firmware iterations and differences.
AT+SYSIOMAP: query or set IO mapping table
AT+SYSGPIOWRITE:set GPIO output level
AT+SYSGPIOREAD:read GPIO level
AT+PWMCFG:configure PWM function
AT+PWMCFG:configure PWM function
AT+PWMSTOP:turn off PWM function
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>:the total number of IO to set.
- <pinxx>:module IO pin
(Sort counterclockwise from the upper left corner of the module, pin number starts from 1) The corresponding chip pin number (1~254, this can be based on the pin number on the chip manual) If the module does not have a corresponding chip pin, it is set to NC
Description¶
Set IO pin mapping relationship.
Example¶
AT+SYSIOMAP=4,3,5,NC,1
OK
//The meaning of this command sets a total of 4 IO mapping relationships
//Pin 1 of the module corresponds to pin 3 of the chip;
//Pin 2 of the module corresponds to pin 5 of the chip;
//Pin 3 of the module is not connected to the chip or AT command control is prohibited for this pin.
//Pin 4 of the module corresponds to pin 1 of the chip
query command¶
Command:
AT+SYSIOMAP?
Response:
+SYSIOMAP:PinNumber:<PinNumber>,PinMap:<pin1>,<pin2>,...,<pinN>
Parameters¶
<PinNumber>: indicates the number of groups in the current mapping table.
- <pinxx>:module IO pin
(Sort counterclockwise from the upper left corner of the module, pin number starts from 1) The corresponding chip pin number (1~254, this can be based on the pin number on the chip manual) If the module does not have a corresponding chip pin, it is set to NC
Description¶
Query IO pin mapping relationship table
Example¶
AT+SYSIOMAP?
+SYSIOMAP:PinNumber:6,PinMap:NC,5,20,NC,15,NC
OK
AT+SYSGPIOWRITE sets GPIO output level¶
Execute command¶
Command:
AT+SYSGPIOWRITE=<pin>,<level>
Response:
OK
Parameters¶
- <pin>:module IO pin number.
Sort counterclockwise from the upper left corner of the module, and the pin number starts from 1
- <level>: pin level.
0:Low Level
1:High Level
Description¶
Set GPIO Output Level
Example¶
AT+SYSGPIOWRITE=4,1
AT + SYSGPIOREAD reads GPIO level¶
Execute command¶
Command:
AT+SYSGPIOREAD=<pin>
Response:
+SYSGPIOREAD:<pin>,<level>
Parameters¶
- <pin>:module IO pin number
Sort counterclockwise from the upper left corner of the module, and the pin number starts from 1
- <level>: pin level.
0:Low Level
1:High Level
Description¶
read GPIO level
Example¶
AT+SYSGPIOREAD=4
+SYSGPIOREAD:4,1
AT+PWMCFG Configuration PWM Function¶
Execute command¶
Command:
AT+PWMCFG=<pin>,<cycle>,<duty>
Response:
OK
Parameters¶
- <pin>:module IO pin number
Sort counterclockwise from the upper left corner of the module, and the pin number starts from 1
- <cycle>:PWM cycle
单位 us
- <duty>:duty cycle
Integer 0~100
Description¶
Ai-WB2 series modules have a total of 5 PWM channels. When opening at the same time, it must be noted that the IO serial number of the chip pin cannot be repeated to 5, otherwise only one will take effect. For example, if IO1/2/6 is set, only IO2/6 will take effect, and IO1 is covered by IO6.
Note: The unit of this command setting is the cycle register of the chip. The effect of the same parameter on different modules may be different. If the accuracy can meet the requirements, it is recommended to use the AT+PWMCFGS setting. The effect of the same parameter of this command on different modules will be basically the same (different chips may have a difference of a few us)
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 Configuration PWM Function¶
Execute command¶
Command:
AT+PWMCFGS=<pin>,<cycle>,<duty>
Response:
OK
Parameters¶
- <pin>:module IO pin number
Sort counterclockwise from the upper left corner of the module, and the pin number starts from 1
- <cycle>:PWM cycle
Unit us
- <duty>:duty cycle
Integer 0~100
Description¶
Ai-WB2 series modules have a total of 5 PWM channels. When opening at the same time, it must be noted that the IO serial number of the chip pin cannot be repeated to 5, otherwise only one will take effect. For example, if IO1/2/6 is set, only IO2/6 will take effect, and IO1 is covered by IO6.
Note: The unit of this command setting is the cycle register of the chip. The effect of the same parameter on different modules may be different. If the accuracy can meet the requirements, it is recommended to use the AT+PWMCFGS setting. The effect of the same parameter of this command on different modules will be basically the same (different chips may have a difference of a few us)
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 turns off PWM function¶
Execute command¶
Command:
AT+PWMSTOP=<pin>
Response:
OK
Parameters¶
- <pin>:module IO pin number
Sort counterclockwise from the upper left corner of the module, and the pin number starts from 1
Description¶
Turn off PWM function
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
Sort counterclockwise from the upper left corner of the module, and the pin number starts from 1
- <duty>:duty cycle
Integer 0~100
Description¶
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
Sort counterclockwise from the upper left corner of the module, and the pin number starts from 1
- <duty>:duty cycle
Integer 0~100
Description¶
Update PWM duty cycle
Example¶
AT+PWMDUTYSETS=27,60
OK