AnsweredAssumed Answered

HMC832 SPI Programming Problem

Question asked by muhammad on Dec 26, 2017
Latest reply on Jan 12, 2018 by dyoung1

I am using HMC832lp6ge as a variable frequency source.

I only have the board and am trying to program it through SPI through Arduino.

As soon as the reg_en is activated to write registers, the default output freq of about 2200MHz disappears.

The SPI protocol sends the data to the PLL and then afterward, the reg_en is de-activated.

The output disappears as for some time and then returns to its default position.

Arduino is transmitting the data correctly as could be seen on Serial Monitor but the HMC832 is not being programmed correctly.

 

Please help.

 

 

Attached below is the Arduino code:

#include <SPI.h> 
const int chipSelectPin = 10;
const int N= 19;
int PLL_Reg_Values [N] = {0x20, 0x20, 0x2, 0x1, 0x90, 0xF98, 0x4B38, 0x4B38, 0x0, 0xF4A, 0x14D, 0xC1BEFF, 0x3FFEFD, 0x2046, 0xF8061, 0x0, 0x81, 0x2A, 0x666666};
int PLL_Reg_Addr [N] = {0x0, 0x0, 0x1, 0x2, 0x5, 0x5, 0x5, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0xB,  0xC,  0xF, 0x3, 0x4};
int i=0, flag=1;
SPISettings mySettings(200000, MSBFIRST, SPI_MODE0);
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(chipSelectPin, OUTPUT);
  pinMode(chipSelectPin, HIGH);  
  SPI.begin();
  delay(5000);
  Serial.println("Initialized");
}
void loop() {
  // put your main code here, to run repeatedly:
   delay(10000);
  while (i<N && flag == 1){
    writeRegister(PLL_Reg_Addr[i], PLL_Reg_Values[i]);
        Serial.println("Hello");
              Serial.println(PLL_Reg_Addr[i]);
                    Serial.println(PLL_Reg_Values[i]);
    i = i+1;
  }
}
void writeRegister(int thisRegister, int thisValue) {
  thisRegister = thisRegister<<3;
  thisValue = thisValue<<7;
  int data = thisRegister|thisValue;
  int B23_B16 = (data & 0xFF0000)>>16;
  int B15_B8 = (data & 0xFF00)>>8;
  int B7_B0 = (data & 0xFF);  
  
  // take the chip select low to select the device:
  digitalWrite(chipSelectPin, LOW);
  SPI.beginTransaction(mySettings);
  SPI.transfer(B23_B16);
  SPI.transfer(B15_B8);
  SPI.transfer(B7_B0);
  digitalWrite(chipSelectPin, HIGH);
  SPI.endTransaction();
  delay(30);  
  }

Outcomes