SLUUDD1 August   2025

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1 Introduction
  5. 2 FT4222_Python_Controller.py
    1. 2.1 I2C Commands
    2. 2.2 SPI Commands
  6. 3 AFE20408_Page_Global_Def.py
  7. 4 AFE20408_Page_0_Def.py
  8. 5 AFE20408_Page_1_Def.py
  9. 6 AFE20408_Page_2_Def.py
  10. 7 AFE20408_Page_3_Def.py
  11. 8 AFE20408_Page_4_Def.py
  12. 9 AFE20408_Page_6_Def.py
  13. 10Main.py
  14. 11Common Sequences
    1. 11.1 Reset Sequence
    2. 11.2 ADC Configuration
    3. 11.3 DAC Configuration
  15. 12Common Issues
  16. 13Summary

ADC Configuration

There are many ways to configure the ADC. Below is an example:

    ftdiObject.spiWrite(PAGE_ADDRESS, PAGE_ADC_CONFIG)  #Set the page to ADC CONFIG, page 1
    #Set the False Alarm threshold, ADC Auto/Direct mode, and Shunt range.
    #This will set the False Alarm thresholds to 4 samples, the ADC to Automode, and the Shunt range to 163.84mV
    ftdiObject.spiWrite(ADC_GEN_CFG_ADDRESS, ADC_GEN_CFG_FALR_SENSE_4 + ADC_GEN_CFG_FALR_ADC_4 + ADC_GEN_CFG_FALR_TMP_4 + ADC_GEN_CFG_AUTOMODE_Automode + ADC_GEN_CFG_SHUNT_RANGE_163p84mVrange)
    #Set the conversion rate. This will set all channels to 152us.
    ftdiObject.spiWrite(ADC_CONV_CFG_0_ADDRESS, ADC_CONV_CFG_0_CONV_RATE_ADC_152us + ADC_CONV_CFG_0_CONV_RATE_SENSE_152us + ADC_CONV_CFG_0_CONV_RATE_TMP_152us)
    #Set the sampling rate. This will set all channels to 1 sample.
    ftdiObject.spiWrite(ADC_CONV_CFG_1_ADDRESS, ADC_CONV_CFG_1_AVG_ADC_1sample + ADC_CONV_CFG_1_AVG_SENSE_1sample + ADC_CONV_CFG_1_AVG_TMP_1sample)
    #Set the ADC Hysteresis. This sets to default.
    ftdiObject.spiWrite(ADC_HYST_0_ADDRESS, ADC_HYST_0_DEFAULT)
    ftdiObject.spiWrite(ADC_HYST_1_ADDRESS, ADC_HYST_1_DEFAULT)
    #Set the ADC channel thresholds for the Alarm configurations. These set to default.
    ftdiObject.spiWrite(ADC0_LO_THRESH_ADDRESS, ADC0_LO_THRESH_DEFAULT)
    ftdiObject.spiWrite(ADC1_LO_THRESH_ADDRESS, ADC1_LO_THRESH_DEFAULT)
    ftdiObject.spiWrite(ADC0_UP_THRESH_ADDRESS, ADC0_UP_THRESH_DEFAULT)
    ftdiObject.spiWrite(ADC1_UP_THRESH_ADDRESS, ADC1_UP_THRESH_DEFAULT)
    ftdiObject.spiWrite(SENSE0_LO_THRESH_ADDRESS, SENSE0_LO_THRESH_DEFAULT)
    ftdiObject.spiWrite(SENSE0_UP_THRESH_ADDRESS, SENSE0_UP_THRESH_DEFAULT)
    ftdiObject.spiWrite(SENSE1_LO_THRESH_ADDRESS, SENSE1_LO_THRESH_DEFAULT)
    ftdiObject.spiWrite(SENSE1_UP_THRESH_ADDRESS, SENSE1_UP_THRESH_DEFAULT)
ftdiObject.spiWrite(TMP_UP_THRESH_ADDRESS, TMP_UP_THRESH_DEFAULT)

    #Start ADC. TRIGGER then read the ADC outputs.
    ftdiObject.spiWrite(TRIGGER_ADDRESS, TRIGGER_ADC_TRIG_EnableADC)

    print("SENSE0: " + ftdiObject.spiRead(0x18)) # ADC_SENSE0 channel readback
    print("SENSE1: " + ftdiObject.spiRead(0x19)) # ADC_SENSE1 channel readback
    print("ADC0: " + ftdiObject.spiRead(0x1A)) # ADC_ADC0 channel readback
    print("ADC1: " + ftdiObject.spiRead(0x1B)) # ADC_ADC1 channel readback
    print("TEMP: " + ftdiObject.spiRead(0x1C)) # ADC_TEMP channel readback