8 Replies Latest reply on Jul 5, 2018 11:21 PM by chwa_1570756

    How can I configure to activate GPIO pin?

    chwa_1570756

      Hello,

       

      I use WICED6.2 with the platform of CYW94343WWCD1_EVB, when I make the  "snip.gpio-CYW94343WWCD1_EVB download run", everything is ok and LED1&2 on borad can blink properly. Anyway I want to operate another gpio pin of WICED_GPIO_20(MICRO_GPIO_2),

      so I just simply modified the definition  of #define WICED_LED1  ( WICED_GPIO_11 ) to  #define WICED_LED1  ( WICED_GPIO_20 ) in platform.h and dowload run, but I can not get voltage level changes from WICED_GPIO_20 pin measuring by a multi-meter.

      anybody know if there is some else gpio configure I missed?

       

      Chris

        • 1. Re: How can I configure to activate GPIO pin?
          ZhengbaoZ_96

          Hi:

           

             do you have a change on this define position?

          /* PWM peripherals. Used by WICED/platform/MCU/wiced_platform_common.c */

          const platform_pwm_t platform_pwm_peripherals[] =

          {

            [WICED_PWM_1] = {TIM3, 3, RCC_APB1Periph_TIM3, GPIO_AF_TIM3, &platform_gpio_pins[WICED_GPIO_11]},

            [WICED_PWM_2] = {TIM10, 1, RCC_APB2Periph_TIM10, GPIO_AF_TIM10, &platform_gpio_pins[WICED_GPIO_26]},

          1 of 2 people found this helpful
          • 2. Re: How can I configure to activate GPIO pin?
            chwa_1570756

            Hi ZhengbaoZ_96

             

            Thanks for your reply.

            I try to change the WICED_GPIO_11 to WICED_GPIO_20 in all related code including your advice above, but I still can not observe voltage change on the pin of PC0.0 (WICED_GPIO_20)  controlled by snip.gpio.c

            any other issue I did not consider?

            • 3. Re: How can I configure to activate GPIO pin?
              AxLi_1746341

              zhez wrote:

               

              Hi:

               

                 do you have a change on this define position?

              /* PWM peripherals. Used by WICED/platform/MCU/wiced_platform_common.c */

              const platform_pwm_t platform_pwm_peripherals[] =

              {

                [WICED_PWM_1] = {TIM3, 3, RCC_APB1Periph_TIM3, GPIO_AF_TIM3, &platform_gpio_pins[WICED_GPIO_11]},

                [WICED_PWM_2] = {TIM10, 1, RCC_APB2Periph_TIM10, GPIO_AF_TIM10, &platform_gpio_pins[WICED_GPIO_26]},

              Why checking PWM peripherals?

              wiced_pwm_init() is never called by snip.gpio.

              • 4. Re: How can I configure to activate GPIO pin?
                chwa_1570756

                Hi axel,

                 

                Thanks for your reply.

                What do you think of the original question about GPIO pin?

                • 5. Re: How can I configure to activate GPIO pin?
                  AxLi_1746341

                  Make sure WICED_GPIO_20 is properly initialized by platform_gpio_init().

                  • 6. Re: How can I configure to activate GPIO pin?
                    ZhengbaoZ_96

                    Hi Chris:

                     

                         Not to set WICED_GPIO_20,  it is config to  WICED_BUTTON1 , and set to input_pull_up .  and it is initialized after led GPIO, so your modification will not work.  Thanks Axel, forget the PWM setting.

                     

                       or you need to change the WCIED_BUTTON1 to another pin define.

                    1 of 1 people found this helpful
                    • 7. Re: How can I configure to activate GPIO pin?
                      chwa_1570756

                      Hi,

                       

                      As following the advice I added the initialized program in platform.c like this:

                      ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                      void platform_led_init( void )

                      {

                          /* Initialise LEDs and turn off by default */

                       

                          platform_gpio_init( &platform_gpio_pins[WICED_GPIO_21], OUTPUT_PUSH_PULL ); // the added line for initialize pin

                       

                          platform_gpio_init( &platform_gpio_pins[WICED_LED1], OUTPUT_PUSH_PULL );

                          platform_gpio_init( &platform_gpio_pins[WICED_LED2], OUTPUT_PUSH_PULL );

                          platform_led_set_state(WICED_LED_INDEX_1, WICED_LED_ON);

                          platform_led_set_state(WICED_LED_INDEX_2, WICED_LED_OFF);

                      }

                      ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                      And change the pin state in gpio.c like this:

                       

                      void application_start( )

                      {

                          wiced_bool_t led1 = WICED_FALSE;

                          wiced_bool_t led2 = WICED_FALSE;

                          wiced_bool_t button1_pressed;

                          wiced_bool_t button2_pressed;

                       

                          /* Initialise the WICED device */

                          wiced_init();

                       

                          WPRINT_APP_INFO( ( "The LEDs are flashing. Holding a button will force the corresponding LED on\n" ) );

                       

                          while ( 1 )

                          {

                              /* Read the state of Button 1 */

                              button1_pressed = wiced_gpio_input_get( WICED_BUTTON1 ) ? WICED_FALSE : WICED_TRUE;  /* The button has inverse logic */

                       

                       

                              if ( button1_pressed == WICED_TRUE )

                              {   /* Turn LED1 on */

                                  wiced_gpio_output_high( WICED_LED1 );

                              }

                              else

                              {   /* Toggle LED1 */

                                  if ( led1 == WICED_TRUE )

                                  {

                                      wiced_gpio_output_low( WICED_LED1 );

                                      led1 = WICED_FALSE;

                                      wiced_gpio_output_high( WICED_GPIO_21); // the added line for testing pin state

                                  }

                                  else

                                  {

                                      wiced_gpio_output_high( WICED_LED1 );

                                      led1 = WICED_TRUE;

                                      wiced_gpio_output_low( WICED_GPIO_21); // the added line for testing pin state

                                  }

                              }

                              wiced_rtos_delay_milliseconds( 250 );

                          }

                      }

                       

                      Normally  WICED_GPIO_21(GPIOC.1) active state should be observed by multi meter, but it always keep low.

                      • 8. Re: How can I configure to activate GPIO pin?
                        chwa_1570756

                        Hi,

                         

                        I try to test those pins of PORTA  or PORTB using the same procedure, they can work normally, so I guess the PORTC pins are not correctly initialized by platform_gpio_init( ) API command.