Post Go back to editing

ADF4350 no-OS driver example project

Is an example c project available for the ADF4350 no-OS driver ?  Perhaps a test program written when the ADF4350.c driver was developed?

Top Replies

Parents Reply Children
  • Hi Dragos,

    I modified adf4350_set_freq in two places: 

    1. to implement rounding, I added “(.5+(float)” in 2 places:

      dev->r1_mod = .5 + (float)dev->fpfd / chspc;

      tmp = .5 + ((float)tmp / dev->fpfd); 

    This was a better match to 2 lines in the Windows .cs GUI that implement rounding: 

      MOD = (uint)(Math.Round(1000 * (PFDFreq / (decimal)OutputChannelSpacing)));

      FRAC = (uint)(Math.Round(((double)N - INT) * MOD)); 

    This change made the actual frequency calculations a bit closer to the target freq and match the GUI behavior. 

    1. I added this cast, “(uint32_t)”, to prevent band_sel_div sign extension and corruption of the MSBs here:

           dev->regs[ADF4350_REG4] =

                  ADF4350_REG4_FEEDBACK_FUND |

                  ADF4350_REG4_RF_DIV_SEL(dev->r4_rf_div_sel) |

                  ADF4350_REG4_8BIT_BAND_SEL_CLKDIV((uint32_t)band_sel_div) |

                  ADF4350_REG4_RF_OUT_EN |

                  (dev->pdata->r4_user_settings &

                   (ADF4350_REG4_OUTPUT_PWR(0x3) |

                    ADF4350_REG4_AUX_OUTPUT_PWR(0x3) |

                    ADF4350_REG4_AUX_OUTPUT_EN |

                    ADF4350_REG4_AUX_OUTPUT_FUND |


    Compiler differences, perhaps, made this necessary,