Main Site Documentation

How to handle multiple spi devices


#1

I like to control 3 spi devices within one project. It seems to be only one instance of the spi-class per spi-Port allowed ( ‘System.InvalidOperationException’ when I try a second new SPI(… with the same spi-port in the spi.configuration). Does this mean, that I have to destroy and to construct a spi object when I want to change output to an other device with different CS-Port? The member ChipSelect_Port is read only. The only practical way I see now, is to handle the CS Pin by my own? Is this right or are there smarter (and most important faster) solutions?


#2

You will have one SPI object always but then you have multiple configurations, one for each device you have.

Here is a good example http://www.fezzer.com/project/54/mp3-shield/