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.

PROCESSOR-SDK-AM437X: ADC channels configuration

Part Number: PROCESSOR-SDK-AM437X
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!

  • Hi,

    I have asked the software team to comment on your questions. They will post here.

    However, you have a major problem with your hardware connections. The way you have connected the ADC inputs, they will probably be exposed to external voltages while the processor is unpowered. This is absolutely forbidden and may lead to permanent damage to the device. AM437x I/O pins are not fail-safe. See parameter "Steady State Max. Voltage at all IO pins" in section 5.1 of the AM437x Datasheet, and also Note 5 after the table.

  • HI,

    The only reference code for ADC are:

    • pdk_am437x_1_0_14\packages\ti\board\diag\adc\src and
    • pdk_am437x_1_0_14\packages\ti\starterware\examples\adc

    The ADC chapter is in the AM437x TRM, 

    • ADC0: Touchscreen Controller 
    • ADC1: Magnetic Card Reader

    NOTE: The magnetic card reader function is not supported on the AM437x product family.
    ADC1 should only be used as a general-purpose ADC when using an AM437x device.

    Step configure is explained in 

    STEPCONFIG_x: Controls the input values to the ADC (the reference voltages, the pull up/down
    transistor biasing, which input channel to sample, differential control, HW synchronized or SW enabled,
    averaging, and which FIFO group to save the data). There is no additional document explaining Xppsw, YPPSW, etc ...

    Regards, Eric

  • Xppsw, Xnpsw, Yppsw, Xnnsw, Ypnsw, Ynnsw, and Wpnsw are only used when connected to a resistive touch screen panel.

    They should never be set for inputs operating as general purpose ADC.

    Regards,
    Paul

  • Thanks a lot Paul!