Other Parts Discussed in Thread: AM4377
Hello E2E community,
I have a custom board based on AM4377 and ADC input signal are routed according to this schematic;
The problem #1 is that ADC1 isn't working. Looks like it is reserved for security applications and unlocked only on AM437xHS board:
uint32_t CHIPDBIsSecureModule(const chipdbModuleID_t moduleID) { switch (moduleID) { case CHIPDB_MOD_ID_CRYPTODMA: case CHIPDB_MOD_ID_DES: case CHIPDB_MOD_ID_SHA: case CHIPDB_MOD_ID_AES: case CHIPDB_MOD_ID_ADC1: /* <-- why???*/ case CHIPDB_MOD_ID_RNG: case CHIPDB_MOD_ID_PKA: return TRUE; default: return FALSE; } return FALSE; }
Any legitimate way to use ADC1 additionally to ADC0 in my application?
The problem #2: how to properly configure the ADC channels?
I take "pdk_am437x_1_0_14\packages\ti\starterware\examples\adc" as an example and extend it to read from all 9 channels: TSCADC_INPUT_CHANNEL1..TSCADC_INPUT_CHANNEL8 + TSCADC_INPUT_VREFN.
I configure every channel like this:
adcStepCfg.adcNegativeInpRef = TSCADC_NEGATIVE_REF_VSSA; adcStepCfg.adcPositiveInpRef = TSCADC_POSITIVE_REF_VDDA; adcStepCfg.adcNegativeInpChan = TSCADC_INPUT_CHANNEL1; adcStepCfg.adcPositiveInpChan = TSCADC_INPUT_CHANNEL1; adcStepCfg.enableXppsw = TRUE; adcStepCfg.enableXnpsw = FALSE; adcStepCfg.enableYppsw = FALSE; adcStepCfg.enableXnnsw = TRUE; adcStepCfg.enableYpnsw = FALSE; adcStepCfg.enableYnnsw = FALSE; adcStepCfg.enableWpnsw = FALSE; [. . .] adcStepCfg.adcNegativeInpRef = TSCADC_NEGATIVE_REF_VSSA; adcStepCfg.adcPositiveInpRef = TSCADC_POSITIVE_REF_VDDA; adcStepCfg.adcNegativeInpChan = TSCADC_INPUT_CHANNEL8; adcStepCfg.adcPositiveInpChan = TSCADC_INPUT_CHANNEL8; adcStepCfg.enableXppsw = TRUE; adcStepCfg.enableXnpsw = FALSE; adcStepCfg.enableYppsw = FALSE; adcStepCfg.enableXnnsw = TRUE; adcStepCfg.enableYpnsw = FALSE; adcStepCfg.enableYnnsw = FALSE; adcStepCfg.enableWpnsw = FALSE; [. . .] adcStepCfg.adcNegativeInpRef = TSCADC_NEGATIVE_REF_VSSA; adcStepCfg.adcPositiveInpRef = TSCADC_POSITIVE_REF_VDDA; adcStepCfg.adcNegativeInpChan = TSCADC_INPUT_VREFN; adcStepCfg.adcPositiveInpChan = TSCADC_INPUT_VREFN; adcStepCfg.enableXppsw = TRUE; adcStepCfg.enableXnpsw = FALSE; adcStepCfg.enableYppsw = FALSE; adcStepCfg.enableXnnsw = TRUE; adcStepCfg.enableYpnsw = FALSE; adcStepCfg.enableYnnsw = FALSE; adcStepCfg.enableWpnsw = FALSE;
But when I do the reading (doesn't matter if I use FIFO#0 or FIFO#1, or both interleaving), I always get the same readings:
ADC0 @ 0x44e0d000
Voltage sensed on the ADC0_AIN0 line :1796mV (4093 counts)
Voltage sensed on the ADC0_AIN1 line :0mV (0 counts)
Voltage sensed on the ADC0_AIN2 line :1658mV (3779 counts)
Voltage sensed on the ADC0_AIN3 line :1448mV (3300 counts)
Voltage sensed on the ADC0_AIN4 line :1247mV (2842 counts)
Voltage sensed on the ADC0_AIN5 line :1222mV (2784 counts)
Voltage sensed on the ADC0_AIN6 line :1199mV (2732 counts)
Voltage sensed on the ADC0_AIN7 line :1197mV (2727 counts)
Voltage sensed on the ADC0_AIN8 line :0mV (0 counts)
Let's put aside conversion to volts, it is not important at the moment although I would like to know how to calculate the multiplier. As I suspect that, according to the first picture, I have to get some readings on the first 3 channels and on the last two. But it is not the case! I think the positive and negative reference points are wrongly set. Can you provide an advice how should I do it correctly? Is there a detailed manual describing what all these parameters in the step configuration mean? All these: .adcNegativeInpRef, .adcPositiveInpRef, .adcNegativeInpChan, .adcPositiveInpChan?
And all of these too: .enableXppsw, .enableXnpsw, ... ????
Thank you very much in advance, your help will be very appreciated!