I looked at the Arduino C code and it looks similar to what I have. I'm using a SPI.Configuration object. See
http://msdn.microsoft.com/en-us/library/cc544112.aspx. It also specifies a setup and hold time and I've set those to 0 and I'm unsure if that affects the transfers but I don't see any reference to it in the C code.
Code: Select allstatic SPI.Configuration m_SPIConfig4PressureSensor = new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.Di10, false, 0, 0, false, true, 125, SPI.SPI_module.SPI1);
and in the Init() I check for the Revision ID:
Code: Select all private static void InitPressureSensor()
{
Thread.Sleep(200);
byte[] arrTxData = new byte[1];
arrTxData[0] = 0x00;
byte[] arrRxData = new byte[1];
m_PressureSensor.WriteRead(arrTxData, arrRxData);
WriteLineToFile("SCP1000 ASIC version: " + arrRxData[0].ToString());
if (arrRxData[0] != 0x03) // if we didn't get the expected version number
{
throw new InvalidOperationException("The pressure sensor could not be initialized");
}
}
I previously owned another SCP1000 breakout board which I purchased in 2007. After many fruitless tries and asking around people remarked that it was probably defective, although I did see waveforms on the MOSI but not the MISO. I threw it out and bought a new one, but to my horror I can't get this one to work either. For some reason I don't see any waveforms on my scope this time, but I just ordered a new scope (Sparkfun Open-source scope).
But maybe I'm missing something obvious. I haven't found anyone who's got SCP1000 working with .NET Micro Framework so I can't compare source code.