This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Interfacing LDC1000 EWM with Tiva Connected Launchpad

Other Parts Discussed in Thread: EK-TM4C1294XL, TM4C1294NCPDT

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

  • Same situations here, I tried to TM4c123GLX.

    But no reply from LDC1000.

    Any ideas are welcome.

    Thanks in advance.

    Kim Jaewoo

  • Unfortunately, debugging the code and configuration of the MCU is not as easy to do on the forums; I think that addressing the stimuli directly is a more effective route at this time. Have you looked at the SPI waveforms that the MSP430 generates and compared them to the SPI waveforms that you are generating?

    There are two scenarios that I can see - either the format of the SPI transactions are incorrect, and that should be visible on the scope, or the data is not being properly captured by the MCU.   

  • As I can see, you are sending one byte that is the address of the register. Well, you should not expect to see the data of that register in the RX buffer until you send a second byte. The second byte is just a mean to continue clocking the SPI module to receive the data out of the register (see datasheet page 19). The data will start coming to your MCU at the first bit of the second byte. I am not experienced with SPI of Tiva but there should be an easy way to do the following steps:

    1- Disable Receiver before sending the address not to have ZERO data in the RX buffer when the address  is sent.

    2- Send the address.

    3- Enable Receiver.

    4- Be sure that TX buffer is available (you can inser data in it) and send 0xFF.

    5- Wait data transmission to finish.

    6- Read the receiver buffer.

    7- Disable chip select.

    Note: If there is no way to disable the receiver, you just need to ignore the first received byte which is, as you have said, a zero. The next byte is the data of the register.

    I hope this will help.

  • Hi, it never occurred to me to do a dummy read and write to see what the NEXT value was and this is usually required with SPI as its essentially a shift register. Good spot!

    I will try this and update when I have the chance to try this as I am busy  in work at the minute and have not had much time to tinker !

    Thanks for the help !

    Jay