Arduino library for the ADF4110 low phase noise PLL from Analog Devices.
This library can be configured to use the builtin Arduino SPI module or a bit-bashed interface that allows the use of any Input Output (I/O) pin.
In your Arduino Sketch, you can use the bit-bashed serial configuration like this:
#undef __USE_ARDUINO_SPI__ // bit bashed configuration
#include <ADF4110.h>
ADF4110 pll(0); // bit bashed configuration
static const uint8_t P = 8;
static const uint16_t B = 5;
static const uint8_t A = 0;
static const uint16_t R = 10;
void setup(){
pll.begin(10, 11, 13); // bit bashed configuration
pll.initialise(P, B, A, R);
}
void loop() {
}
Alternatively you can use the builtin Arduino SPI library like this;
#include <SPI.h>
#define __USE_ARDUINO_SPI__ // use builtin Arduino SPI module
#include <ADF4110.h>
ADF4110 pll(10); // define latch pin D10 here
static const uint8_t P = 8;
static const uint16_t B = 5;
static const uint8_t A = 0;
static const uint16_t R = 10;
void setup(){
pll.begin(); // assumes MOSI = 11, SCK = 13, note LED_BUILTIN is often pin 13
pll.initialise(P, B, A, R);
}
void loop() {
}
Note that I've not tested the builtin Arduino SPI configuration extensively, YMMV.
ADF4110::begin(int lePin, int dataPin, int clkPin)
This function initialises the hardware interface between the Arduino and ADF4110. See examples in getting started on how to use this function.
- lePin: Latch Pin
- dataPin: Data Pin
- clkPin: Clock Pin
ADF4110::initialise(uint8_t P, uint16_t B, uint8_t A, uint16_t R, uint8_t pol = 1, uint8_t mux = 1)
This function initialises the ADF4110 after initial power-up.
- P: 8, 16, 32, or 64
- B: B counter; accepts values 3 - 8191 (13-bits), values 0, 1, or 2 are not valid
- A: A counter; accepts values 0 - 63 (6-bits)
- R: Reference divider; accepts values 1-16383 inclusive (14-bits)
- pol: Charge Pump polarity; accepts values 0-1 (1-bit), neg = 0, pos = 1 (default).
- mux: Mux Output; accepts values 0-7 (3-bit), digital lock detect active high (default)
The PLL frequency can be calculated by f = [(P * B) + A] / R * vco_ref
, where vco_ref is in Hertz.
The initialise() function sets the Phase Detector Polarity (default pos) and the internal Mux output, refer to ADF4110 datasheets for specific vaules, the mux default is "Digital Lock Detect (active high)" which can be used to turn ON a separate lock LED.
ADF4110::update(uint8_t P, uint16_t B, uint8_t A, uint16_t R)
This function like the initialise, loads the PLL registers with frequency data.
- P: 8, 16, 32, or 64
- B: B counter; accepts values 3 - 8191 (13-bits), cannot use values 0, 1, or 2.
- A: A counter; accepts values 0 - 63 (6-bits)
- R: Reference divider; accepts values 1-16383 inclusive (14-bits)
Note that this function does not change the phase detector output or mux, use the initialise funciton for this purpose.
ADF4110::print_freq(void)
This utility function will return the frequency of the PLL in Hz as a uint32_t. It can be used to confirm that the values passed using the initialise or update functions are correct using the serial console.
ADF4110::powerdown(void)
This function will power down the PLL and put the Charge Pump output into a HiZ state. This allows a pot to be connected to the VCO and allow it to free-run when the PLL does not have a valid reference. Note that separate hardware is required to detect the presense of an external reference, it is not possible to do through the SPI interface.
Once the PLL is in powerdown the only way to wake it up is to call the initialise() function again.
Install like any other Arduino library, either copy localy into your project or install in your Arduino Library project. If using platformIO you can simply add the github URL to your lib_deps in your platformio.ini file.
- ADF4110 Product Page Analog Devices
- VK5ZM Blog VK5ZM's Radio and Hobbies