I have a project in which I’m using multiple SPI ADCs on a single SPI bus (Microchip’s MCP3208). It works just fine with a single device on the bus, or with two devices on different buses. However, I get an error when I try to create a second SPI object on a bus.
Here’s an example:
SPI SPI_A = new SPI(new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.Di26, false, 0, 0, false, true, 2000, SPI.SPI_module.SPI2)); SPI SPI_B = new SPI(new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.Di24, false, 0, 0, false, true, 2000, SPI.SPI_module.SPI2));
When I try this, I get a System.InvalidOperationException on the second line. If I change the bus to SPI1 on ether the first or second line it works just fine.
Has anyone been able to run multiple SPI devices on the same bus? Any suggestions?