Other Parts Discussed in Thread: TDC7200, TDC1000
Hi!
I am trying to get the RTD2 measurement code to work but I can't get any correct results. RTD1 is working as expected. (using PT1000).
My algorithm:
During tdc_trigger_measure() :
if (measure_RTD1) { // RTD1
TI_TDC7200_SPIByteWriteReg(0x08u, 0); // reset mask
TI_TDC7200_SPIByteWriteReg(0x09u, 0);
}else{ // RTD2
uint16_t stopMaskClk = mask_period/125; //using 8mhz clock
printf("time: %f, mask:%d\n", mask_period, stopMaskClk);
TI_TDC7200_SPIByteWriteReg(0x08u, stopMaskClk >> 8);
TI_TDC7200_SPIByteWriteReg(0x09u, stopMaskClk);
}
Then to calculate RTD1 and 2 in tdc7200_calc() :
float rtd;
if (measure_RTD1) tref=start2stop[0]; // always use RTD1 tref
// ---- RTDx measurement ----
if ((start2stop[2]-start2stop[1]) < 20000){ // If (stop2 to stop3 (ns) < 20000), use (stop2 to stop4 (ns)). Else: use (stop2 to stop3 (ns)) in RTD1 calculation.
rtd = 0.259*((tref*1000.0/(start2stop[3]-start2stop[1]))-1000.0); // 0.259 is PT1000 conversion factor
}
else{
rtd = 0.259*((tref*1000.0/(start2stop[2]-start2stop[1]))-1000.0);
}
if (measure_RTD1){
rtd1=rtd;
mask_period = start2stop[2]; // save masking period for first 3 stops
measure_RTD1=0;
}
else {
rtd2=rtd;
measure_RTD1=1;
}
printf("RTD1:%.6f, RTD2:%.6f\n ",rtd1,rtd2); // output rtd temp. values
Output:
RTD1:21.936523, RTD2:-inf
The stopMaskClk gets to approx. 2990.
I am using the TDC1000-TDC7200EVM and the demo code provided by you.
Thanks in advance!
Best regards,
Thibault