mborgerson
Well-known member
I'm working on a project where I need to generate three output pulse trains at about 1millisecond intervals with 450usecond pulse width and variable rising edge timing. The pulses will be used to simulate the outputs of three ELINT receivers intercepting radar pulses at three different locations. The Time-Difference-Of-Arrival will be used to calculate the location of the radar transmitter. The rising edges of the pulses need to have time differences of a fraction of a microsecond (Radar waves move at about 300 meters/microsecond).
Generating the three pulse chains seems to be a natural fit for the T4.1GPT2 timer. At 24MHz clock, I can get output resolution of 1/24th microsecond. Using the hardware output from the compare registers will avoid output jitter due to interrupt service latency issues. Using the same timer for all three output pulses should guarantee consistent TDOA differences as all pulses will be generated by the same hardware timer.
The algorithm will look something like this:
Note that while I want consistent high-resolution timing, there is plenty of time between the rising and falling edges to set up the timer for the next edge.
I think the Teensy Timer Tool will help me get the timer set up and running. What I haven't found yet is some good example code on setting up the output pin mux register and the timer output compare functions. Example code or pointers to examples would be greatly appreciated.
I COULD do all the pulse output stuff as part of the same MatLab code that generates the pulse timing file, and make a MP4 movie as I go. However simulations on a 3GHz 64-bit CPU with 16GB of memory don't really help me understand the challenges facing the designers of the ELINT system in 1970. It should be even more interesting to write the T4.1 code to collect the timing and calculate the radar location. I know that the minicomputers of the 1970s didn't run at 600MHz and have a megabyte of RAM and 128GB of storage. (I know because I was programming minicomputers in the 1970's!)
Generating the three pulse chains seems to be a natural fit for the T4.1GPT2 timer. At 24MHz clock, I can get output resolution of 1/24th microsecond. Using the hardware output from the compare registers will avoid output jitter due to interrupt service latency issues. Using the same timer for all three output pulses should guarantee consistent TDOA differences as all pulses will be generated by the same hardware timer.
The algorithm will look something like this:
Code:
Read data file containing pulse start times: Up to 900 seconds of data consisting of 16 pulses at 1mSec intervals,
followed by ~5 seconds of quiet time while the radar is pointed away from the receivers.
Initialize timer.
Step through the pulse time data, setting the rise time of a pulse as the first one-shot delay.
for channel = 1 to 3
At the expiration of the first one-shot, the output pin is set high.
The IRQ callback function sets the pulse-width delay for 450uSec, and the output compare pin level as low
At the end-of-pulse delay, the output goes low and the IRQ callback fetches the next rising edge time and
programs the channel for a delay that takes the one-shot to that time.
end // of channel 1 to 3
Note that while I want consistent high-resolution timing, there is plenty of time between the rising and falling edges to set up the timer for the next edge.
I think the Teensy Timer Tool will help me get the timer set up and running. What I haven't found yet is some good example code on setting up the output pin mux register and the timer output compare functions. Example code or pointers to examples would be greatly appreciated.
I COULD do all the pulse output stuff as part of the same MatLab code that generates the pulse timing file, and make a MP4 movie as I go. However simulations on a 3GHz 64-bit CPU with 16GB of memory don't really help me understand the challenges facing the designers of the ELINT system in 1970. It should be even more interesting to write the T4.1 code to collect the timing and calculate the radar location. I know that the minicomputers of the 1970s didn't run at 600MHz and have a megabyte of RAM and 128GB of storage. (I know because I was programming minicomputers in the 1970's!)