What softwareis needed to detect a button press on an up4000

KrissNC New Member Posts: 31

I'm trying to detect a button press using interrupts, (I have 3 buttons to check for in the final product)
unale -a give : Linux up4k01 5.4.0-1-generic #0~upboard5-Ubuntu SMP Fri Jan 7 11:53:57
[email protected]:/home/adrem# gpiodetect
gpiochip0 [INT3452:00] (78 lines)
gpiochip1 [INT3452:01] (77 lines)
gpiochip2 [INT3452:02] (47 lines)
gpiochip3 [INT3452:03] (43 lines)
gpiochip4 [Raspberry Pi compatible UP GPIO] (28 lines)
I have established that the gpiochip 4 has for example the 23pin. I managed to write on it using sysfs, and read from a button using polling. I need to "receive" the button press, not poll for it. On a raspberry PI, there's an edge file that allows to detect rising or falling edges. I can't find any edge file on an up4000 board.
Also mraa doesnt sem to work, what am I missing ?


  • garyw
    garyw New Member, Moderator, AAEON Posts: 67 admin

    currently the interrupt is not support in gpiochip4 yet, the new pin controller driver will add interrupt support in summer.
    the workaround is using the native GPIO interrupt instend gpiochip4.
    the native GPIO mapping you can find in our WiKi


  • KrissNC
    KrissNC New Member Posts: 31

    @garyw Thanks a ton for that answer.
    I'm not sure what you mean by saying "native gpio mapping". is that the 437 numbering and such ?
    I can't see any IRQ style pin, on that 40 pin connector.
    Could you be more precise ? (I can understand, I think)
    What would you do if you needed :
    1/ Handle 3 buttons, (one for "shutdown", one for "update", and an extra one) avoiding "polling"
    2/ Send I2C commands to an I2C display (very simple I2C display... mine is 16Col x 2 lines LCD)

  • KrissNC
    KrissNC New Member Posts: 31

    Major improvement. after writing 471 on /sys/class/gpio/export
    There was a gpio471 created, with an edge file inside ! writing "both" into edge, I was then able to read the value file when it changes, and detect a button press.

    No I must focus on sending I2C commands (on pins 3 and 5 I suppose), but no clue how to make it.
    I still don't have mraa working and it would be a great help, but there again everything I tried failed.