mitlabence / ESUM

Firmware and bootloader for the energy sum modules at the Crystal Barrel Experiment.
0 stars 1 forks source link

ADC value not updated #4

Closed jmuellers closed 2 years ago

jmuellers commented 2 years ago

Writing to ADC flag does not produce a correct result. Not seen below, when uninitialized, the first readout will be zero. When switching from baseline to NREF, the first result will still reflect the baseline value.

ESUM 0 ADCBASELINE
value: 0d756
OK
ESUM 0 ADCBASELINE
value: 0d766
OK
ESUM 0 ADCNREF
value: 0d760
OK
ESUM 0 ADCNREF
value: 0d925
OK

Raw transmission:

set i2c channel 18
i2c write d_in=0x01 (1 byte) to address 0x70
i2c write d_in=0x0130 (2 byte) to address 0x1e
i2c write d_in=0x0130 (2 byte) to address 0x1e
i2c write d_in=0x31 (1 byte) to address 0x1e
i2c read d_out=0x02f4 (2 byte) from address 0x1e
i2c write d_in=0x0030 (2 byte) to address 0x1e
i2c write d_in=0x00 (1 byte) to address 0x70

set i2c channel 18
i2c write d_in=0x01 (1 byte) to address 0x70
i2c write d_in=0x0130 (2 byte) to address 0x1e
i2c write d_in=0x0130 (2 byte) to address 0x1e
i2c write d_in=0x31 (1 byte) to address 0x1e
i2c read d_out=0x02fe (2 byte) from address 0x1e
i2c write d_in=0x0030 (2 byte) to address 0x1e
i2c write d_in=0x00 (1 byte) to address 0x70

set i2c channel 18
i2c write d_in=0x01 (1 byte) to address 0x70
i2c write d_in=0x0330 (2 byte) to address 0x1e
i2c write d_in=0x0330 (2 byte) to address 0x1e
i2c write d_in=0x31 (1 byte) to address 0x1e
i2c read d_out=0x02f8 (2 byte) from address 0x1e
i2c write d_in=0x0030 (2 byte) to address 0x1e
i2c write d_in=0x00 (1 byte) to address 0x70

set i2c channel 18
i2c write d_in=0x01 (1 byte) to address 0x70
i2c write d_in=0x0330 (2 byte) to address 0x1e
i2c write d_in=0x0330 (2 byte) to address 0x1e
i2c write d_in=0x31 (1 byte) to address 0x1e
i2c read d_out=0x039d (2 byte) from address 0x1e
i2c write d_in=0x0030 (2 byte) to address 0x1e
i2c write d_in=0x00 (1 byte) to address 0x70
jmuellers commented 2 years ago

Found out that one has to read the self clearing bit that indicates data ready. Information was missing or not found in thesis.