You are here

GPIO_SET_HPWM_CFG (0x14)

The GPIO_SET_HPWM_CFG command configures the high frequency pulse width modulation (HPWM) settings for A.5 and B.5 pins. For more detailed information see Section 9.2, “High Frequency PWM (HPWM)”.

GPIO_SET_HPWM_CFG Command

Go to Response

Byte 0 GPIO_SET_HPWM_CFG Command ID (0x14).
Byte 1 ECHO Echo to associate a command with the response.
Byte 2 HPWM_NUMBER HPWM channel number.
Byte 3 ON HPWM state (on/off).
Byte 4 TL PWM period (least significant byte).
Byte 5 TH PWM period (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_HPWM_CFG (0x14)

This byte contains command ID (command type). It should be set to 0x14.

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: HPWM_NUMBER

The HPWM channel number.

  • 0 – B.5 pin;

  • 1 – A.5 pin.

Byte 3: ON

The HPWM state (on/off) on the specified pin:

  • 1 – the pins will be switched to HPWM mode. GPIO_GET_CFG and GPIO_GET_PIN_CFG commands will return GPIO_CFG_HPWM (0x2) value for the pin. The pin can be used only by the HPWM module;

  • 0 – the HPWM 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 pin. The pin can be used by any module.

Bytes 4, 5: TL/TH

Byte 4: TL – least significant byte (low byte) of PWM period.

Byte 5: TH – most significant byte (high byte) of PWM period.

The PWM period is the sum of high time and low time of the pulse. It is specified in µs in the range from 1 to 340 µs.

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 µs in the range from 1 to 340 µs.

For convenience GPIO_SET_HPWM_CFG_CMD structure is declared in reports.h file.

GPIO-24 adapter sends GPIO_SET_HPWM_CFG response after command execution.

GPIO_SET_HPWM_CFG Response

Go to Command

Byte 0 GPIO_SET_HPWM_CFG Response ID (0x14).
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_HPWM_CFG (0x14)

Response ID (response type). This byte will contain 0x14.

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/O pins were successfully configured.

  • GPIO_ST_INVALID_PORT (0x03) – Invalid port number has been specified.

  • GPIO_ST_INVALID_PWM_PERIOD (0x08) – Invalid PWM period.

Bytes 3..7: Reserved

These bytes are reserved for future usage.

For convenience GPIO_SET_HPWM_CFG_RSP structure is declared in reports.h file.