Author Topic: XRA1403 SPI GPIO Expander Interrupts  (Read 1058 times)

0 Members and 1 Guest are viewing this topic.

Offline kevinateevTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: ca
XRA1403 SPI GPIO Expander Interrupts
« on: February 27, 2022, 02:19:13 pm »
Has anybody ever managed to get the Interrupt working on this chip,


https://www.maxlinear.com/product/interface/bridges/gpio-expanders/spi-gpio-expanders/xra1403


I send the following codes to it but I get no interrupt on PIN 1.


WRITE GCR (06) 0x00 -- P0-7 output
WRITE GCR (07) 0xFF -- P8-15 input
READ GSR (81) 0xFF -- read pin status and clear interrupts P8-15
WRITE IER (0B) 0xFF -- write interrupt enable P8-15
WRITE REIR (11) 0xFF -- rising edge interrupt P8-15

I've got P8 at normally low and am pulling it high with a button.

And yet, my pin 1 does not go low.  I have a pullup set on the microcontroller side.
« Last Edit: February 27, 2022, 03:18:45 pm by kevinateev »
 

Offline kevinateevTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: ca
Re: XRA1403 SPI GPIO Expander Interrupts
« Reply #1 on: February 28, 2022, 01:42:24 pm »
I've uploaded the project where I'm stuck with this issue ... interrupts not working.

https://github.com/kpishere/pico_experiments

It is the hello_spi project.

FYI: This repo also shows a convenient workflow with RP2040/Pico, J-Link, openocd, and gdb
« Last Edit: February 28, 2022, 03:45:21 pm by kevinateev »
 

Offline kevinateevTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: ca
Re: XRA1403 SPI GPIO Expander Interrupts
« Reply #2 on: March 02, 2022, 07:04:54 pm »
Also, found this really interesting paper that does a market survey of this class of chip.  Focuses on the I2C communication type, not SPI but still, here are some alternate part numbers.

https://neo900.org/stuff/papers/iox.pdf
 

Offline kevinateevTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: ca
Re: XRA1403 SPI GPIO Expander Interrupts
« Reply #3 on: March 03, 2022, 01:44:14 pm »
OK!  Problem solved!

The working code is in the repo already linked above.  The datasheet was very terse for this chip, there is ONLY a linux driver out there but that is almost un-readable due to driver abstractions in linux.  Here was the essence of the hangup with the datasheet:

1) The datasheet didn't indicate that you MUST have CS line go high between command/data messages (16bits)
2) The command representation is a bit odd. If you are showing a hexdecimal number for each command, why not show in the actual 8bit format?  Why shift the values all to the right one bit?

I'd found it easier to represent the bytes as follows below as these are values I can cross reference on logic analyzer without having to bit shift in my head.  From the below values, I add 0x02 to indicate the second bank when needed.
 
/* XRA registers */
#define XRA_GSR 0x00 /* GPIO State - Read-Only */
#define XRA_OCR 0x04 /* Output Control - Read/Write */
#define XRA_PIR 0x08 /* Input Polarity Inversion - Read/Write */
#define XRA_GCR 0x0C /* GPIO Configuration - Read/Write */
#define XRA_PUR 0x10 /* Input Internal Pull-up Resistor Enable/Disable - Read/Write */
#define XRA_IER 0x14 /* Input Interrupt Enable - Read/Write */
#define XRA_TSCR 0x18 /* Output Three-State Control - Read/Write */
#define XRA_ISR 0x1C /* Input Interrupt Status - Read-Only */
#define XRA_REIR 0x20 /* Input Rising Edge Interrupt Enable - Read/Write */
#define XRA_FEIR 0x24 /* Input Falling Edge Interrupt Enable - Read/Write */
#define XRA_IFR 0x28 /* Input Filter Enable/Disable - Read/Write */
« Last Edit: March 03, 2022, 01:46:43 pm by kevinateev »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf