Department of InformatiX
Microsoft .NET Micro Framework Tools & Resources
Core (2)
Globalization
Peripherals
WPF (1)
Networking (4)
Developing
Emulators (2)
Port specifics
Others

SPI

The SPI bus does not work. What should I check?

SPI is highly configurable standard, so check with the datasheet of your device what you should pass to the SPI.Configuration constructor. Also ensure that you pass the clock rate which is supported by your .NET Micro Framework device and be careful, this parameter is in kilohertz, so if you pass 16000, it means 16 MHz, which is quite a lot...

My device is read-only (like ADC converter). Where is the Read method?

While your device may be read-only, the SPI standard requires you to send data out if you want to read anything. If your device is read-only, it probably does not take care about what you send in, so you can just send zeros. And for performance, you can have them declared statically:
private static ushort[] _dummyArray = new ushort[1]; private ushort[] _readArray = new ushort[1]; public int ReadValue() { _device.WriteRead(_dummyArray, _readArray); return _readArray[0]; }