How to set up GPIO22 INPUT (I/O3) as Pull Up on FX30S


How to set up GPIO22 INPUT (I/O3) as Pull up on FX30S

We connected GPIO22 to a contact to detect if the door of the box where FX30S is inserted is opened or closed.
Until now we were using GPIO22 as a Pull Down (default configuration) and we had the external contact to high and it was working perfectly. But now our end customer has asked us to modify the GPIO22 as Pull Up connecting the external contact to ground and we have issues with this configuration.

These are the steps we have followed to set up digital input GPIO22 with a Pull Up
• First we call to le_gpioPin22_EnablePullUp()
• Then we register the handler to have the call when there´s a rising or failling edge in the signal with le_gpioPin22_AddChangeEventHandler(LE_GPIOPIN22_EDGE_BOTH, Pin22ChangeCallback, NULL, sample)
We have also try calling le_gpioPin22_Activate() and le_gpioPin22_Deactivate() before and after calling le_gpioPin22_EnablePullUp() as is done in the example gpioCf3Pin.c of Legato but we receive error in the calls Activate and Deactivate because it´s only possible to call this function if it´s an digital output.

We also have checked in the OS if the digital input set up and value are OK . We go to /sys/devices/virtual/gpio/gpio22 and here we find that the files with the configuration and GPIO22 value. Bellow the file name and the content

active_low: with value 0 or 1 depending if the set up is Active Low. We have tested both values with the same result.

direction: Value in because is a Digital Input.
• edge: If the set up is for rising edge, failling, both or any. We have used “both” because is the default.
• pull: pull up or pull down. We read the value up because is set up as Pull Up.
• uevent: Empty and we don´t know what´s the use
• value: It´s the value of the digital input. We have done a script that reads the file every 5 seconds and they see that when the input is set up as pull Down, the value changes between 0 and 1 OK but when is set up as Pull Up the value is all time to 1. So there´s not failling edge and for that we never receive the callback.

We think we have the right set up for the digital input as Pull Up . There´s must be a parameter we missed in the configuration .

We don´t understand the set up of Figure 2-19: "High Side Pull-up / Dry Contact Switch Input " of FX30S user guide, page 26 . Do we need any additional set up to have GPIO22 as pull up?