GPIO not working


#1

I’m trying to read the GPIOs, using the supplied gpioCf3 example as a basis.

http://legato.io/legato-docs/latest/sampleApps_gpioCf3.html

But it doesn’t work: I’ve set all the GPIOs as inputs with pullups, yet some of them read as zero!
When I apply 0V or 1.8V (via 1k resistor) the values read do not change, and change event handlers are not called.

The voltage at the GPIOs is ~ 0.3 - 0.4 V.

For each input, the setup looks like this:

//-------------------------------------------------------------------------------------------------
/**
 *  Pin-per-service GPIO pin33 as example = IoT0 GPIO2
 */
// -------------------------------------------------------------------------------------------------
static void Pin33GpioSignal()
{
    bool value = false;
    le_gpioPin33_SetInput(LE_GPIOPIN33_ACTIVE_HIGH);
    le_gpioPin33_EnablePullUp();
    value = le_gpioPin33_Read();
    LE_INFO("Pin33 read active: %d", value);

    le_gpioPin33_ChangeEventHandlerRef_t ref = le_gpioPin33_AddChangeEventHandler(LE_GPIOPIN33_EDGE_BOTH, PinChangeCallback, &Pin33, 100);

    LE_INFO("Pin33 change handler ref: %p", ref);

    // Change the edge setting
    le_gpioPin33_SetEdgeSense(LE_GPIOPIN33_EDGE_BOTH);
}

I also read the inputs on a timer:

static void tmrHandler(le_timer_Ref_t timerRef) {
    LE_INFO( "- %d %d %d - %d %d %d %d - %d %d %d",
    	// IoT0
    	    //le_gpioPin42_Read(),
    	    le_gpioPin33_Read(),
    	    le_gpioPin13_Read(),
    	    le_gpioPin8_Read(),

	// IoT1
    	    le_gpioPin25_Read(),
    	    le_gpioPin7_Read(),
    	    le_gpioPin32_Read(),
    	    le_gpioPin21_Read(),

	// IoT2
    	    le_gpioPin22_Read(),
	    le_gpioPin23_Read(),
    	    le_gpioPin24_Read()
	);
}

(Pin42 is commented-out, because the app crashes when this is included in the .adef/.cdef)

I am using these breakout boards from Farnell (Element-14) to access the GPIOs:

http://uk.farnell.com/embest/1401148/mangoh-platform-iot-breakout-board/dp/2531299

I can find no documentation or schematic for these, but it seem that the holes marked 17-11 are the four GPIOs?

Where am I going wrong?


IoT breakout board pin mapping
#2

This is what I worked out as the pinout - in case any one can spot any errors/omissions:

(the forum won’t let me attach the Excel original - hopefully the image is usable).


#3

Hi,
Can anyone help me with a code to toggle a GPIO (i want to use le_gpioPin7)
I am using below api to change the le_gpioPin7 state to high and working good. My application start manually so the problem here is le_gpioPin7 always remains high after power restart. is it ok or something wrong

{
myGpio_SetPushPullOutput(LE_GPIOPIN7_ACTIVE_HIGH, false);
if(myGpio_Activate()==LE_OK)
LE_INFO(“myGPIO is High”);
}


#4

Can you look through the sample code below and compare to what you have:

The bilgesensor app uses gpio7


#5

Hi Ashish,
Thank you for the link. I can see in all sample apps CF3 GPIOs are used as input (bilgesensor app uses gpio7 as input) but I want to use a GPIO as an output.

Thanks


#6

For GPIO output, please see this sample app:
https://github.com/mangOH/mangOH/tree/master/samples/tutorials/hardwareInterfaces/gpio/TimerLed


#7

Thanks. Yes this work for me. Now I have understood the use of gpio api.


#8

Hi everyone…i am a new user here. In my case I am using below api to change the le_gpioPin7 state to high and working good. My application start manually so the problem here is le_gpioPin7 always remains high after power restart.

turnkey pcb assembly


#9

@JaseSerre seems like you were pasting the API but it went to advertisement page. Can you repost?
thank you.