AnsweredAssumed Answered

possible bug in AD9361.c

Question asked by hight77 on Nov 6, 2013
Latest reply on Nov 7, 2013 by mhennerich

While capturing the No-OS software SPI register accesses, I noticed that the routine for writing the mixer sub-table seems to be using the wrong address.

For the mix sub-table writes, the table address is being written to 0x130, which is the AGC gain table address.  I believe that this should be 0x138.

 

In the AD9361.c file, the ad9361_load_mixer_gm_subtable function is...

 

static int ad9361_load_mixer_gm_subtable(struct ad9361_rf_phy *phy)

{

          int i, addr;

 

 

          dev_dbg("%s\n", __func__);

 

 

          ad9361_spi_write(REG_GM_SUB_TABLE_CONFIG,

                               START_GM_SUB_TABLE_CLOCK); /* Start Clock */

 

 

          for (i = 0, addr = ARRAY_SIZE(gm_st_ctrl); i < ARRAY_SIZE(gm_st_ctrl); i++) {

                    ad9361_spi_write(REG_GAIN_TABLE_ADDRESS, --addr); /* Gain Table Index */

                    ad9361_spi_write(REG_GM_SUB_TABLE_BIAS_WRITE, 0); /* Bias */

                    ad9361_spi_write(REG_GM_SUB_TABLE_GAIN_WRITE, gm_st_gain[i]); /* Gain */

                    ad9361_spi_write(REG_GM_SUB_TABLE_CTRL_WRITE, gm_st_ctrl[i]); /* Control */

                    ad9361_spi_write(REG_GM_SUB_TABLE_CONFIG,

                                         WRITE_GM_SUB_TABLE | START_GM_SUB_TABLE_CLOCK); /* Write Words */

                    ad9361_spi_write(REG_GM_SUB_TABLE_GAIN_READ, 0); /* Dummy Delay */

                    ad9361_spi_write(REG_GM_SUB_TABLE_GAIN_READ, 0); /* Dummy Delay */

          }

 

 

          ad9361_spi_write(REG_GM_SUB_TABLE_CONFIG, START_GM_SUB_TABLE_CLOCK); /* Clear Write */

          ad9361_spi_write(REG_GM_SUB_TABLE_GAIN_READ, 0); /* Dummy Delay */

          ad9361_spi_write(REG_GM_SUB_TABLE_GAIN_READ, 0); /* Dummy Delay */

          ad9361_spi_write(REG_GM_SUB_TABLE_CONFIG, 0); /* Stop Clock */

 

 

          return 0;

}

 

I believe that REG_GAIN_TABLE_ADDRESS should be replaced with REG_GM_SUB_TABLE_ADDRESS (which is correctly defined in AD9361.h).

 

I checked the latestad9361.c source in git and it still has this function as written above.

Outcomes