View Single Post
  #1   Spotlight this post!  
Unread 13-04-2015, 22:39
ArzaanK ArzaanK is offline
Registered User
FRC #1325 (Inverse Paradox)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Mississauga, Ontario, Canada
Posts: 40
ArzaanK is an unknown quantity at this point
Programming SPI Gyro

Hello Chief Delphi,
Our team recently ordered new gyros. We decided to go with the EVAL-ADXRS453Z boards. (http://www.analog.com/en/products/me...duct-overview).

The gyroscopes run on the SPI bus, and do not use an analog input like the KOP gyros. We have never programmed using SPI before, and we were hoping we could get some help. We have looked through the WPILib class documentation, and searched for examples, but we are having a hard time finding any. Also, it seems like there are no built in SPI examples this year in Eclipse.

We have written some base initialization code such as,
Code:
        SPI spiGyro = new SPI(Port.kOnboardCS0) ;
    	spiGyro.setClockRate(4000000);
    	spiGyro.setClockActiveHigh();
    	spiGyro.setChipSelectActiveLow();
    	spiGyro.setMSBFirst();
However, we do not know where to go from here. From the class documentation, it seems like we could have to use a combination of the read, write and transaction methods in order to receive data from the sensor.

If any of you have used SPI in the past, have example code we could look at, or just help us out, that would be greatly appreciated.
__________________
Arzaan Khairulla
Programmer/Driver
2013 Greater Toronto Regional East Winners with 1114 and 2056
2013 Galileo Division
Reply With Quote