Home/Support/Support Forum/Does anyone have C code for using Microchip MCP23S08 or 17 I/O expanders (SPI) with RCM4100/4200?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Does anyone have C code for using Microchip MCP23S08 or 17 I/O expanders (SPI) with RCM4100/4200?

0 votes
I am trying to get two MCP23S08 and two MCP23S17 chips communicating to an RCM4100 processor. I have code written to initialize them but they don't seem to be responding to my test write requests to their outputs and I'm wondering if they need some kind of delays in between commands or if I'm doing something else wrong? I'm trying to use the SPI library. I have them all using hardware addresses and one chip select line. Addresses are 0, 1, 2 and 3. the two S08's are all outputs (one for LED's and one for Relays). One of the S17's is for DIP switch inputs, which I have not tried reading yet. The last S17 has to input pushbuttons, one LED output and an Omron 12-key keypad input (interrupt driven). If I can just get them communicating, I think I can figure out the rest of my programming.
asked Jun 7, 2013 in Rabbit by davidb_CSI New to the Community (0 points)
UPDATE:   I've figured out my problem.  It was in the initial chip configuration for the multiplexer chips.  I had to rearange the order in which they were initialized.  Viewing the SPI bus on my Tektronix scope really helped and reading back the registers after writing to them helped me see that some things had not initialized properly.  I now have four multiplexers, an LCD driver, temperature chip, A/D chip and D/A chip all working fine on the SPI bus.
Hello,

I am also using the  MCP23S08 with spi bus in user space.

I am running the test c code provided under the device file spidev1.0.

I can set the I/O pins on the  MCP23S08.

However, no matter what mode or whatever I try, the MISO pin from the development board always sends the clock out.

The  MCP23S08 when I disconnect the MISO pint from the development board, outputs the correct data.

Any help is greatly appreciated.

Tim

Please log in or register to answer this question.

...