RT1170 ADC_ETC

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

RT1170 ADC_ETC

2,264 Views
Andy_h
Contributor II

Hello,

i want to get a better understanding of how the ADC and the ADC_ETC works on the RT1170. Therefor i implemented the adc_etc example. I have a few questions about the program.

1) Parameters 

while DEMO_ADC_BASE is appartently the used ADC, i can't imagine what the DEMO_ADC_USER_CHANNEL and the DEMO_ADC_CHANNEL_GROUPS are. 

In the PinConfig, i'm able to set the LPADC input channels as A_1, A_2... but the defines in the example doesn't have any identifiers with letters, just numbers.

Same with the adc_etc channels. What is this parameter for?

Kind regards,

Andy

 

0 Kudos
Reply
11 Replies

2,240 Views
Andy_h
Contributor II

Hello,

i've read the reference manual and still have some questions.

I used the adc_etc interrupt example which worked fine. Then i switched to LPADC2 and nothing worked. After a closer view i recognised that the program doesn't even come to the Interrupt routine. 

I changed the define corresponding to the XBAR from 

kXBARA1_OutputAdcEtc0Coco0

to kXBARA1_OutputAdcEtc1Coco0 as i've seen that these one from coco0-coco3 are for the ADC2. 

I also enabled the Interrupt routines 2 and 3 and implemented them the exact same way as in the Demo, but it still doesn't work.

 

Do i oversee some important configuration?

Kind regards,

Andy

0 Kudos
Reply

2,234 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

Did you change the adcEtcConfig.XBARtriggerMask to 4? Since XBAR1 output is changed to ADC_ETC1_TRIG0, ETC->CTRL.TRIG_ENABLE should also change.

 

Regards,

jing

0 Kudos
Reply

2,231 Views
Andy_h
Contributor II

Hello Jing,

 

yes, i did. But it doesnt work. The interessting thing is that i tried the lpadc polling example and that works..so i must have a wrong configuration with the edc. These are my Parameters:

#define DEMO_ADC_BASE                              LPADC
#define DEMO_ADC_CHANNEL_GROUP0      1U
#define DEMO_ADC_CHANNEL_GROUP1      2U
#define DEMO_ADC_ETC_CHANNEL0            0U
#define DEMO_ADC_ETC_CHANNEL1            1U

#define DEMO_XBARA_BASE                           XBARA1
#define DEMO_XBARA_INPUT_PITCH0           kXBARA1_InputPit1Trigger0
#define DEMO_XBARA_OUTPUT_ADC_ETC   kXBARA1_OutputAdcEtc1Coco0

#define DEMO_PIT_BASE                                 PIT1
#define DEMO_PIT_CLOCK_SOURCE CLOCK_GetRootClockFreq(kCLOCK_Root_Bus)

#define TEST_XBARTriggerMask                      4U

 

else iam just using the normal adc_etc example source code. 

regards,

Andy

0 Kudos
Reply

2,163 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @Andy_h ,

DEMO_ADC_ETC_TRIGGER_GROUP should be 4. Please see figure 88-2 in RM.

And then, 

ADC_ETC_ClearInterruptStatusFlags(DEMO_ADC_ETC_BASE, kADC_ETC_Trg4TriggerSource, kADC_ETC_Done0StatusFlagMask);

 

Regards,

Jing

0 Kudos
Reply

2,228 Views
Andy_h
Contributor II

Hello,

 

i have found a solution. I changed the TriggerMask to 255 so it enables all. The Conversion of the first Value works now. But the second value always stays at 0. If i change the DEMO_ADC_USER_CHANNEL, its the direct opposite. Do i have to change something in the trigger chain?? The configuration of the trigger chain is filled with the same parameters despite the DEMO_ADC_ETC_TRIGGER_GROUP, which is 4 by now due to the switch to ADC2.

 

kind regards,

Andy

0 Kudos
Reply

2,192 Views
Andy_h
Contributor II

these are my defines:

current:                                                               DEMO

#define DEMO_ADC_BASE LPADC2                   //LPADC1
#define DEMO_ADC_USER_CHANNEL 1U         //0U
#define DEMO_ADC_USER_CMDID 1U              //1U
#define DEMO_ADC_CHANNEL_GROUP0 0U    //0U
#define DEMO_ADC_CHANNEL_GROUP1 1U    //1U

#define DEMO_ADC_ETC_BASE ADC_ETC        //ADC_ETC
#define DEMO_ADC_ETC_CHAIN_LENGTH 1U   //1U
#define DEMO_ADC_ETC_CHANNEL0 0U           //0U
#define DEMO_ADC_ETC_CHANNEL1 1U           //1U
#define DEMO_ADC_ETC_TRIGGER_GROUP 4U //0U
#define DEMO_ADC_ETC_DONE0_Handler ADC_ETC_IRQ0_IRQHandler
#define DEMO_ADC_ETC_DONE1_Handler ADC_ETC_IRQ1_IRQHandler

