Whats wrong with this?
I get this error:
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
#### Exception System.ArgumentException - 0xfd000000 (1) ####
#### Message:
#### GHIElectronics.TinyCLR.Devices.Spi.Provider.SpiControllerApiWrapper::SetActiveSettings [IP: 0000] ####
#### GHIElectronics.TinyCLR.Devices.Spi.SpiController::SetActive [IP: 000b] ####
#### GHIElectronics.TinyCLR.Devices.Spi.SpiDevice::Write [IP: 000b] ####
#### GHIElectronics.TinyCLR.Devices.Spi.SpiDevice::Write [IP: 0009] ####
#### VepelTest.Program::Main [IP: 0085] ####
Exception thrown: 'System.ArgumentException' in GHIElectronics.TinyCLR.Devices.Spi.dll
An unhandled exception of type 'System.ArgumentException' occurred in GHIElectronics.TinyCLR.Devices.Spi.dll
class Program
{
static GpioController gpio;
static SpiDevice spiDevice;
static SpiController spiController3;
static GpioPin oe;
static GpioPin la;
static void Main()
{
gpio = GpioController.GetDefault();
spiController3 = SpiController.FromName(SC20100.SpiBus.Spi3);
SpiConnectionSettings spiConnectionSettings = new SpiConnectionSettings()
{
ChipSelectType = SpiChipSelectType.None,
ChipSelectActiveState = false,
Mode = SpiMode.Mode0,
ClockFrequency = 1000,
DataFrameFormat = SpiDataFrame.LsbFirst
};
spiDevice = spiController3.GetDevice(spiConnectionSettings);
oe = gpio.OpenPin(SC20100.GpioPin.PA15);
oe.SetDriveMode(GpioPinDriveMode.Output);
la = gpio.OpenPin(SC20100.GpioPin.PA14);
la.SetDriveMode(GpioPinDriveMode.Output);
la.Write(GpioPinValue.High);
spiDevice.Write(new byte[] { 170, 120 });
la.Write(GpioPinValue.Low);
while (true)
{
oe.Write(GpioPinValue.High);
Thread.Sleep(1000);
oe.Write(GpioPinValue.Low);
Thread.Sleep(1000);
}
}
}