I trying to program the ADF4001 in order to make a PLL with an N counter and R counter of 1, but I have no output on the CP pin. I am unsure if it's the way I am programming the chip or the layout I am using.
Below is both my code and my layout.
void spi_send24(uint32_t data) {
SPI.transfer((data >> 16) & 0xFF);
SPI.transfer((data >> 8) & 0xFF);
SPI.transfer(data & 0xFF);
}
void ADF4001_send(uint32_t data){
SPI.begin();
SPI.beginTransaction(SPISettings(1e6, MSBFIRST, SPI_MODE0));
digitalWrite(LE_PIN, LOW);
spi_send24(data);
SPI.endTransaction();
delayMicroseconds(1);
digitalWrite(LE_PIN, HIGH);
delayMicroseconds(1);
digitalWrite(LE_PIN, LOW);
}
void setup() {
uint Prescailer = 16;
uint Counter_max = 100;
uint Phase = 180;
pinMode(CE_PIN, OUTPUT);
pinMode(LE_PIN, OUTPUT);
uint32_t latches[] = {
// Latch 0: Reference Counter Latch
(0b00 << 22) | // Control bits: 0b00
(0b00000000000001 << 8) | // Reference counter: 0b00000000000001
(0b00 << 6) | // Antibacklash width: 0b00
(0b00 << 4) | // Test mode: 0b00
(1 << 3), // Lock Detect Precision: 0b1
// Last 3 bits don't matter
// Latch 1: N Counter Latch
(0b01 << 22) | // Control bits: 0b01
(0b000000 << 16) | // Bits 21–16: don't care
(0b0000000000001 << 3) | // 13-bit N counter: 0b0000000000001
(0 << 2), // CP gain: 0b0
// Last 2 bits don't matter
// Latch 2: Function Latch
(0b10 << 22) | // Control bits: 0b10
(0 << 21) | // Counter reset: 0b0
(0 << 20) | // Power-down 1: 0b0
(0b111 << 17) | // MUXOUT control: 0b111
(0 << 16) | // Phase detector polarity: 0b0
(0 << 15) | // CP three-state: 0b0
(0 << 14) | // Fast lock enable: 0b0
(0 << 13) | // Fast lock mode: 0b0
(0b0000 << 9) | // Timer Counter Control: 0b0000
(0b011 << 6) | // Current setting 1: 0b011
(0b011 << 3) | // Current setting 2: 0b011
(0 << 2), // Power-down 2: 0b0
// Last 2 bits don't matter
// Latch 3: Function Latch (possibly for secondary configuration)
(0b11 << 22) | // Control bits: 0b11
(0 << 21) | // Counter reset: 0b0
(0 << 20) | // Power-down 1: 0b0
(0b111 << 17) | // MUXOUT control: 0b111
(0 << 16) | // Phase detector polarity: 0b0
(0 << 15) | // CP three-state: 0b0
(0 << 14) | // Fast lock enable: 0b0
(0 << 13) | // Fast lock mode: 0b0
(0b0000 << 9) | // Timer Counter Control: 0b0000
(0b011 << 6) | // Current setting 1: 0b011
(0b011 << 3) | // Current setting 2: 0b011
(0 << 2) // Power-down 2: 0b0
// Last 2 bits don't matter
};
digitalWrite(CE_PIN, HIGH);
for (int i = 0; i < 4; i++) {
ADF4001_send(latches[i]);
}
digitalWrite(CE_PIN, HIGH);
pwmConfig = PWMphase_config(Prescailer, Counter_max, Phase);
}
void loop() {
phaseChange_apply();
}
Edit: The bits have been changed to MSB first and still nothing
Edit 2: rearranged decoupling capacitors in schematic

