Jason/David,
Thanks a lot for the support. FYI, I am using ROACH Rev3 & katADC v1.3.
I did the following test using three (3) Roach/katADC sets, similar
results for the three boxes.
On 03/27/2011 10:10 AM, Jason Manley wrote:
This is not right. Your adc is definitely in ZDOK slot zero?
Unfortunately there's very little error handling in the adc bits of
corr at this stage.
Sorry, this was a quick friday afternoon test... my katADC is in ZDOK1
(adc1) instead ZDOK0. I fixed this in the model.
As Dave suggests, let's first try to see if communications are ok with your
roach:
fpga.write_int('sys_scratchpad',1234)
fpga.read_uint('sys_scratchpad')
Out[80]: 1234
Communication ok!
fpga.est_brd_clk()
Out[81]: 100.16248349999999.
FPGA clk ok!, sys_clk/100MHz
Assuming that worked ok, you can try and read the raw values from the ADC's IIC
temperature sensor:
corr.katadc.iic_read_register(fpga,0,0x4C,0x00)
In [275]: corr.katadc.iic_read_register(fpga,1,0x4C,0x00)
Out[275]: 30
In [276]: corr.katadc.iic_read_register(fpga,1,0x4C,0x10)
Out[276]: 160
In [277]: corr.katadc.get_ambient_temp(fpga,1)
Out[277]: 40.0
I noted that the ambient temp. must be: 30.625°C instead of 40°C. The
LT11:4 register of the TI TMP421 is the direct reading of the temp in °C
(30 = 0x1E). And LT3:0 (4MSB of the register in addr. 0x10) is the
decimal representation of the temperature: 0.625 = (160 / 16) / 16. The
first 4bit-right-shift is to right justify the 8bit register, and the
second 4bit-right-shift is for the "fixed-point" representation of the
number.
I changed the get_ambient_temp() and get_adc_temp() methods in order to
get the right readings, dividing "lb" by 256 instead of 16. Please,
correct me if I am wrong. These are my readings now:
In [19]: corr.katadc.iic_read_register(fpga,1,0x4C,0x00)
Out[19]: 30
In [20]: corr.katadc.iic_read_register(fpga,1,0x4C,0x10)
Out[20]: 160
In [21]: corr.katadc.get_ambient_temp(fpga,1)
Out[21]: 30.625
In [22]: corr.katadc.iic_read_register(fpga,1,0x4C,0x01)
Out[22]: 48
In [23]: corr.katadc.iic_read_register(fpga,1,0x4C,0x11)
Out[23]: 208
In [24]: corr.katadc.get_adc_temp(fpga,1)
Out[24]: 48.9375
So you can try'n write/read to another IIC device:
corr.katadc.eeprom_details_set(fpga,0,1234,567,8,9,cal_data='') followed by
corr.katadc.eeprom_details_get(fpga,0) should return those values.
After connecting the JP1 jumper (AT24C02B, Write Protect (WP) pin to
ground, write enable):
In [207]: corr.katadc.eeprom_details_set(fpga,1,1234,567,8,9,cal_data='')
In [208]: corr.katadc.eeprom_details_get(fpga,1)
Out[208]:
{'adc_ic_id': 65535,
'pcb_rev': 65535,
'reserved': (65535, 65535, 65535, 65535),
'rf_fe_id': 65535,
'serial_number': 65535}
I also called _eeprom_read() and _eeprom_write() in different ways, and
not change at all. I wonder if something is wrong with a
FPGA-module/corr-lib comm. because I am getting the same results for my
three katADC boards. I also checked VCC (5.13VDC) of the AT24C02B and it
looks normal, such as the address configuration (A2:0=0b001, I2C addr.
0x51). I think that I can live without the EEPROM, but please, let me
know if you have an idea of how to debug this.
Finally, is there "corr" documentation similar to "katcp" (sphinx),
taking advantage of the docstrings in the python code?
Thanks,
-- Luis Quintero, Arecibo Observatory