RT1020 ADC issues

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RT1020 ADC issues

Jump to solution
422 Views
joshgentrycargt
Contributor I

The design I'm using is using ADC2 channel 3. This ADC pin does not work correctly. To double check if there was a design issue, when this pin is used on the MIMXRT1020-EVK it still does not work. R249 and R251 are removed so that it is not connected to a pull up. The behavior I see is it appears to be pulled up and increases up to and stays at a value of ~2700. A square wave running at 1khz from an oscilloscope is put onto the header at J19 pin 10. This input is used on J18 pin 1 when using channel 10.

I used the evkmimxrt1020_adc_12b1msps_sar_interrupt example from the sdk as it most closely represents the settings I'm using in my design. 

This is the config I used with the sdk:

#define DEMO_ADC_BASE ADC2

#define DEMO_ADC_IRQn ADC2_IRQn

#define DEMO_ADC_USER_CHANNEL 3U

#define DEMO_ADC_CHANNEL_GROUP 0U

#define EXAMPLE_ADC_IRQHandler ADC2_IRQHandler

 

Pin configuration with the pins tool for [90] GPIO_AD_B1_02:

Peripheral: ADC2

Signal: IN, 3

Slew Rate: Slow

Software Input On: Disabled

Open Drain: Disabled

Speed: Medium

Drive Strength: RO/6

Pull/Keeper select: Keeper

Pull/Keeper enable: Disabled

Pull Up/Down Config: 100k Ohm Pull Down

Hysteresis: Disable

 

Using [90] GPIO_AD_B1_10 with the same configuration above,

but for signal IN, 10 works. The only change in software is made to:

DEMO_ADC_USER_CHANNEL 10U

 

Both pins are enabled for the test but only one is used at a time.

I tried many settings to get some sort of response from the pin, but

it never returns a reasonable value.

 

In ADC_Init, I added this above "base->CFG = tmp32;" and tested all

of the values for the averaging:

// kADC_HardwareAverageCount4 = 0U, /*!< For hardware average with 4 samples. */

// kADC_HardwareAverageCount8 = 1U, /*!< For hardware average with 8 samples. */

// kADC_HardwareAverageCount16 = 2U, /*!< For hardware average with 16 samples. */

// kADC_HardwareAverageCount32 = 3U, /*!< For hardware average with 32 samples. */

// kADC_HardwareAverageDiasable = 4U, /*!< Disable the hardware average function. */

tmp32 |= ADC_CFG_AVGS(kADC_HardwareAverageCount8);

base->CFG = tmp32;

 

I did this with and without enabling averaging to try and find

one working setting:

tmp32 |= ADC_GC_AVGE_MASK;

base->GC = tmp32;

 

I'm looking for a way to get this pin working and would appreciate any help!

MCUXPresso 11.9.0

SDK 2.15.0

Problem occurs with the MIMXRT1020-EVK board as well as the MIMXRT1021DAG5A chip in the design.

 

 

Labels (1)
0 Kudos
Reply
1 Solution
359 Views
mayliu1
NXP Employee
NXP Employee

Hi @joshgentrycargt ,

Thank you for your updated information.

I down load your project, and add print information, ADC2 channel3 work normal.

mayliu1_0-1730197469737.png

ADC2 channel3 connect AREF.

mayliu1_1-1730197482845.png

ADC2 channel3 connect GND.

mayliu1_2-1730197520436.png

 

Please be aware that ADC2 channel3 PIN is PIN90(GPIO_AD_B1_02), This pin is not connect to  J19 pin 10(GPIO_SD_B1_02). 

mayliu1_4-1730198240647.png

 

mayliu1_3-1730198199385.png

 

I connect one end of resistor R85(Connect PIN90) with a wire harness, and the other end to GND or AREF.

 

Wish it helps you.
If you still have question about it, please kindly let me know.

 

Best Regards

mayliu

 

View solution in original post

0 Kudos
Reply
4 Replies
368 Views
joshgentrycargt
Contributor I

I made your changes to this project and still see the same results. Attached is my workspace. I also attached a version of adc_interrupt.c that fills a buffer instead of using getchar. I'm using a mag wire connected to J19 pin 10 to drive ADC2 channel 3.

0 Kudos
Reply
360 Views
mayliu1
NXP Employee
NXP Employee

Hi @joshgentrycargt ,

Thank you for your updated information.

I down load your project, and add print information, ADC2 channel3 work normal.

mayliu1_0-1730197469737.png

ADC2 channel3 connect AREF.

mayliu1_1-1730197482845.png

ADC2 channel3 connect GND.

mayliu1_2-1730197520436.png

 

Please be aware that ADC2 channel3 PIN is PIN90(GPIO_AD_B1_02), This pin is not connect to  J19 pin 10(GPIO_SD_B1_02). 

mayliu1_4-1730198240647.png

 

mayliu1_3-1730198199385.png

 

I connect one end of resistor R85(Connect PIN90) with a wire harness, and the other end to GND or AREF.

 

Wish it helps you.
If you still have question about it, please kindly let me know.

 

Best Regards

mayliu

 

0 Kudos
Reply
344 Views
joshgentrycargt
Contributor I

Got the SD mixed up with the AD signal bank. Thanks!

0 Kudos
Reply
386 Views
mayliu1
NXP Employee
NXP Employee

Hi  ,

 

Thank you for your interest in the NXP MIMXRT product, I would  like to provide service for you.

I used the MIMXRT1020-EVK board to verify ADC1 channel 0 and ADC2 channel 3, and the ADC conversion results are normal without any issues.

1:Please open the Pins  Tool, and Set ADC2 channel3, and click Update Code button.

mayliu1_0-1730086282384.png

 

2:  In the Project " evkmimxrt1020_adc_12b1msps_sar_interrupt"

Please add code as what I do.

mayliu1_1-1730086354467.pngmayliu1_2-1730086386134.pngmayliu1_3-1730086411514.png

The image below shows the results of my validation.

mayliu1_4-1730086476866.png

Wish it helps you.
If you still have question about it, please kindly let me know.

 

Best Regards

mayliu

 

0 Kudos
Reply