AnsweredAssumed Answered

no-OS driver, fmcomms1/Common/test.c

Question asked by zhipeng on Jul 28, 2014
Latest reply on Jul 30, 2014 by AdrianC

The code in test.c prints out a frequency different from the dacSamplingRate set in main.c. If I set dacSamplingRate to 122880000, the frequency printed out could be 122.875MHz sometimes or 122.882MHz some other times. What is the reason behind the change of the printed out frequency from run to run?


Thanks!

 


https://github.com/analogdevicesinc/no-OS/blob/master/fmcomms1/Common/test.c

 

      if (Xil_In32(baddr + 0x405c) == 0x0)
    {
        xil_printf("dac_setup: status NOT set!!\n\r");
    }
    rdata = Xil_In32(baddr + 0x4054);
    dac_clk = (float) rdata;
    rdata = Xil_In32(baddr + 0x4058);
      dac_clk = dac_clk * (float) rdata * (float) 100.0;
    dac_clk = dac_clk / (float) 65536.0;
    dac_clk_int = (u32) dac_clk;
    dac_clk_frac = (dac_clk - (float) dac_clk_int) * 1000;
    xil_printf("dac_setup: dac_clock(%d.%3dMHz)\n\r", dac_clk_int, dac_clk_frac);

 

Outcomes