Hi All,
I got the LDC1000 EVM and was working away happily with the GUI and I love it so far. I hope to eventually use the sensor in a wind turbine orientation sensing capacity so I broke the EVM along the perforations (I hooked it all back together and was still working)
I then attempted to essentially replace the MSP430/USB side with my Tiva Connected Launchpad (EK-TM4C1294XL) and thus far I have had no success and I cannot figure out why.
Setup Summary:
LDC TIVA
Vcc 5V
Vio 3.3v
And all of the spi signals are hooked up correctly. And I think the SPI port is configured correctly. (I.e. I've used SPI for other applications no problem).
I hooked the external clock up to a 8MHz signal generator.
Initially I just want to get this set up working without getting inductance or Rp readings .. i.e. read and write to the config regs.
The issue is that I do not get any data back form the LDC1000.
At this stage I am just trying to simply read the LDC's Device ID reg which the data sheet says should have a default value of 0x80 Hex.
So I set up the SPI port and place the following in the SPI port as follows:
/* Clock Gate enable for all of the gpio ports needed */ CLOCK_GATE_GPIO |=CLOCK_GATE_PORTS_D_E_H_M; /* Clock Gate enable for the the SPI2 Module */ CLOCK_GATE_SPI |= CLOCK_GATE_SSI2; /* GPIO AFSEL For GPIOD 0,1,3*/ GPIO_PORTD_AHB_AFSEL_R |= (GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_3 ); /* Set up MUXs for SPI operation*/ GPIO_PORTD_AHB_PCTL_R |= ((0x0F<<0) | (0x0F<<4) | (0x0F<<12)); /* DEN for a SPI Pins */ GPIO_PORTD_AHB_DEN_R |=(SCLK | MISO | MOSI ); /* Configure the SPI Module for master operations */ SSI2_CR1_R =0; /* Set the SPI Clock to USe the System Clock */ SSI2_CC_R =0; /* Set the Clock Pre-Scaler */ SSI2_CPSR_R = 0x02; // Value taken from CCS /* Set the Serial Clock Rate ... Set Up FreeScale SPI ... Set Up Data Size */ SSI2_CR0_R = 0x307;// Val taken from CCS //was 0x307 /* Enable the SSE bit to enable QSSI */ SSI2_CR1_R =(1u<<1);
I then initially perform a clear on the SPI Rx FiFO and attempt to read the LDC's Device ID Register as follows:
/* Enable LDC chip select */ CSn_DATA &= ~(CSn); // Can see this happening with scope /* Put data in fifo. Set the R/W bit to 1 ..i.e. READ */ SPI_DATA_REG = (0x00 | 0x80); /* wait for the transmission to complete */ while(SPI_STATUS & SPI_BUSY); /* Read the data returned from LDC1000 */ int val = SPI_DATA_REG; /* Disable the chip select */ CSn_DATA |= (CSn);// Can see this happening with scope
The issue is val is always zero no matter what register I try to read from
Am I correct in saying that the correct Tiva SPI port config is as follows:
Master Mode using the System Clock at 8 Bit with both SPO =0 and SPH = 0?
If someone can see something wrong here it would be great , I'm not expert at this stuff but I tend to eventually figure these things out but this has me stumped.
Regards,
Jay Long
Additional Info:
the entities such as "SPI_STATUS" and "CLOCK_GATE_SSI2" etc. above are tried and tested on numerous occasions and are essentially my easy to remember redefinitions of regs in m4c1294ncpdt.h
i.e. #define SPI_STATUS SSI2_SR_R
The Setup uses the launchpads SSI2 port so PD0 = MISO PD1= MOSI PD3= SCLK and I use a random gpio for CS as I prefer that over the Fss approach
SSI2_CR1_R etc is defined in TivaWare/inc/tm4c1294ncpdt.h
IDE = CCS v5