SPI Library: Chip Select lines from I/O Expander

Hi all,
I have a quite complex project that uses dozens of I/O lines. I ran out of the and used several I/O expanders (8574) .

Now I additionally need about 20 digital potentiometers. I use the MCP42010 chips (SPI Interface).
To communicate with the digital potentiometers via SPI I plan to use 12 additional CS* lines from the I/O Expanders.

Now my question: All libraries I've seen so far use the standard, OnBoard I/O pins for CS* and SPI communication.

Is there anybody out there who has some experience / knowledge / idea how to do this the easiest way?

Thanks a lot for all idea and help
Michael

The other SPI signals are coming from the SPI standard pins, right?

So I don't see a problem with your idea, nor anything that would be any more or less fun. Elegant or whatever.

a7

@alto777,
Ahhhh, now I see. the CS* (chip select) is handled separately and outside of the SPI library and thus I can use whatever code needed to drive the CS* line low during an SPI.transfer ...
Sorry, didn't know this, bur you opened my eyes.

Thanks a lot
Michael

It may be that some device libraries that use the SPI interface make it easy to nominate a /CS pin and more difficult/impossible to use an output off an expander.

But if you stay on the low level and just use SPI directly you can get the /CS from anywhere, um, logical.

Sometimes the solution is to modify a library that disappoints. Other times it might mean eschewing the use of a library and learning just enough about, say, a digipot so you can wrangle with it all by youself.

I like to write the lowest level code possible. For me libraries are usually an adjunct to perusing datasheets and figuring out how things need to be said to a device to be controlled.

As usual, it all depends on what kind of fun you want to have.

a7