#define DEMO_XBARA_BASE XBARA1                //XBARA1
#define DEMO_XBARA_INPUT_PITCH0 kXBARA1_InputPit1Trigger0 //kXBARA_InputPitTrigger0
#define DEMO_XBARA_OUTPUT_ADC_ETC kXBARA1_OutputAdcEtc1Coco0 //kXBARA1OutputAdcEtc0Coco0

0 Kudos
Reply

2,199 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

The demo use one trig source to AD converter one ADC channel twice.

"DEMO_ADC_ETC_TRIGGER_GROUP = 0" means it use ETC.TRIG0_CTRL register to control ADC trig. TRIG0_CTRL.TRIG_CHAIN=1 means it will trig twice. In the ETC TRIG0 group it use ETC_TRIG Chain 0/1 Register(TRIG0_CHAIN_1_0).

The low halfword is CHAIN0. It generate HWTS[0] in this demo. It point to ADC.TCTRL[0]. The high halfword is CHAIN1 it is used to generate HWTS[1] in this demo. It point to ADC.TCTRL[1]. Both  ADC.TCTRL[0] and  ADC.TCTRL[1] point to ADC.CMDL[0] and ADC.CMDH[0] pair.

All signals, such as HWTS and TCMD, send to ADC1 and ADC2 identically.

 

Regards,

Jing

 

 

0 Kudos
Reply

2,189 Views
Andy_h
Contributor II

Hello Jing,

 

thank you for that information. Please have a look at my parameters. I hope you can tell me why the first Conversion works fine but the second doesn't do anything:

 

DEFINES:

hese are my defines:

current:                                                               DEMO

#define DEMO_ADC_BASE LPADC2                   //LPADC1
#define DEMO_ADC_USER_CHANNEL 1U         //0U
#define DEMO_ADC_USER_CMDID 1U              //1U
#define DEMO_ADC_CHANNEL_GROUP0 0U    //0U
#define DEMO_ADC_CHANNEL_GROUP1 1U    //1U

#define DEMO_ADC_ETC_BASE ADC_ETC        //ADC_ETC
#define DEMO_ADC_ETC_CHAIN_LENGTH 1U   //1U
#define DEMO_ADC_ETC_CHANNEL0 0U           //0U
#define DEMO_ADC_ETC_CHANNEL1 1U           //1U
#define DEMO_ADC_ETC_TRIGGER_GROUP 4U //0U
#define DEMO_ADC_ETC_DONE0_Handler ADC_ETC_IRQ0_IRQHandler
#define DEMO_ADC_ETC_DONE1_Handler ADC_ETC_IRQ1_IRQHandler

#define DEMO_XBARA_BASE XBARA1                //XBARA1
#define DEMO_XBARA_INPUT_PITCH0 kXBARA1_InputPit1Trigger0 //kXBARA_InputPitTrigger0
#define DEMO_XBARA_OUTPUT_ADC_ETC kXBARA1_OutputAdcEtc1Coco0 //kXBARA1OutputAdcEtc0Coco0

 

The LPADC_Configuration and adc_etc Configuration is exatly the same as in the adc_etc demo...

 

kind regards,

Andy

0 Kudos
Reply

2,256 Views
Andy_h
Contributor II

Hello Sir, 

 

thank you for your fast response. I want to use the following Pins as Input:

- LPADC A,2_1 at GPIO_AD_20

- LPADC A.2_2 at GPIO_AD_22

so, do i need 2 user channels with this setup? Iam a little bit confused because the implemented adc_etc works fine as long as i want to use the pre configurated LPADC1...

 

Also iam interessted in the DEMO_ADC_ETC_CHAINGROUP defines. I used to work with the RT1150 and there were modifications about the Chain group possible in the config tools menu..

 

kind regards,

Andy 

0 Kudos
Reply

2,246 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @Andy_h ,

To understanding these conventions better, you have to go back to reference manual and demo project. Otherwise it is really easy to get confuse.

Please refer to Figure-87-1, each ADC input is a channel. GPIO_AD_20 is channel 1A and GPIO_AD_22 is channel 2A. GPIO_AD_21 can combine with GPIO_AD_20 to work in differential mode. And it's same to GPIO_AD_22. So, GPIO_AD_20 and GPIO_AD_22 are two different channel. You can use ADC_ETC to trig these two channel in a chain by one hardware trig. You also can trig them separately by two ext_hwts from ETC.\

CHAIN group is try to use one ext_hwts event to trig multiple ADC channel. You can trace into the code to check if TRIGa_CHAIN_b_c register is configured correctly.

 

Regards,

Jing

 

0 Kudos
Reply

2,259 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @Andy_h ,

RT1170 LPADC1 has 12 channel and LPADC2 has 14 channel.  DEMO_ADC_USER_CHANNEL  defines which channel are used in the demo.

There are 8 hardware trig signal(ext_hwts[7:0]) send from ETC to ADC. DEMO_ADC_ETC_CHANNEL defines which trig signal are used.

ADC input pins are in ADC input function by default. That means you needn't set anything if you use them as ADC pins.

 

Regards,

Jing

0 Kudos
Reply