Other Parts Discussed in Thread: TDC7200
Hello,
I am just a few month involved in programming and I am dealing with water flow metering for now.
I have successfully tested TDC1000-7200 evm with my sensors and from program I was able to configure it.
Now I have using same tdc1000/7200 evm PCB, but I have connected it with my controller directly. I am able to configure tdc7200, and my communication via SPI is working, but for some reason, TDC1000 ofter receiving TRIGGER signal and generating START is not sending Tx signal for sensors. For example if I have adjusted to send 4 Tx signals, then I do not see on oscilloscope Tx rectangle signals.
Initialisation sequence is the next:
void init(PipeParams& params) { s_pipe_params = params; spi_init(); platform::sleepMillis(1000); tdc1000::init(s_spi, TDC1000_CS, TDC1000_ENABLE_PIN); platform::sleepMillis(1000); tdc7200::init(s_spi, TDC7200_CS, TDC7200_INT_MCU, TDC7200_ENABLE_PIN); platform::sleepMillis(1000); }
So I see that 4 start signals (adjusted 4 averaging cycles) are present, but during START signal there is no Tx at all.
I have attached example of my TDC1000 setup configuration, is there any mistake with it? it is C++.
Any help is appreciated.
tdc1000::reg::CONFIG_0 conf0; conf0.num_tx = 0x04; //4 pulses in a burst conf0.tx_freq_div = 0x00; //frequency devide by 2 tdc1000::reg::CONFIG_1 conf1; conf1.num_rx = 0x02; // number of expected pulses to generate stop, 2 stop pulses conf1.num_avg = 0x02; // 4 measurement cycles to average in stopwatch/MCU tdc1000::reg::CONFIG_2 conf2; conf2.tof_meas_mode = 0x02; //Mode 2 for ToF measurement (flow metering) conf2.ch_sel = 0x00; conf2.ext_chsel = 0x00; //EXT_CHSEL bit must be 0 for automatic channel swap to work conf2.ch_swp = 0x01; // enable automatic channel swap (needed for flow metering) conf2.damping = 0x01; //damping can reduce the ringing of the transducer //for very short TOF measurements conf2.meas_mode = 0x01; // AFE measurement type (flow-mode) conf2.vcom_sel = 0x00; //voltage reference control internal tdc1000::reg::CONFIG_3 conf3; conf3.echo_qual_thld = 0x02; //DAC threshold level with respect to VCOM, -75mV conf3.blanking = 0x00; conf3.temp_clk_div = 0x00; conf3.temp_rtd_sel = 0x00; conf3.temp_mode = 0x00; tdc1000::reg::CONFIG_4 conf4; conf4.tx_ph_shift_pos = 0x1F; //TX 180° pulse shift position, ranging from 0 to 31, 31 setted conf4.trig_edge_polarity = 0x00; //Trigger edge polarity, Rising edge (default) conf4.receive_mode = 0x00; // Receive echo mode, single echo (each back gives stop) uint32_t timing_reg = 30; tdc1000::reg::TOF_1 tof1; //see page 28 of TDC1000 manual for TOF_1 and TOF_0 register description tof1.timing_reg_h = (timing_reg >> 8) & 0b11; tof1.lna_fb = 0x00; // LNA feedback mode, capacitive feedback tof1.lna_ctrl = 0x00; //LNA control, Active tof1.pga_ctrl = 0x0; // PGA control, Active tof1.pga_gain = 0x05; // PGA gain, 15dB tdc1000::reg::TOF_0 tof0; tof0.timing_reg_l = timing_reg & 0xFF; tdc1000::reg::ERROR_FLAGS err; //registers only for read, writing 1 to fields will reset err flag err.err_sig_high = 0x00; //received echo amplitude exceeds the largest echo qualification threshold, // write 1 will reset all err flags and ERRB pin willgo to high err.err_no_sig = 0x00; //No signals were received and timeout occurred err.err_no_sig = 0x00; //number of received and qualified zero-crossings was less than the expected in NUM_RX field and a timeout occurred
tdc1000::reg::TIMEOUT timeout; timeout.tof_timeout_ctrl = 0x01; //Echo listening window timeout, 256xT0 set timeout.echo_timeout = 0x00; //Echo receive timeout control, enabled timeout.short_tof_blank_period = 0x03; //Short time-of-flight blanking period, 64xT0 timeout.force_short_tof = 0x00; //Short time-of-flight control, disabled tdc1000::reg::CLOCK_RATE clokRate; clokRate.autozero_period = 0x00; // Receiver auto-zero period, 128 × T0 clokRate.clockin_div = 0x00l; // CLKIN divider to generate T0, devide by 1