Multiple slaves on spi

Hi,

Is it possible use the sd card and the Ethernet Chip on the spi Port at the Same time (in the Same way the "Big" breakout board with ethernet and sd Card Slot does?). Im using the ENC28J60 Ethernet module.

-tsaG

Is it possible use the sd card and the Ethernet Chip on the spi Port at the Same time (in the Same way the "Big" breakout board with ethernet and sd Card Slot does?)

No, and it doesn't, either. It is possible to toggle which one is active, without negative affects on the other, making it possible to use them both in the same sketch. Just not both at the same time.

It depends what you mean by "at the same time" - the SPI bus is designed to handle multiple slaves so long as each transaction is separate and all devices have a CS input. However its not that simple since different devices may want different SPI clock modes and speeds, and some devices are 3.3V (SD cards, ENC28J60) and some are 5V. You must read the datasheets carefully (many devices are pseudo-SPI and break the rules). You may need to ensure the SPI settings are reprogrammed before each transaction if devices are using different settings.

Its also not clear you can share devices where one uses clock-normally-low and the other clock-normally-high, a bit of experimentation might be needed.

If you want to use SPI from an interrupt handler things get more complex - you have to ensure all SPI access disables interrupts so that the SPI bus is guaranteed free during interrupt handling. If using interrupts make sure you have SPI clock speed setup as fast as possible to reduce the time interrupts are disabled.

So read those datasheets...