Trouble enabling interrupts on MCP23S17 using the Arduino

Hello

I am trying to use an interrupt with a button connected to the Arduino, which is connected to the MCP23S17, to light up an LED. So far I have gotten the LED to turn on and off through the MCP23S17 board, but I have not been able to get interrupts working.

I've done a lot of searching already but working with registers and stuff to enable interrupts, etc, is not something I have ever done before. My code is below, currently it's just alternating the LED's.

https://www.gammon.com.au/forum/?id=10945
I found this resource which is unfortunately for the MCP23017, and I can't use that chip.
Could someone point me in the right direction or offer other assistance?

#include <SPI.h>
#include <MCP23S17.h>

MCP23S17 bluechip(&SPI, 10 , 0x20);

const int PORT_INTA_PIN = 20;
const byte GPINTENA = 0x04;
const byte GPINTENB = 0x05;
const int PORT_EXPANDER_SS_PIN = 10;
const uint8_t PORT_EXPANDER_ADDRESS = 0;
const uint8_t SLAVE_CONTROL_BYTE = 0b1000000 | (PORT_EXPANDER_ADDRESS << 1);

void writeByte(uint8_t reg, uint8_t data) {
  digitalWrite(PORT_EXPANDER_SS_PIN, LOW);
  SPI.transfer(SLAVE_CONTROL_BYTE);
  SPI.transfer(reg);
  SPI.transfer(data);
  
  digitalWrite(PORT_EXPANDER_SS_PIN, HIGH);
  bluechip.enableInterrupt(PORT_INTA_PIN, RISING);
  pinMode(4, INPUT);
  bluechip.setInterruptLevel(LOW);
  //bluechip.writeRegister(0x02, 0xFF);
}

void handleIntA() {
  bluechip.digitalWrite(1, HIGH);
  Serial.println("Interrupt");
  delay(5000);
  writeByte(GPINTENA, 1);
  writeByte(GPINTENB, 1);
}

void setup() {
  Serial.begin(9600);
  bluechip.begin();
  delay(2000);
  pinMode(10, OUTPUT);
  bluechip.pinMode(1, OUTPUT);
  bluechip.pinMode(2, OUTPUT);
  writeByte(0x02, 0b11110000);
  pinMode(PORT_INTA_PIN, INPUT);
  attachInterrupt(digitalPinToInterrupt(PORT_INTA_PIN), handleIntA, HIGH);
}

void loop() {

  bluechip.digitalWrite(1, HIGH);
  bluechip.digitalWrite(2, LOW);
  delay(200);
  bluechip.digitalWrite(1, LOW);
  bluechip.digitalWrite(2, HIGH);
  
}

The classic use of an interrupt with a port expander chip is to signal that an input has been detected on an expanded port pin so the mpu does not have to continuously poll it.

I haven't (yet) looked at the data sheet for your serial version of the chip, but maybe you are not able to trigger an interrupt in the way you are attempting which appears to treat the expander pins as output pins.