The error I get while trying to use the SPI driver is as follows:
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message:
#### Microsoft.SPOT.Hardware.Port::ReservePin [IP: 0000] ####
#### Microsoft.SPOT.Hardware.SPI::.ctor [IP: 002c] ####
#### Samraksh.SPOT.Testing.SPITest::.ctor [IP: 0015] ####
#### Samraksh.SPOT.Testing.SPITest::Main [IP: 0004] ####
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.dll
I read this post --
https://groups.google.com/forum/#!topic/microsoft.public.dotnet.framework.microframework/VTwmaXj10OM -- and other similar posts and all of them mention that the pin is being assigned somewhere else. My code is very simple and the pin that I use is not being assigned anywhere. Given below is the portion in the code where this error happens:
_spi0 = new SPI(new SPI.Configuration(Cpu.Pin.GPIO_Pin10, false, 0, 0, false,
false, 2, SPI.SPI_module.SPI2));
I have tested the same configuration from a native (C++) code and I am able to verify that SPI works.
Please let me know what is wrong with the code pasted above.
Thanks.