P16 on CYW20719

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

cross mob
ChRo_1954501
Level 1
Level 1

I am using the CYW20719B1KUMLG Bluetooth dual-mode chip. We were having issues getting the pin P16 to work as a simple GPIO.  It turns out we aren’t able to change it to a GPIO. This is a huge issue as we need this pin the work as a GPIO. We need to know if this is a hardware issue or a software issue.  I.e. is there no connection to a GPIO in the pinout or does the IDE have limitations on registers it can access so it can’t make P16 a simple GPIO.

0 Likes
1 Solution
CharlesF_21
Employee
Employee
25 sign-ins 10 sign-ins First comment on KBA

Christian.Rodriguez_1954501mroberts_arrowuser_249199259

The problem was introduced in WICED SDK 6.2 and until it is fixed please use the following work around:

in file wiced_platform.c add

//! List of pins available on the platform

enum wiced_platform_pins

{

    PLATFORM_GPIO_0,  

.

.

    PLATFORM_GPIO_15,

    PLATFORM_GPIO_16,

    PLATFORM_GPIO_MAX_PINS

};

and

#define WICED_GPIO_PIN_TESTPIN16   WICED_P16

#define WICED_GPIO_PIN_TESTPIN17   WICED_P17

In file wiced_platform_pin_config.c add

/* all the pins available on this platform and their chosen functionality */

const wiced_platform_gpio_t platform_gpio_pins[] =

    {

        [PLATFORM_GPIO_0 ] = {WICED_P00, WICED_GPIO              },      //Button 1

.

.

       [PLATFORM_GPIO_7 ] = {WICED_P16, RESERVED_1   },

        [PLATFORM_GPIO_8 ] = {WICED_P17, WICED_GPIO   },

.

.

       [PLATFORM_GPIO_16] = {WICED_P03, RESERVED_1         },

    };

and

/* GPIO Configuration */

const wiced_platform_gpio_config_t platform_gpio[] =

    {

            [WICED_PLATFORM_GPIO_1] =

                {

                    .gpio          = (wiced_bt_gpio_numbers_t*)&platform_gpio_pins[PLATFORM_GPIO_7].gpio_pin,

                    .config        = ( GPIO_OUTPUT_ENABLE | GPIO_INPUT_DISABLE ),

                    .default_state = GPIO_PIN_OUTPUT_LOW,

                },

             [WICED_PLATFORM_GPIO_2] =

                {

                     .gpio          = (wiced_bt_gpio_numbers_t*)&platform_gpio_pins[PLATFORM_GPIO_8].gpio_pin,

                     .config        = ( GPIO_OUTPUT_ENABLE ),

                     .default_state = GPIO_PIN_OUTPUT_HIGH,

                }

    };

in main thread or application add:

    for(;;)

    {

        if( GPIO_PIN_OUTPUT_LOW == wiced_hal_gpio_get_pin_output( WICED_GPIO_PIN_LED_1 ) )

        {

            wiced_hal_gpio_set_pin_output( WICED_GPIO_PIN_LED_1, GPIO_PIN_OUTPUT_HIGH );

           wiced_hal_gpio_set_pin_output( WICED_GPIO_PIN_TESTPIN16, GPIO_PIN_OUTPUT_HIGH );

            wiced_hal_gpio_set_pin_output( WICED_GPIO_PIN_TESTPIN17, GPIO_PIN_OUTPUT_HIGH );

               WICED_BT_TRACE( "LED_HIGH\n\r" );

        }

        else

        {

            wiced_hal_gpio_set_pin_output( WICED_GPIO_PIN_LED_1, GPIO_PIN_OUTPUT_LOW );

            wiced_hal_gpio_set_pin_output( WICED_GPIO_PIN_TESTPIN16, GPIO_PIN_OUTPUT_LOW );

            wiced_hal_gpio_set_pin_output( WICED_GPIO_PIN_TESTPIN17, GPIO_PIN_OUTPUT_LOW );

               WICED_BT_TRACE( "LED_LOW\n\r" );

        }

        /* Send the thread to sleep for a period of time */

        wiced_rtos_delay_milliseconds( THREAD_DELAY_IN_MS, ALLOW_THREAD_TO_SLEEP );

    }

View solution in original post

5 Replies
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi,

There is no limitation for WICED_P16. You can use wiced_hal_gpio_configure_pin() API for configuring the pin.

