Main Site Documentation

Accelormeter on Cobra


#1

I’m trying to use the accelormeter on the Cobra, I see that the driver has the following:


if (FEZ.FEZ_System.GetSystemType() == FEZ_Type.Domino)
                {
                    _spi = new SPI(new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.UEXT10, false, 0, 0, true, true, 100, SPI.SPI_module.SPI2));
                }
                else if (FEZ.FEZ_System.GetSystemType() == FEZ_Type.Mini)
                {
                    _spi = new SPI(new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.UEXT10, false, 0, 0, true, true, 100, SPI.SPI_module.SPI1));
                }
                else
                {
                    throw new Exception("Unknown System Type!");
                }



I don’t see a block for


else if (FEZ.FEZ_System.GetSystemType() == FEZ_Type.Cobra)
                {
                    _spi = new SPI(new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.UEXT??, false, 0, 0, true, true, 100, SPI.SPI_module.SPI?));
                }

the UEXT port on the cobra doesn’t have a number on it, and I’m not sure on the spi #.

Looked at the schematic for the cobra, looks like perhaps the spi should be spi2? but seems like no matter what I put in for spi# I get an exception thrown.


#2

Should be like this for Cobra:

else if (FEZ.FEZ_System.GetSystemType() == FEZ_Type.Cobra)
{
  _spi = new SPI(new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.UEXT10, false, 0, 0, true, true, 100, SPI.SPI_module.SPI2));
}

You can always check the pinout from the brochure for each device.

Here is the link to Cobra’s:
http://www.tinyclr.com/downloads/Cobra/Broch_FEZ_Cobra.pdf


#3

You probably want to use 200 instead of 100.

_spi = new SPI(new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.UEXT10, false, 0, 0, true, true, 200, SPI.SPI_module.SPI2));


#4

These are the responses I love seeing from “FEZ Masters”…thanks for the help guys