SX1509 I/O expander ESP32

Hi,

I am using a Sparkfun SX1509 expander with an ESP32 (DOIT board). With a lot of library- and pullup trouble I have get it to work fine now. I need some more information about the Interrupt SX1509 possibility because I need to code a state machine (keep some buttons from repeating -hold/single shot-). The SX1509 data sheet says there are 2 possibilities to generate interrupts:

1 - the I/O’s they can be set and checked with a couple of registers

2 - They keyboard engine that’s embedded in the chip.

The data sheet states: ’ Hence we have NINT = “user defined condition occurred” OR “keypad engine condition occurred” ’

This is a bit vague. Which of the sources generates an interrupt when both of them (1 and 2) are used ?

You can also set how/when the interrupt is fired: at the rise or fall or both of the button press. But what happens when you hold the button, will it keep pulsating (low) the interrupt or will it stay low as long as you hold the button?

I already asked Semtech.

Maybe someone at Sparkfun knows?

Henk Wijtman

Rotterdam

Netherlands

Out of curiosity, what did Semtech say?

http://cdn.sparkfun.com/datasheets/BreakoutBoards/sx1509.pdf:
The SX1507, SX1508 and SX1509 have the ability to generate mask-programmable interrupts based on falling/rising edge of any of its GPIO lines.

http://cdn.sparkfun.com/datasheets/BreakoutBoards/sx1509.pdf:
When NINT is low (i.e. interrupt occurred), it can be reset back high (i.e. cleared) by writing 0xFF in RegInterruptSource (this will also clear corresponding bits in RegEventStatus register). The interrupt can also be cleared automatically when reading RegData register (Cf. RegMisc)

These lead me to believe that if you push a button and hold it, the falling edge (or how the trigger register is configured) will trigger and say low if the reset conditions aren’t met as described above.

Brandon,

Thanks for answering. No reply from SemTech yet.

By setting bit 0 of the regMisc register to 1 you can keep the NINT from autoclearing when RegData is read. You have to clear it manually in your code by writing a 1 to RegInterruptSource or RegEventStatus.

So I did. But there’s nothing different in the behaviour of the SX1509 interrupt (keeps sending out button-repeat-pulses when I hold a button on the keypad.)

When I hold a button I need the interrupt to stay low for the time I hold it. In this way I can create a state-machine (detecting a long keypress) in my code so the function for that particular button only fires once.

I want to know when both interrupt sources (Keypad-Scanning-Engine & separate I/O’s) are configured which one (or both) fires (low) and clears (high) the interrupt and how/when ?

Henk