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?