This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADC3910D125: statistics engine problem

Part Number: ADC3910D125

Tool/software:

To FA or this device user 

Hi, 

i was trying to read statistice engine data, seems like very useful.

but i coudlnt read that.

i set statistics(1A4h STATS_ENABLE) enable first, tried to read power or Min,Max.

but same meaningless data comes out regardless analog signal input.

is there anything i have to manage?

i changed some value of window size and threshold setting too but no difference.

if you have example SPI setting for this, please let me know.

thank you.

  • Hello,

    If you have not already, you will need to enable the clock to the statistics engine block. This is done by writing a value of 0xC0 to register 0x4BE. Please see below from the datasheet:

     

    Best,

    Luke Allen

  • thank you Mr.Allen.


    i tried that register. but it was same, values are fixed regardless input signal.

    i m modifing clock enable, statistic enable, windows size and threshold.

    please check it agian if i miss something.

    here is the code snippet, just in case.

    Read_modify_write(0x4B4, 0, 8, 0x1) #GBL_CLK_CFG_1

    Read_modify_write(0x4BE, 0, 8, 0xF0) #GBL_CLK_CFG_2
    Read_modify_write(0x4BF, 0, 8, 0x83) #GBL_CLK_CFG_3

    Read_modify_write(0x1A4, 0, 8, 0x30) #statistic enable

    Read_modify_write(0x1A0, 0, 8, 0xFF) # windows size
    Read_modify_write(0x1A1, 0, 8, 0x0F) # windows size

    Read_modify_write(0x198, 0, 8, 0xFF) # STATS_THRESHOLD_HI_CHA
    Read_modify_write(0x199, 0, 8, 0x00)

    Read_modify_write(0x19C, 0, 8, 0x11) # STATS_THRESHOLD_LO_CHA
    Read_modify_write(0x19D, 0, 8, 0x00)

    device = "ADC3910Dxxx"
    def read_register(address):
        return FTDI_Device.ReadRegister(device, address)

    previous_values = {}
    def read_and_update_registers():
        global previous_values
       
        # Read STATS_HI_COUNT_N_CHA
        byte0 = read_register(0xE4)
        byte1 = read_register(0xE5)
        byte2 = read_register(0xE6)
        stats_hi_count_n_cha = (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_LO_COUNT_N_CHA
        byte0 = read_register(0xEC)
        byte1 = read_register(0xED)
        byte2 = read_register(0xEE)
        stats_lo_count_n_cha = (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_SUM_N_CHA
        byte0 = read_register(0xF4)
        byte1 = read_register(0xF5)
        byte2 = read_register(0xF6)
        byte3 = read_register(0xF7)
        stats_sum_n_cha = (byte3 << 24) | (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_SUM_POW_N_CHA
        byte0 = read_register(0xFC)
        byte1 = read_register(0xFD)
        byte2 = read_register(0xFE)
        byte3 = read_register(0xFF)
        byte4 = read_register(0x100)
        stats_sum_pow_n_cha = (byte4 << 32) | (byte3 << 24) | (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_MAX_N_CHA
        byte0 = read_register(0x10A)
        byte1 = read_register(0x10B)
        stats_max_n_cha = (byte1 << 8) | byte0
       
        # Read STATS_MIN_N_CHA
        byte0 = read_register(0x10E)
        byte1 = read_register(0x10F)
        stats_min_n_cha = (byte1 << 8) | byte0
       
        # Read STATS_HI_COUNT_N1_CHA
        byte0 = read_register(0x111)
        byte1 = read_register(0x112)
        byte2 = read_register(0x113)
        stats_hi_count_n1_cha = (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_LO_COUNT_N1_CHA
        byte0 = read_register(0x118)
        byte1 = read_register(0x119)
        byte2 = read_register(0x11A)
        stats_lo_count_n1_cha = (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_SUM_N1_CHA
        byte0 = read_register(0x120)
        byte1 = read_register(0x121)
        byte2 = read_register(0x122)
        byte3 = read_register(0x123)
        stats_sum_n1_cha = (byte3 << 24) | (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_SUM_POW_N1_CHA
        byte0 = read_register(0x128)
        byte1 = read_register(0x129)
        byte2 = read_register(0x12A)
        byte3 = read_register(0x12B)
        byte4 = read_register(0x12C)
        stats_sum_pow_n1_cha = (byte4 << 32) | (byte3 << 24) | (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_MAX_N1_CHA
        byte0 = read_register(0x136)
        byte1 = read_register(0x137)
        stats_max_n1_cha = (byte1 << 8) | byte0
       
        # Read STATS_MIN_N1_CHA
        byte0 = read_register(0x13A)
        byte1 = read_register(0x13B)
        stats_min_n1_cha = (byte1 << 8) | byte0
       
        # Read STATS_HI_COUNT_N2_CHA
        byte0 = read_register(0x140)
        byte1 = read_register(0x141)
        byte2 = read_register(0x142)
        stats_hi_count_n2_cha = (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_LO_COUNT_N2_CHA
        byte0 = read_register(0x144)
        byte1 = read_register(0x145)
        byte2 = read_register(0x146)
        stats_lo_count_n2_cha = (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_SUM_N2_CHA
        byte0 = read_register(0x14C)
        byte1 = read_register(0x14D)
        byte2 = read_register(0x14E)
        byte3 = read_register(0x14F)
        stats_sum_n2_cha = (byte3 << 24) | (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_SUM_POW_N2_CHA
        byte0 = read_register(0x154)
        byte1 = read_register(0x155)
        byte2 = read_register(0x156)
        byte3 = read_register(0x157)
        byte4 = read_register(0x158)
        stats_sum_pow_n2_cha = (byte4 << 32) | (byte3 << 24) | (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_MAX_N2_CHA
        byte0 = read_register(0x162)
        byte1 = read_register(0x163)
        stats_max_n2_cha = (byte1 << 8) | byte0
       
        # Read STATS_MIN_N2_CHA
        byte0 = read_register(0x166)
        byte1 = read_register(0x167)
        stats_min_n2_cha = (byte1 << 8) | byte0
       
        # Read STATS_HI_COUNT_N3_CHA
        byte0 = read_register(0x16C)
        byte1 = read_register(0x16D)
        byte2 = read_register(0x16E)
        stats_hi_count_n3_cha = (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_LO_COUNT_N3_CHA
        byte0 = read_register(0x170)
        byte1 = read_register(0x171)
        byte2 = read_register(0x172)
        stats_lo_count_n3_cha = (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_SUM_N3_CHA
        byte0 = read_register(0x178)
        byte1 = read_register(0x179)
        byte2 = read_register(0x17A)
        byte3 = read_register(0x17B)
        stats_sum_n3_cha = (byte3 << 24) | (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_SUM_POW_N3_CHA
        byte0 = read_register(0x180)
        byte1 = read_register(0x181)
        byte2 = read_register(0x182)
        byte3 = read_register(0x183)
        byte4 = read_register(0x184)
        stats_sum_pow_n3_cha = (byte4 << 32) | (byte3 << 24) | (byte2 << 16) | (byte1 << 8) | byte0
       
        # Read STATS_MAX_N3_CHA
        byte0 = read_register(0x18E)
        byte1 = read_register(0x18F)
        stats_max_n3_cha = (byte1 << 8) | byte0
       
        # Read STATS_MIN_N3_CHA
        byte0 = read_register(0x192)
        byte1 = read_register(0x193)
        stats_min_n3_cha = (byte1 << 8) | byte0
       
        # Read STATS_THRESHOLD_HI_CHA
        byte0 = read_register(0x198)
        byte1 = read_register(0x199)
        stats_threshold_hi_cha = (byte1 << 8) | byte0
       
        # Read STATS_THRESHOLD_LO_CHA
        byte0 = read_register(0x19C)
        byte1 = read_register(0x19D)
        stats_threshold_lo_cha = (byte1 << 8) | byte0
       
        # Read STATS_WINDOW_SIZE_CHA
        byte0 = read_register(0x1A0)
        byte1 = read_register(0x1A1)
        stats_window_size_cha = (byte1 << 8) | byte0
       
        # Read STATS_ENABLE
        stats_enable = read_register(0x1A4)
       
        current_values = {
            'STATS_HI_COUNT_N_CHA': stats_hi_count_n_cha,
            'STATS_LO_COUNT_N_CHA': stats_lo_count_n_cha,
            'STATS_SUM_N_CHA': stats_sum_n_cha,
            'STATS_SUM_POW_N_CHA': stats_sum_pow_n_cha,
            'STATS_MAX_N_CHA': stats_max_n_cha,
            'STATS_MIN_N_CHA': stats_min_n_cha,
            'STATS_HI_COUNT_N1_CHA': stats_hi_count_n1_cha,
            'STATS_LO_COUNT_N1_CHA': stats_lo_count_n1_cha,
            'STATS_SUM_N1_CHA': stats_sum_n1_cha,
            'STATS_SUM_POW_N1_CHA': stats_sum_pow_n1_cha,
            'STATS_MAX_N1_CHA': stats_max_n1_cha,
            'STATS_MIN_N1_CHA': stats_min_n1_cha,
            'STATS_HI_COUNT_N2_CHA': stats_hi_count_n2_cha,
            'STATS_LO_COUNT_N2_CHA': stats_lo_count_n2_cha,
            'STATS_SUM_N2_CHA': stats_sum_n2_cha,
            'STATS_SUM_POW_N2_CHA': stats_sum_pow_n2_cha,
            'STATS_MAX_N2_CHA': stats_max_n2_cha,
            'STATS_MIN_N2_CHA': stats_min_n2_cha,
            'STATS_HI_COUNT_N3_CHA': stats_hi_count_n3_cha,
            'STATS_LO_COUNT_N3_CHA': stats_lo_count_n3_cha,
            'STATS_SUM_N3_CHA': stats_sum_n3_cha,
            'STATS_SUM_POW_N3_CHA': stats_sum_pow_n3_cha,
            'STATS_MAX_N3_CHA': stats_max_n3_cha,
            'STATS_MIN_N3_CHA': stats_min_n3_cha,
            'STATS_THRESHOLD_HI_CHA': stats_threshold_hi_cha,
            'STATS_THRESHOLD_LO_CHA': stats_threshold_lo_cha,
            'STATS_WINDOW_SIZE_CHA': stats_window_size_cha,
            'STATS_ENABLE': stats_enable,
        }
       
        # Compare current values with previous values and print if different
        for key, value in current_values.items():
            if key not in previous_values or previous_values[key] != value:
                print(f"{key}: 0x{value:0{(8 if 'SUM_POW' in key else 6)}X}")
       
        previous_values = current_values

    while True:
        read_and_update_registers()
        time.sleep(0.5)
  • Hi,

    I believe your issue might be this Read_modify_write(0x4B4080x1#GBL_CLK_CFG_1

    0x484 is actually the addr value for GBL_CLK_CFG_1

    Thanks!