I am currently planning a laser frequency offset lock in the MHz regime, for which I would like to use the Stabilizer, building on top of the dual-iir firmware.

The STM32H743 has multiple timers integrated, but its functionality is not that straight forward to understand. So far I only have a very rough sketch on how the microcontroller could be used to measure a laser beat frequency.

On the High-resolution timer a DMA can be triggered by an external event to read out the clock. Using the beat signal as an external event for the DMA clock readout, the period of the beat could be captured.

The same could be done with the advanced control timers and general purpose timers. Alternatively, here an external event could be used to count the clock (inverting the measurement principle). The clock count could be captured with DMA at timed intervals, recording the cycles of the beat signal.

This is only a sketch and since the microcontroller is quite complex, anything I wrote could be wrong.

The beat signal would have to be fed into the microcontroller. For the HRTimer pins PB7 and PG11 could be used, which lead to the J3 EEM connector and support HRTIM_EEVx which is needed for hrtim_evtx triggers. The list of the other timers is larger, I haven't looked at the possible pinouts yet.

I'm happy about any comments on this idea or hints on how to realize this. Or alternative ideas, which are easier to implement.

9 days later

Interesting - please keep us posted, I want something similar on Kirdy to stabilize my fiber lasers 🙂
@linuswck

Yes. HRTimer is a good choice to do this. From what I see from the datasheet, it has 2x maximum frequency comparing with general purpose timer although probably general purpose timer can also do the same job. Given that all 32 bit counter (TIM2 & TIM5) are used already, I would also suggest using the HRTimer + DMA + External Event Trigger to do the frequency counting as well.

On Kirdy's STM32f4x does not have HRTimer and it has much slower clock frequency than stabilizer's STM32H7x.

a month later

I made a small test setup with a Nucleo-H753 (was easier to get than the stabilizers H743 and is or is close to a drop in replacement).

Here is the setup:

  • TIM8 records the beat. I want to target a beat between 1-2 GHz, using an external programmable 1-32 divider, this can be reduced to <70 MHz. The frequency was recorded using external clock mode 2 and triggering the input capture through ITR3. The external clock has a prescaler of 2
  • ITR3 is connected to TIM5. TIM5 is also running in external clock mode 2, with a counter period of 1000, giving an update event on overflow, which triggers the TIM8 input capture. This way there is an easy and fast way to change the frequency lock target by changing the frequency input of TIM5, since the beat frequency count is relative to the TIM5 overflow period.
    The input capture is read out with an interrupt. Left to do is to implement this with DMA, although this might not be necessary at the below mentioned sampling rates of around 10 kHz.

In my test I created a beat signal (with a signal generator) with up to 120 MHz and used a 10-20 MHz signal on TIM5 (-> input capture with 10-20 kHz). At 50 MHz the beat signal count is around 1250. 50 MHz/1250 = 40 kHz resolution. With the extrenal divider the capture range is 120 MHz * 32 = 3.8 GHz . The sampling rate at around 10 kHz is lower than what I would like it to be, but this is a direct trade off with the frequency resolution. It would be necessary to increase the input frequency of TIM8. But the maximum frequency with external clock mode 2 is limited at 1/4prescalertimer clock frequency (in this case I was limited at 120 MHz). I expect external clock mode 1 to be faster, but this is incompatible with triggering TIM8 input capture externaly. Moving to HRTim would also increase the frequency limit, but I couldnt see how/if its possible to read out the clock count. HRTim seems to be more focused on signal output.

Unless someone has an idea on how to improve this setup, I'd now move to implement this in the stabilizer. Does someone have suggestions where to get started in the dual-iir firmware? First I'd have to identify pins and timers that are available.

    Philipp TIM8 records the beat. I want to target a beat between 1-2 GHz, using an external programmable 1-32 divider, this can be reduced to <70 MHz.

    Instead of a divider, have you considered using a high-speed flip-flop as a 1-bit ADC to sample the heterodyne signal in a high-order Nyquist zone?
    Then the frequency changes in the heterodyne signal are no longer divided and you can potentially get more resolution this way.

      3 months later

      sb10q
      Interesting approach.

      I now finally have a setup+firmware that gives me useable signals. Converting a -40 dBm beat signal into LVCMOS, took some time, but with an AD9513 it works. I will now make some tests on how fast I can jump my lasers.

      2 months later