The GPIO_SET_PWM_CFG command configures pulse width
modulation (PWM) settings for specified I/O pins. For more
detailed information see Section 9.1, “Pulse Width Modulation (PWM) ”.
GPIO_SET_PWM_CFG Command
| Byte 0 | GPIO_SET_PWM_CFG | Command ID (0x07). | |
| Byte 1 | ECHO | Echo to associate a command with the response. | |
| Byte 2 | Bit 7..4 | PORT | GPIO port. |
| Bit 3..0 | ON | PWM state: on/off. | |
| Byte 3 | MASK | Data mask. | |
| Byte 4 | T0L | Low time of the pulse (least significant byte). | |
| Byte 5 | T0H | Low time of the pulse (most significant byte). | |
| Byte 6 | T1L | High time of the pulse (least significant byte). | |
| Byte 7 | T1H | High time of the pulse (most significant byte). | |
Command is an 8-byte array of the following format:
- Byte 0: GPIO_SET_PWM_CFG (0x07)
This byte contains command ID (command type). It should be set to 0x07.
- Byte 1: ECHO
This byte is used to associate a response received from GPIO-24 adapter with a specific command. Response will contain exactly the same value in its echo byte.
- Byte 2:
- Bits 7..4: PORT
0 – GPIO PORT A;
1 – GPIO PORT B;
2 – GPIO PORT C.
- Bits 3..0: ON
The PWM state (on/off):
1 – the pins will be switched to PWM mode. GPIO_GET_CFG and GPIO_GET_PIN_CFG commands will return GPIO_CFG_PWM (0x2) value for the pins. The pins can be used only by the PWM module;
0 – the PWM mode will be switched off on the pins. GPIO_GET_CFG and GPIO_GET_PIN_CFG commands will return GPIO_CFG_NOT_CONFIGURED (0xf) value for the pins. The pins can be used by any module.
- Byte 3: MASK
Data mask to use when modifying PWM settings for
I/Opins. It is well known that a byte consists of 8 bits (which can be 0 or 1). This characteristic is used to create a mask. The mask value allows to modify certain pins, leaving rest of the pins unchanged. Note, that only the pins with mask bit set to 1 will be affected.- Bytes 4, 5: T0L/T0H
Byte 4: T0L – least significant byte (low byte) of low time of the pulse.
Byte 5: T0H – most significant byte (high byte) of low time of the pulse.
Low time is a time period when the output equals to 0. It is specified in ms in the range from 1 to 65535 ms (65.535 seconds).
- Bytes 6, 7: T1L/T1H
Byte 6: T1L – least significant byte (low byte) of high time of the pulse.
Byte 7: T1H – most significant byte (high byte) of high time of the pulse.
High time is a time period when the output equals to 1. It is specified in ms in the range from 1 to 65535 ms (65.535 seconds).
For convenience GPIO_SET_PWM_CFG_CMD structure is declared in reports.h file.
GPIO-24 adapter sends GPIO_SET_PWM_CFG response after command execution.
GPIO_SET_PWM_CFG Response
| Byte 0 | GPIO_SET_PWM_CFG | Response ID (0x07). |
| Byte 1 | ECHO | Echo to associate a command with the response. |
| Byte 2 | ST | Status of the command execution. |
| Byte 3..7 | Reserved | Reserved |
Response is an 8-byte array of the following format:
- Byte 0: GPIO_SET_PWM_CFG (0x07)
Response ID (response type). This byte will contain 0x07.
- Byte 1: ECHO
Echo byte copied from the corresponding command. It is used to associate the response with the specific command.
- Byte 2: ST
Status of the command execution:
GPIO_ST_SUCCESS (0x00) – The
I/Opins were successfully configured.GPIO_ST_INVALID_PORT (0x03) – Invalid port number has been specified.
- Bytes 3..7: Reserved
These bytes are reserved for future usage.
For convenience GPIO_SET_PWM_CFG_RSP structure is declared in reports.h file.
9.3. Single Pulses


2006-2012