Synchronizing DAC.write_timed() on DAC1 and DAC2
Posted: Sun May 07, 2017 8:31 am
I am trying to get a waveform on one dac channel, and a sync pulse on the second. The two should be synchronized to about 1 microsecond or so. Here's the code:
dac1 = DAC(1)
dac1.write_timed(buf_s,pyb.Timer(6, freq = fr* (l_buf)), mode=DAC.CIRCULAR)
dac2 = DAC(2)
dac2.write_timed(buf_t,pyb.Timer(7, freq = fr* (l_buf)), mode=DAC.CIRCULAR)
The waveform in dac1 precedes that in dac2 by about 25 microseconds. When I execute the code for dac2 before that for dac1, then dac2 waveform comes 25 us ahead of dac1. Tying both to the same timer doesn't help. buf_s and buf_t each contain 1600 values. fr is about 8 kHz.
dac1 = DAC(1)
dac1.write_timed(buf_s,pyb.Timer(6, freq = fr* (l_buf)), mode=DAC.CIRCULAR)
dac2 = DAC(2)
dac2.write_timed(buf_t,pyb.Timer(7, freq = fr* (l_buf)), mode=DAC.CIRCULAR)
The waveform in dac1 precedes that in dac2 by about 25 microseconds. When I execute the code for dac2 before that for dac1, then dac2 waveform comes 25 us ahead of dac1. Tying both to the same timer doesn't help. buf_s and buf_t each contain 1600 values. fr is about 8 kHz.