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.

TDC7200EVM: Reading TDC7200 TIME and CLOCK_COUNT (24 bits) Registers

Part Number: TDC7200EVM
Other Parts Discussed in Thread: TDC7200

Hello everyone,

I’m working with EVM TDC7200 board with TM4C1294XL dev. board. The TDC7200 chip communicate via SPI, so I’m using the ROM_SSI to talk to it. At the moment I’m simulating the Start and Stop signal using a different MCU, sending 2 pulses with a 240uS between each start and stop, planning to use use mode2 of the TDC.

After I send a measurement command to the TDC, I'm able to read 0x19 from the INT_STATUS registers (02h), which means the measurement is completed and I didn’t overflow the Clock or the Coarse counter “based of 8.6.4 in the data sheet”

So far so good, my problem is when I try to read the TIME and CLOCK_COUNT registers. They are 24bits registers, the way I’m doing it now is by sending the read command with an address “16 bits” then I send an extra “16 bits” to I can read the remaining 8 bits, but I’m getting back “0x2” which is stay the same regardless of the time between the two pulses "except when the time between the pluses is above 2mS" that makes me think there is something wrong with the way I'm reading the registers!

Not sure if the problem is the way I'm reading the registers or something in the TDC settings.

I would appreciate it if take a look at the code, let me know where is my mistake
void IO_SSI_setup(void){
	
	ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
	ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
	ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
	
        ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ); 	
	ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);  	
	
	ROM_GPIOPinConfigure(GPIO_PD0_SSI2XDAT1);			// MISO	PD0
	ROM_GPIOPinConfigure(GPIO_PD1_SSI2XDAT0);			// MOSI	PD1
	ROM_GPIOPinConfigure(GPIO_PD2_SSI2FSS);				// CS	PD2
	ROM_GPIOPinConfigure(GPIO_PD3_SSI2CLK);				// CLK	PD3
	ROM_GPIOPinTypeSSI(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
	
	ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_SSI2);
	ROM_SSIClockSourceSet(SSIBASENum, SSI_CLOCK_SYSTEM);
	ROM_SSIConfigSetExpClk(SSIBASENum, g_ui32SysClock, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 5000000, 16);
	ROM_SSIEnable(SSIBASENum);
	
	ROM_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1 | GPIO_PIN_0);
	
	ROM_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_7); // ENABLE Pin set as output
	
}

uint32_t TDC7200ReadReg24bits (uint8_t addr){
	
	uint32_t u32RxBuff1 = 0x0;
	uint32_t u32RxBuff2 = 0x0;
	uint32_t u32RxBuff3 = 0x0;
	
	uint16_t  u16TxBuff =  (addr <<8) & 0xff00;	//Auto-inc[1bit], Read/Write [1bit], Address [6bits], data [8bits]

	while(ROM_SSIDataGetNonBlocking(SSIBASENum, &u32RxBuff3 )){	// to clear the FIFO
    }
	while(ROM_SSIBusy(SSIBASENum)){				
	}	
	// try #1		output : 0 2 0
	ROM_SSIDataPut(SSIBASENum, u16TxBuff);		// send the 1st 16 bits 
	ROM_SSIDataGet(SSIBASENum, &u32RxBuff1);	// read 
	
	ROM_SSIDataPut(SSIBASENum, 0x00);			// send the 2nd 16 bits
	ROM_SSIDataGet(SSIBASENum, &u32RxBuff2);	// read 

	// try 2		output : 0 2 2
/*	ROM_SSIDataPut(SSIBASENum, u16TxBuff);		// send the 1st 16 bits 
	ROM_SSIDataGet(SSIBASENum, &u32RxBuff1);	// read junk!?
	
	ROM_SSIDataPut(SSIBASENum, 0x00);			// send the 2nd 16 bits
	ROM_SSIDataGet(SSIBASENum, &u32RxBuff2);	// read data
	
	ROM_SSIDataPut(SSIBASENum, 0x00);			// send the 2nd 16 bits
	ROM_SSIDataGet(SSIBASENum, &u32RxBuff3);	// read data 
*/	
	UARTprintf("[%x]:	%x %x %x\n",u16TxBuff, u32RxBuff1, u32RxBuff2, u32RxBuff3);
	
}

here is registers read out after setup:

CONFIG1_REG         (0x00)
CONFIG2_REG         (0x41)
INTRPT_STATUS_REG    (0x1F)
INTRPT_MASK_REG        (0x07)
COARSE_COUNTER_OVH_REG (0xFF)
COARSE_COUNTER_OVL_REG (0xFF)
CLOCK_COUNTER_OVH_REG  (0xFF)
CLOCK_COUNTER_OVL_REG  (0xFF)
CLOCK_COUNTER_STOP_MASKH_REG (0x00)
CLOCK_COUNTER_STOP_MASKL_REG (0x00)

Thanks!

I would appreciate it if take a look at the code, let me know where is my mistake!
Thanks!
  • Hello,

    I will check on this and revert back soon.
  • I added a delay after the "SSIDataGetNonBlocking" and that fix some of my problems. Now I'm able to read some values, but removing the 'UARTprintf' alters the received values.

    For instance, if I used the 'UARTprintf' after I read the registers I get some value, but when I remove the 'UARTprintf' the value will differ!
    Is that because using 'UARTprint' somehow is delaying the function and gives the SSI controller more time to read ?!

    One more TDC7200 question, how long should I wait between two measurements. Can I measure continuously ?

    Thanks!
  • Bl ck,

    We cannot help with the coding of the device, I can check and let you know if there is any issue with the register readings/setup.
    Typically post the last reading the INTB pin toggle after a few clock cycles and we should wait for a few clock cycles before starting a new measurement cycle.
    As a backup please check the START & STOP pins in oscilloscope and see you can get the required number of STOP signals and if your code is able the get the data for the same.