1
\$\begingroup\$

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();
}

ADF4001 Setup

Edit: The bits have been changed to MSB first and still nothing

Edit 2: rearranged decoupling capacitors in schematic

\$\endgroup\$
2
  • \$\begingroup\$ The function spi_send24() isn't shown. How do you know what it does or if what it does is the correct thing to do? And likely it doesn't. \$\endgroup\$ Commented Jul 31 at 22:18
  • \$\begingroup\$ @Justme Ops, I meant to add that function call into the code, I just changed it, and it is at the top of the block \$\endgroup\$ Commented Aug 1 at 3:04

2 Answers 2

1
\$\begingroup\$

Problem in both schematic and code.

The ADF4001 does not have a power supply connection due to schematic mistake.

The code sends out bits from a variable in some order but then the values in the array are defined in exactly opposite bit order than they should be sent out to the chip.

The chip wants most significant bit of 24-bit value first which means most significant byte is sent first and least significant byte is sent last which is what your send_24() code does.

But for example the register selection bits are the two least significant bits so they should be shifted by 0, but in your table you shift by 22, so all the data is shifted to wrong bit positios.

\$\endgroup\$
10
  • \$\begingroup\$ fixed this part of the code, still nothing \$\endgroup\$ Commented Aug 1 at 13:48
  • \$\begingroup\$ @LukeStirzinger I don't know what you fixed and how so I don't know if it's correct now. I simply noticed an obvious issue. It doesn't mean that it was the only one. \$\endgroup\$ Commented Aug 1 at 14:06
  • \$\begingroup\$ @LukeStirzinger Sorry I didn't see the schematic mistake. It was hard to see due to the way the schematics are drawn, which is why they often aren't drawn like that because it makes the errors hard to see. \$\endgroup\$ Commented Aug 1 at 14:18
  • \$\begingroup\$ Is there a mistake in the schematic? How should I draw my schematics in the future? Also, I am using the ADF4002 in the schematic just because it has the same pin layout as the ADF4001, so for a representation of what I am doing it is functionally the same. @Justme \$\endgroup\$ Commented Aug 1 at 14:24
  • \$\begingroup\$ @LukeS OK, sorry so I need to explain it in more detailed way. The error is that the VCC supply wire should connect to chip supply pins. Now there are capacitors between chip supply pins and the VCC supply wire. So it's wrong, chip has no supply and it does not work at all without power. The way it is drawn looks correct if you just look at it quickly which makes it a poor way of arranging the componets as it masks the error. I can't say opinions how it would be better, as it's a matter of opinion. \$\endgroup\$ Commented Aug 1 at 14:28
0
\$\begingroup\$

Looking at the development board for the ADF4001, The RF and REF inputs need to be AC coupled, and the power supplies need decoupling capacitors as close to the ADF4001 as you can get, so make sure those are in place.

As for programming, the development board has software where you have a menu to set up all programming for the ADF4001, and it will output the hex associated with those settings. The program is called "ADI PLL int-N"

Once I changed the board layout and started using the hex rather than changing specific bits by hand, it works!

Here is the final board layout for testing the ADF4001 using the RP2040:

ADF4001 programming board layout

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.