Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

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

$
0
0

Part Number:TDC7200EVM

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!

Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>