Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

CYW43907 GPIO Explained

CYW43907 GPIO Explained

VinayakS_26
Moderator
Moderator
Moderator
100 replies posted 50 replies posted 25 replies posted

This  blog discusses about the General Purpose Input Output (GPIO) available in CYW43907.

There are 17 GPIO hardware pins available on the CYW43907. The GPIOs can be used to connect to various external devices. Upon power-up and reset, these pins are tristated. Subsequently, they can be programmed to be either input or output pins via the GPIO control register. In addition, the GPIO pins can be assigned to various other functions.These functions can be found in the Pin multiplexing table in CYW43907 datasheet(Section 11). Apart from the functions mentioned in the pin multiplexing table, GPIOs are also used to set bootstrap functions. JTAG pins are also multiplexed onto GPIO.

PIN MULTIPLEXING TABLE


After power-on reset, all the Pins are configured to function 1. There are 32 GPIO functions (GPIO_0 TO GPIO_31)  in total and the 17 hardware GPIO pins are configured to  GPIO functions GPIO_0 through GPIO_16. Following table shows GPIO Pin Multiplexing (Excerpt from CYW43907 Data Sheet).

mux_table1.jpg

The other pins that have GPIO functionality could be seen from the PIN MULTIPLEXING table. They can also be configured to function as a GPIO using the API; wiced_gpio_init()(Described below). Note that this is possible only for those Pins which have GPIO function.

mux_table3.jpg

For example, in the above table, PWM3 has GPIO function GPIO_5 and GPIO_21.

 

Relevant API's and Description:

On CYW943907AEVAL1F, all the pins are referred as WICED_GPIO_1 through WICED_GPIO_51. Refer the pin mapping in the platform located inside of WICED Studio at:

/43xxx_Wi-Fi/platforms/CYW943907AEVAL1F/platform.c

API documentation included as part of WICED Studio covers these APIs in great detail, here is high-level description of APIs available for GPIOs for this device.

1. wiced_result_t wiced_gpio_init( wiced_gpio_t gpio, wiced_gpio_config_t configuration )

Description: To initialize a pin as GPIO. Note that this is possible only for those pins that have GPIO functionality listed in the PIN MULTIPLEXING table. For those pins that have multiple GPIO functionality, the first GPIO function will be invoked. The pin to be configured as GPIO along with the configuration is passed to the API.

The possible configurations are :

GPIO Configurations Descriptions
INPUT_PULL_UP Input with an internal pull-up resistor - use with devices that actively drive the signal low - e.g. button connected to ground
INPUT_PULL_DOWN Input with an internal pull-down resistor - use with devices that actively drive the signal high - e.g. button connected to a power rail
OUTPUT_PUSH_PULL Output actively driven high and actively driven low - must not be connected to other active outputs - e.g. LED output
INPUT_HIGH_IMPEDANCE Input - must always be driven, either actively or by an external pullup resistor
OUTPUT_OPEN_DRAIN_NO_PULL Output actively driven low but is high-impedance when set high - can be connected to other open-drain/open-collector outputs. Needs an external pull-up resistor
OUTPUT_OPEN_DRAIN_PULL_UP Output actively driven low and is pulled high with an internal resistor when set high - can be connected to other open-drain/open-collector outputs.

 

2. wiced_result_t wiced_gpio_output_high( wiced_gpio_t gpio 😞

Description: To toggle the configured GPIO pin high.

3. wiced_result_t wiced_gpio_output_low( wiced_gpio_t gpio 😞

Description: To toggle the configured GPIO pin low.

4. wiced_bool_t wiced_gpio_input_get( wiced_gpio_t gpio 😞

Description: To configure the GPIO pin as an input pin.

5. wiced_result_t wiced_gpio_deinit( wiced_gpio_t gpio 😞

Description: To de-initialize the configured GPIO pin.

1710 Views