I have two designs I'm playing with. I find that if I run the
KAT_rfi_sys 16K spectrometer, then after that I can control the RF
attenuators with corr.katadc.rf_fe_set(). However, if I load another
design developed here (kurtspec) into a cold ROACH (i.e. after power
cycling) corr.katadc.rf_fe_set() doesn't work.
corr.katadc.rf_fe_set() uses corr.katadc.iic_write_register() like this:
iic_write_register(fpga, katadc_n, 0x20+pol, 2,
0x40+(enabled<<7)+int((gain*2)+23))
and this iic_write_register() does a series of FPGA register writes:
iic_controller='iic_adc%i' % katadc_n
fpga.blindwrite(iic_controller, '%c%c%c%c' % (0x0,0x00,0x00,0x01),
offset=12)
fpga.blindwrite(iic_controller, '%c%c%c%c' % (0x0,0x00, WR | START |
LOCK, (dev_addr << 1) | IIC_WR), offset=0x0)
fpga.blindwrite(iic_controller, '%c%c%c%c' % (0x0,0x00, WR | LOCK,
reg_addr), offset=0x0)
fpga.blindwrite(iic_controller, '%c%c%c%c' % (0x0,0x00, WR | STOP,
reg_value), offset=0x0)
fpga.blindwrite(iic_controller, struct.pack('>4B',0,0,0,0), offset=12)
That is, it writes to register 'iic_adc0'.
However, I noticed that the KAT_rfi_sys 16K spectrometer initialization
script, which optimizes the attenuator, actually writes to directly to
another FPGA register like this:
self.fpga.write_int('adc_ctrl0',(1 << 31) + int((20-gain)*2))
This makes me think that there is something else going on in the 16K
spectrometer design that enables gain control and that this stays that
way in the hardware even when anotherfirmware design is loaded.
Does anyone have any idea about what's going on here?
Thanks and best wishes for the New Year.
Tom