Can you please confirm what is the exact issue? Do you mean the output is not coming high or low when configuring?

Please share your project.

Regards,
Anjana

0 Likes

Hi,

We weren't able to use that API to configure that pin. We weren't able to get it to toggle or anything. After asking, someone said that you aren't able to configure that specific pin to a GPIO. I was wondering if this was a software issue or a hardware issue.

0 Likes

anpm

I just verified this on the CYW97020719Q40EVB-01.   I have code to toggle P16 and P17.  P17 toggles fine at the 100ms cycle time.  P16 is solid HIGH.

Here is my code.  I modified the platform.c to initialize P16 and P17 the same

ll the pins available on this platform and their chosen functionality */

const wiced_platform_gpio_t platform_gpio_pins[] =

    {

        [PLATFORM_GPIO_0 ] = {WICED_P00, WICED_GPIO },      //Button

        [PLATFORM_GPIO_1 ] = {WICED_P01, WICED_SPI_1_MISO },

        [PLATFORM_GPIO_2 ] = {WICED_P02, WICED_PCM_OUT_I2S_DO    },

        [PLATFORM_GPIO_3 ] = {WICED_P04, WICED_PCM_IN_I2S_DI },

        [PLATFORM_GPIO_4 ] = {WICED_P06, WICED_GCI_SECI_IN },

        [PLATFORM_GPIO_5 ] = {WICED_P07, WICED_SPI_1_CS },

        [PLATFORM_GPIO_6 ] = {WICED_P10, WICED_GCI_SECI_OUT },

        [PLATFORM_GPIO_7 ] = {WICED_P16, WICED_PCM_CLK_I2S_CLK   },

        [PLATFORM_GPIO_8 ] = {WICED_P17, WICED_PCM_SYNC_I2S_WS   },

        [PLATFORM_GPIO_9 ] = {WICED_P26, WICED_GPIO },      //Default LED 2

        [PLATFORM_GPIO_10] = {WICED_P25, WICED_I2C_1_SCL },

        [PLATFORM_GPIO_11] = {WICED_P28, WICED_SPI_1_MOSI },      //Optional LED 1

        [PLATFORM_GPIO_12] = {WICED_P29, WICED_I2C_1_SDA },

        [PLATFORM_GPIO_13] = {WICED_P33, WICED_UART_2_TXD },

        [PLATFORM_GPIO_14] = {WICED_P34, WICED_UART_2_RXD },

        [PLATFORM_GPIO_15] = {WICED_P38, WICED_SPI_1_CLK },

    };

/* LED configuration */

const wiced_platform_led_config_t platform_led[] =

    {

        [WICED_PLATFORM_LED_2] =

{

.gpio          = (wiced_bt_gpio_numbers_t*)&platform_gpio_pins[PLATFORM_GPIO_9].gpio_pin,

.config        = ( GPIO_OUTPUT_ENABLE | GPIO_PULL_UP ),

.default_state = GPIO_PIN_OUTPUT_HIGH,

},

        [WICED_P16] =

{

.gpio          = (wiced_bt_gpio_numbers_t*)&platform_gpio_pins[PLATFORM_GPIO_7].gpio_pin,

.config        = ( GPIO_OUTPUT_ENABLE | GPIO_PULL_UP ),

.default_state = GPIO_PIN_OUTPUT_HIGH,

},

        [WICED_P17] =

{

.gpio          = (wiced_bt_gpio_numbers_t*)&platform_gpio_pins[PLATFORM_GPIO_8].gpio_pin,

.config        = ( GPIO_OUTPUT_ENABLE | GPIO_PULL_UP ),

.default_state = GPIO_PIN_OUTPUT_HIGH,

},

// We can use either LED1 or SPI1 MOSI, by default we are using WICED_P28 for SPI1 MOSI,

// uncomment the following initialization if WICED_P28 is to be used as an LED and set PIN

// functionality in platform_gpio_pins as WICED_GPIO

        [WICED_PLATFORM_LED_1] =

{

.gpio          = (wiced_bt_gpio_numbers_t*)&platform_gpio_pins[PLATFORM_GPIO_11].gpio_pin,

.config        = ( GPIO_OUTPUT_ENABLE | GPIO_PULL_UP ),

.default_state = GPIO_PIN_OUTPUT_HIGH,

}

    };

