gpio_keypad_enable not working if PF0 (GPIO_0) pin is used.

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

cross mob
Anonymous
Not applicable

i defined for my application 2 "custom" GPIOs:

[WICED_GPIO_MYGPIO0] = {GPIOF,  0,  RCC_AHB1Periph_GPIOF},

[WICED_GPIO_MYGPIO1] = {GPIOF,  1,  RCC_AHB1Periph_GPIOF},

And i wanted to use them as keypad events so i did:

static const gpio_key_t scan_button[] =

{

    {   .gpio     = WICED_GPIO_MYGPIO0,

        .polarity = KEY_POLARITY_HIGH

    }

};

and in the main application called

opsuccess=gpio_keypad_enable(&ScanApControl_Keypad, WICED_HARDWARE_IO_WORKER_THREAD,scan_control_keypad_handler, 250, 2, scan_button );

if(opsuccess==WICED_SUCCESS)
{
   WPRINT_APP_INFO( ("IRQ SETUP OK !!\r\n") );
}
else
{
   WPRINT_APP_INFO( ("IRQ SETUP ERROR!!\r\n") );
}

Than i declared the callback

static void scan_control_keypad_handler(gpio_key_code_t keyCode, gpio_key_event_t event)

{

    if (event == KEY_EVENT_PRESSED

    {

        WPRINT_APP_INFO( ("KEY EVENT TRIGGERED!!\r\n") );

     }

}

The problem is that if i do use WICED_GPIO_MYGPIO1 everything works smootly but if i use WICED_GPIO_MYGPIO0 i get "IRQ SETUP OK" but the callback is never triggered.

Does anybody can explain why? Maybe a bug on interrupt masking of PF0 pin?

Thanks for you support

0 Likes
1 Solution
Anonymous
Not applicable

I found the issue

we defined the DISABLE_MCU_POWER_SAVING so no oob_interruput is generated by pin PB0.

There should be an upgrade of irq in order to be able concurrent interrupts on same pin number of different ports.

Thanks for your support.

View solution in original post

6 Replies
SeyhanA_31
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Hi,

Perhaps the gpio pin needs to be initialized. The wiced_gpio_init(...) could be called from init_platform(...) to initialize the gpio as input with proper pull up or pull down resistor setup.

There are few sample applications related to gpio input callback registration and handling callbacks. One of them is .../Apps/demo/temp_control/temp_control.c, setpoint_control_key_list. Another one is "push2scan" a new and simple snip that starts and stop WiFi scanning.

Seyhan

0 Likes
Anonymous
Not applicable

Hi

it's not needed if you look inside the gpio_keypad_enable function at line 115 you will find

wiced_gpio_init( key_list.gpio, ( ( key_list.polarity == KEY_POLARITY_HIGH ) ? INPUT_PULL_UP : INPUT_PULL_DOWN ) );

this enables the input according to the required polarity.

Furthermore we have that the WICED_GPIO_MYGPIO1 works properly and it's treated exactly in the same way as WICED_GPIO_MYGPIO0

0 Likes

Hi,

Which module and EVB are you using?

0 Likes
Anonymous
Not applicable

Module is BCM943362WCD4.

Evb is WICED Promotion EVB.

It looks like it's something connected with PB0 SDIO activity, since the irq handler is joined for all the Zeros Pins of all the ports....if someone could confirm would be great.

Bests

0 Likes

Hi,

Are you are trying to use the MICRO_ADC_IN1/2 (PA1/PA2)? The MICRO_ADC_IN1/2 are connected to SW2/SW1 respectively.

The GPIO_0 (PB0) is used as output for selecting SDIO/SPI interface on the BCM43362 (radio inside of WM-N-BM-02 SiP). GPIO_0 and GPIO_1 are not routed out of the BCM943362 module. There are some state changes on the GPIO_1 because it is used as an host wakeup from the radio. Perhaps that explains why you are getting some callback for GPIO_1 registration but not on GPIO_0.

The BCM943362WCD4 module uses STM32F205 as host MCU to interface with BCM43362. There are no PF0 on STM32F205.

You may find module schematics in .../WICED-SDK-2.4.1/Doc/Schematics/BCM943362WCD4 directory. Also the base board schematic are in .../WICED-SDK-2.4.1/Doc/Schematics/BCM9WCD1EVAL1 directory of the SDK.

pastedImage_0.png

Thanks,
Seyhan

0 Likes
Anonymous
Not applicable

I found the issue

we defined the DISABLE_MCU_POWER_SAVING so no oob_interruput is generated by pin PB0.

There should be an upgrade of irq in order to be able concurrent interrupts on same pin number of different ports.

Thanks for your support.