AM263P4-Q1: AM263Px ADC SOC Example: Constant ADC Output

Part Number: AM263P4-Q1
Other Parts Discussed in Thread: REF3318, TCA6424A, TCA6424

Hi Team,

I am working on the ADC module and testing the ADC SOC software example on AM263Px‑CC using AM263Px MCU+ SDK v11.01.00.

While running the ADC test example, I observe that the ADC output remains constant, even when I vary the input voltage from 0 V to 3.2 V applied to ADC0_AIN2 (HSEC pin 15).

image.png

Despite changing the input voltage, the ADC result does not change accordingly.

Questions:

  1. Is there a recommended way to properly test the ADC to obtain variable digital counts in the range 0 to 4095?
  2. Are there any specific configurations (SOC, reference voltage, pinmux, etc.) that I should verify for this example?
  3. Does the example use any internal connection or test signal that overrides the external pin input?

Any guidance on how to correctly validate ADC functionality on AM263Px would be appreciated.

Thanks in advance.

  • Hi Shilpa,

    I am looking into this issue for you and will provide a response by the end of the week.

    Best Regards,

    Zackary Fleenor

  • Hi Fleenor, 

    Thank you for the response and waiting for any solutions.

    Best Regards,

    Shilpa

  • Hi Shilpa,

    Apologies for the delayed response over the holiday weekend.

    Can you verify SW7 is set to Pin1 to use the onboard reference?

    https://www.ti.com/lit/ug/spruj86d/spruj86d.pdf#page=44

    Best Regards,

    Zackary Fleenor

  • Yes, Fleenor. I verified the switch settings beforehand.

    Board Switches:
    For the ADC examples and reference configuration, I set SW9.1 to pin 1–2 and SW9.2 to pin 4–5.

    Reference Source:
    I used SW7 to select the on‑board 1.8 V reference (REF3318) by setting it to position pin 1–2.

    Could you please check once again and let me know why I am reading a constant ADC count when I vary the input voltage from 0 V to 1.8 V?

    One more thing I wanted to ask: can we feed the ADC input voltage from 0 V to 3.2 V, or should it be limited to 0 V to 1.8 V, since the Vref is 1.8 V for AM263Px?

  • Hi Shilpa,

    The ADC in the AM263x/263Px/261x series of devices internally scales the input voltage down for proper evaluation versus a stable 1.8 V reference. This means that to sweep from 0-4095, the input voltage should sweep from 0.0V - 3.2V for the full scale.

    I can work on getting an equivalent setup on my side to evaluate the example and let you know my findings by the end of the week.

    Just wanted to confirm you haven't made any changes from the original example?

    Best Regards,

    Zackary Fleenor

  • Hi Shilpa,

    I’ve been able to run the ADC example on my side and am seeing the expected variation in the output as the input voltage changes. This suggests the example itself is functioning as designed.

    To help me understand why you’re not getting the same results, I’d like to explore your setup in a bit more detail. Would you be willing to walk me through your setup step-by-step, starting with powering up the board and then moving through the connections and switch settings?

    Specifically, let’s cover:

    * How you’re connecting the input voltage source to ADC0_AIN2.
    * The exact positions of switches SW7 and SW9.1/9.2.
    * How you're measuring the input voltage.

    I'm confident we can get to the bottom of this.

    Best Regards,

    Zackary Fleenor

  • Hi Fleenor,

    Thanks for the response.

    V to 3.2 V applied to ADC0_AIN2 (HSEC pin 15).

    The pin is ADC0_AIN0 & ADC0_AIN1 not ADC0_AIN2. Sorry for the miscommunication and from ADC0_AIN2 we're able to get the results.

    For your queries:

    * How you’re connecting the input voltage source to ADC0_AIN0/1/2 - From varying DC supply connected via Jumper
    * The exact positions of switches SW7 and SW9.1/9.2 - SW7: 1-2 & SW9.1: 1-2 & SW9.2: 4-5
    * How you're measuring the input voltage - Reading from the Result Register (
    ADC_RESULT_BASE       0x50100000U)

    Additionally, I checked the schematic's, I need to enable the IO expander for the ADC0_AIN0, ADC0_AIN1 pin to pull high. Do I need to configure the IO expander as per the schematics?

    Waiting for your response.

    Thanks & regards,
    Shilpa 

  • Hi Shilpa,

    Thanks again for the quick and detailed response, and apologies for the initial confusion regarding the pin number! It's great you've confirmed you're now using ADC0_AIN0/1/2.

    We use the TCA6424A I/O expander on the AM263Px Control Card.

    Understanding the I/O Expander and the Correct Approach

    The AM263Px Control Card uses a TCA6424A I/O expander to manage additional GPIO pins, including those used for the ADC inputs. The ADC inputs (ADC0_AIN0 and ADC0_AIN1, and potentially ADC0_AIN2) require these pins to be configured as inputs for proper functionality.

    The best way to configure the I/O expander is to use the TCA6424 driver provided within the MCU+ SDK. This driver handles all the low-level register writes for you and avoids potential errors.

    Here's how you should proceed:

    1. Verify SDK Version: Please ensure you are using MCU+ SDK version 10.00.01 or later. This version includes support for the TCA6424A and the necessary APIs.

    2. Use the TCA6424 Driver: Avoid manually writing to I2C registers. Instead, utilize the TCA6424 driver module from the SDK.

    3. Configure as Inputs: Use the TCA6424_MODE_INPUT setting to configure the pins connected to ADC0_AIN0 and ADC0_AIN1 as inputs.

    4. Identify GPIO Indices: This is crucial. I need to confirm the precise TCA6424A GPIO indices that correspond to ADC0_AIN0 and ADC0_AIN1. The resolver examples in the SDK demonstrate how this is configured, but the specific mapping may vary.

    5. Pull-Up Resistors: The TCA6424A datasheet (and the SDK driver) indicate how to configure pull-up resistors. Double check the board schematics to determine if there are external pull-up resistors present, or if they are part of the driver configuration.

    Code Example (Illustrative - Using the SDK):

    // Assuming you have the TCA6424 driver initialized
    // And have identified the correct GPIO index for ADC0_AIN0/1
    
    // Example for ADC0_AIN0 (replace with correct index)
    TCA6424_setConfig(GPIO_INDEX_FOR_AIN0, TCA6424_MODE_INPUT);
    
    // Example for ADC0_AIN1 (replace with correct index)
    TCA6424_setConfig(GPIO_INDEX_FOR_AIN1, TCA6424_MODE_INPUT);

    By using the SDK’s TCA6424 driver, referencing the resolver examples, and verifying the GPIO pin mapping in the schematic, you’ll be able to get accurate ADC readings.

    Let me know if you need help locating the schematic or have any trouble integrating the TCA6424 driver into your code. I'm happy to walk you through it.


    Resources:

    Best Regards,

    Zackary Fleenor

  • Hi Fleenor,

    Thank you for the detailed response. As per the below image, I2C configuration only I2C0 needs to be selected, but the I2C Instance is I2C2 (Value was locked by CONFIG_IOEXP0) is present. So, needs to change here anything in the configuration or it will work as it is??

    Just to confirm, I checked with the above changes, however I'm not able to see the any results maybe it is going to hard fault. Please let me know the correct the procedure to enable the ADC0_AIN0/1 pins.

    Best Regards,

    Shilpa

  • Hi Shilpa,

    Thanks for the update and for continuing to work through this with me. It’s great you’ve started investigating the I2C configuration further.

    Regarding the I2C Instance (I2C0 vs. I2C2):

    You've hit on a very important point! You are correct to notice the discrepancy between the expected I2C0 and the locked I2C2 configuration. The `CONFIG_IOEXP0` setting likely forces the use of I2C2 for the TCA6424A on the AM263Px Control Card. _Do not change this setting._ The code needs to be configured to use I2C2, even if the documentation initially points to I2C0. This is a board-specific quirk.

    Troubleshooting the Hard Fault:

    A hard fault strongly suggests a configuration issue somewhere. Let's focus on confirming the TCA6424A is correctly initialized using I2C2 *before* trying to read ADC values. Here's a refined troubleshooting approach:

    1. Double-Check I2C2 Configuration: Ensure your project is correctly configured to use I2C2. This includes:
      1. Verify that I2C2 is enabled in your project’s device tree (or equivalent configuration method).
      2. Confirm the correct clock speed and other I2C2 parameters are set.
    2. Minimal TCA6424A Initialization Code:** For testing, start with a *very* basic piece of code focused solely on initializing the TCA6424A. No ADC reads yet. The goal is to confirm you can communicate with the chip. Here’s a simplified outline:
      1. Initialize I2C2.
      2. Initialize the TCA6424A driver, specifying the correct I2C instance (I2C2) and the correct I2C address (0x20 is common, but double-check the schematic).
      3. Attempt to write a test value to a single TCA6424A output pin (something easy to verify with a multimeter). If this works, communication is good.
    3. Pin Configuration: Let's revisit pin configuration. While using the driver is recommended, it's essential to confirm the TCA6424A is configured correctly:
      1. GPIO Indices: This is key. Refer to the AM263Px Control Card schematic (I can help you locate it online if needed) to *precisely* determine the TCA6424A GPIO indices corresponding to ADC0_AIN0 and ADC0_AIN1. It's possible they aren't sequential.
      2. Input Mode: Once you have the correct GPIO indices, configure those pins as inputs using `TCA6424_MODE_INPUT`.
      3. Pull-up resistors: Confirm that the I/O expander has pull up resistors enabled (check configuration within the SDK driver).
    4. Debugging: If you still get a hard fault:
      1. Breakpoints:** Set a breakpoint *immediately* after initializing the TCA6424A driver. Step through the code line by line to see if any errors are triggered during the initialization process.
      2. I2C Analyzer:** Use an I2C analyzer (software or hardware) to monitor the I2C bus and verify that your code is sending the correct commands and receiving acknowledgements from the TCA6424A.

    Regarding finding helpful resources:

    Here is a helpful link to using the TCA6424 driver in a resolver diagnostics example: https://www.ti.com/lit/ug/sprui71/sprui71.pdf

    If you'd like to share your existing initialization code snippet, I'm happy to review it and provide more specific feedback. I know it can be tricky getting these details right.

    Best Regards,

    Zackary Fleenor