Other Parts Discussed in Thread: HALCOGEN
Hello,
I was trying to return the output of the sensor in a printf statement without success. What was the things that I miss out or did not do correctly? I believe one of the things I need to do is to initialize the sensor similar to http://www.elecfreaks.com/wiki/index.php?title=Triple_Axis_Gyro_-_L3G4200D
I list out the things I have done in 3 parts, first is the physical connection for the hardware, second is the code for my sys_main.c, lastly is my Halcogen settings.
Thanks in advance.
Regards,
Yuanfa
====================================================================================
The Gyroscope I am using is L3G4200D>> https://www.sparkfun.com/products/10612
The physical connection I made from Launchpad to sensor breakout board was,
3.3v to VCC
GND to GND
SPI2SOMI to SDA
SPI2CS0 to CS
SPI2CLK to SCL
SPI2SIMO to SDO
============================================================
#include "sys_common.h"
#include "stdio.h"
#include "spi.h"
void main(void)
{
spiDAT1_t dataconfig1_t;
dataconfig1_t.CS_HOLD = FALSE;
dataconfig1_t.WDEL = TRUE;
dataconfig1_t.DFSEL = SPI_FMT_0;
dataconfig1_t.CSNR = 0xFE;
uint16 RX_Data_Master[16] = { 0 };
_enable_IRQ();
spiInit();
while(1){
spiGetData ( spiREG2, &dataconfig1_t, 16, RX_Data_Master);
printf("Value at p1: %f\n", *RX_Data_Master);
};
}
=========================================================
For Halcogen I enabled SP11 driver, enabled SP12 driver,enabled SP13 driver.
Under VIm Channel 0-31, Enable SPI2 Level 0 and Level 1 channels.
SPI1 TAB
- SPI1 Global SubTAB
- Uncheck Master Mode
- Uncheck Internal Clock
SPI2 TAB
- SPI2 Global SubTAB
- check Master Mode
- check Internal Clock
- SPI2 Port SubTAB
- check DIR for SOMI
SPI3 TAB
- SPI3 Global SubTAB
- Uncheck Master Mode
- Uncheck Internal Clock