Here is my code to toggle P16 and P17. The delay is 50ms

/* Thread function to control the LED */

void led_control( uint32_t arg )

{

    uint32_t led;

    for(;;)

    {

      led = wiced_hal_gpio_get_pin_output( WICED_P17 );

      wiced_hal_gpio_set_pin_output(WICED_P17 , ! led );

     wiced_hal_gpio_set_pin_output(WICED_P16 , ! led );

        /* Send the thread to sleep for a period of time */

      wiced_rtos_delay_milliseconds( THREAD_DELAY_IN_MS, ALLOW_THREAD_TO_SLEEP );

    }

}

0 Likes
CharlesF_21
Employee
Employee
25 sign-ins 10 sign-ins First comment on KBA

Christian.Rodriguez_1954501mroberts_arrowuser_249199259

The problem was introduced in WICED SDK 6.2 and until it is fixed please use the following work around:

in file wiced_platform.c add

//! List of pins available on the platform

enum wiced_platform_pins

{

    PLATFORM_GPIO_0,  

.

.

    PLATFORM_GPIO_15,

    PLATFORM_GPIO_16,

    PLATFORM_GPIO_MAX_PINS

};

and

#define WICED_GPIO_PIN_TESTPIN16   WICED_P16

#define WICED_GPIO_PIN_TESTPIN17   WICED_P17

In file wiced_platform_pin_config.c add

/* all the pins available on this platform and their chosen functionality */

const wiced_platform_gpio_t platform_gpio_pins[] =

    {

        [PLATFORM_GPIO_0 ] = {WICED_P00, WICED_GPIO              },      //Button 1

.

.

       [PLATFORM_GPIO_7 ] = {WICED_P16, RESERVED_1   },

        [PLATFORM_GPIO_8 ] = {WICED_P17, WICED_GPIO   },

.

.

       [PLATFORM_GPIO_16] = {WICED_P03, RESERVED_1         },

    };

and

/* GPIO Configuration */

const wiced_platform_gpio_config_t platform_gpio[] =

    {

            [WICED_PLATFORM_GPIO_1] =

                {

                    .gpio          = (wiced_bt_gpio_numbers_t*)&platform_gpio_pins[PLATFORM_GPIO_7].gpio_pin,

                    .config        = ( GPIO_OUTPUT_ENABLE | GPIO_INPUT_DISABLE ),

                    .default_state = GPIO_PIN_OUTPUT_LOW,

                },

             [WICED_PLATFORM_GPIO_2] =

                {

                     .gpio          = (wiced_bt_gpio_numbers_t*)&platform_gpio_pins[PLATFORM_GPIO_8].gpio_pin,

                     .config        = ( GPIO_OUTPUT_ENABLE ),

                     .default_state = GPIO_PIN_OUTPUT_HIGH,

                }

    };

in main thread or application add:

    for(;;)

    {

        if( GPIO_PIN_OUTPUT_LOW == wiced_hal_gpio_get_pin_output( WICED_GPIO_PIN_LED_1 ) )

        {

            wiced_hal_gpio_set_pin_output( WICED_GPIO_PIN_LED_1, GPIO_PIN_OUTPUT_HIGH );

           wiced_hal_gpio_set_pin_output( WICED_GPIO_PIN_TESTPIN16, GPIO_PIN_OUTPUT_HIGH );

            wiced_hal_gpio_set_pin_output( WICED_GPIO_PIN_TESTPIN17, GPIO_PIN_OUTPUT_HIGH );

               WICED_BT_TRACE( "LED_HIGH\n\r" );

        }

        else

        {

            wiced_hal_gpio_set_pin_output( WICED_GPIO_PIN_LED_1, GPIO_PIN_OUTPUT_LOW );

            wiced_hal_gpio_set_pin_output( WICED_GPIO_PIN_TESTPIN16, GPIO_PIN_OUTPUT_LOW );

            wiced_hal_gpio_set_pin_output( WICED_GPIO_PIN_TESTPIN17, GPIO_PIN_OUTPUT_LOW );

               WICED_BT_TRACE( "LED_LOW\n\r" );

        }

        /* Send the thread to sleep for a period of time */

        wiced_rtos_delay_milliseconds( THREAD_DELAY_IN_MS, ALLOW_THREAD_TO_SLEEP );

    }