NXP Phase Frequency Detector

This is a phase frequency detector based using NXP 74aup2g57gm.

Similar projects worth following
This project will be the documentation fors of building a digital phase frequency detector. This will be limited to about 50kHz digital signals. Since I have never directly built a phase locked loop this should be a bit of a learning experience. I'll be documenting these sections in this blog post.

Here's a video of the logic gates working

Here is a video of this guy in action

  • 1 × 74AUP2G57GM NXP Dual Logic Chip
  • 1 × Arduino Uno the main contorller

  • Arduino Uno code for the phase frequency detector

    shane kirkbride06/08/2015 at 17:17 0 comments

    int ledPin = 9;      // LED connected to digital pin 9
    int digitalPin7 =7;
    int digitalPin6 =6;
    int analogPin3 = 3;   // potentiometer connected to analog pin 3
    int analogPin0 = 0;   // potentiometer connected to analog pin 0
    int val3 = 0;         // variable to store the read value
    int val0 = 0;         // variable to store the read value
    float duration0 = 0.1;  // in millis  -- 100, 200, 1000, 2000, 4000 == 10Hz, 5Hz, 1Hz, .5Hz, and .125Hz 
    float duration1 = 0.01;  // in millis  -- 100, 200, 1000, 2000, 4000 == 10Hz, 5Hz, 1Hz, .5Hz, and .125Hz 
    unsigned long lastFlip0=0;
    unsigned long lastFlip1=0;
    int state0 = LOW;
    int state1 = LOW;
    int led = 13;
    void setup()
      pinMode(digitalPin7, OUTPUT);
      pinMode(digitalPin6, OUTPUT);
      digitalWrite(digitalPin7, state0);
      digitalWrite(digitalPin6, state1);
      Serial.begin(9600);          //  setup serial
    void loop()
      val3 = analogRead(analogPin3);    // read the input pin
      val0 = analogRead(analogPin0);    // read the input pin
      unsigned long now = millis();
      //This is XO 0
      if (now - lastFlip0 >= duration0)
        lastFlip0 = now;
        state0 = !state0;
        digitalWrite(digitalPin7, state0);
      //This is XO 1
      if (now - lastFlip1 >= duration1)
        lastFlip1 = now;
        state1 = !state1;
        digitalWrite(digitalPin6, state1);
      if(val0 > val3)
        digitalWrite(led, HIGH);
        duration0 = duration0 - random(1, 10);
        duration1 = duration1 + random(1, 10);
        digitalWrite(led, LOW);
        duration1 = duration1 - random(1, 10);
        duration0 = duration0 + random(1, 10);
        Serial.write("Val3: ");
        Serial.write("Val0: ");
        Serial.write("Time: ");


    shane kirkbride06/02/2015 at 21:41 0 comments

    NXP is hosting a design competition called The Big Idea. I've decided to enter into this competition to go through the process of building a digital phase locked loop. I'm not going to have it be really fast; I will be happy if it works. Since I have never directly built a phase locked loop this should be a bit of a learning experience. The parts of the pll that I will be designing are the phase-frequency detector, the charge-pump, the low pass filter, the voltage controlled oscillator and the frequency divider. I'll be documenting these sections in this blog post.

    Frequency Phase Detector:

    Day 2: the Phase-Frequency Detector

    I've done a logic schematic for the phase-frequency detector for my phase lock loop. This is the part in the phase lock loop that determines what frequency the voltage controlled oscillator is set at. The schematic is an optimized version of two D-Flip Flops and some other logic. If I had the NXP part in the MultiSIM Blue library I would be able to use a single part number for each one of these logic gates.

    Frequency Divider

    Day 3: The Frequency Divider

    One of the blocks in the phase locked loop is the frequency divider. I've designed a divide by 2 frequency divider out of a D-flip flop with feedback. I could use the 74AUP2G57GM in this design if it existed in the MultiSIM Blue library. However it does not. I've asked when they plan to have this part available and I haven't received a reply. I'll post the theory on my own personal blog when I'm done.

    I have all the hardware I need to complete this project. I'll be uploading a few pictures and videos in the next few days of this working. I've decided to close the loop with the Arduino Uno. The Arduino will receive the output of the phase-frequency detector and change the input. I needed to do this for a few reasons. The time required to assemble and debug the entire phase-locked loop would have taken longer than I would of had. Second the Arduino adds a really interesting component to this project. Since the phase-frequency detector is a very robust you can do things like lock two XBees together and double your sensor bandwidth for 3D imaging. Or you can use it to drive two wheels forward and keep them moving at the same speed with two electric motors.

    Also the demo kit that NXP sent is awesome for a lot of reasons. It allows easy prototyping of typically difficult to work with surface mount components. The kit shows how small the SMT components are. The additional resistors and capacitors for proper functionality are also included in the dev kit. I hope NXP would consider selling it would be great to use in electrical designs that would eventually be miniaturized.

    First let's take a look at a single demo board. There are a few observations about this board I'll make before I move onto the design.


    Figure 1: Single Demo Board (Back)

    As you can see in this demo board there are some added resistors and capacitors. This will help to limit the current through the device. In my original schematic I neglected these but it is clear they are needed. Second I wanted to point out the dime to the left of the board in Figure 1. If you compare Franklin D. Roosevelt's ear to the size of the 74AUP2G57GM his ear is slightly larger! This is a very small chip; ideal for the Internet of Things and wearables.

    So I was sent 5 of these boards. I can imagine they are ESD sensitive. I found some ESD Foam and used that to lay out all the boards. The boards for the phase frequency detector are shown below as well as their alignment as it shows in the schematic.


    Figure 2a: The initial layout of the boards.


    Figure 2b: The schematic we are wiring to.

    The next step to wire these boards as they are represented in the schematic. This was a multi-day process. I went through one board at a time and wired them per the schematic. Some of this progress is shown in Figure 3 below.


    Figure 3: Some initial boards wired completed. Wiring and soldering and wiring and soldering...

    So after spending time wiring and soldering and then soldering and wiring even more the entire phase...

    Read more »

View all 2 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates