LPC43S70 HSADC THRESHOLD_SEL=1(THR_A) And HSADC MATCH_VALUE=1

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

LPC43S70 HSADC THRESHOLD_SEL=1(THR_A) And HSADC MATCH_VALUE=1

Jump to solution
2,775 Views
robberpen
Contributor III

Hi

Want to know the behavior HSADC_DESC_MATCH(0x0) and HSADC_DESC_THRESH_A below example,

As my undestand, 

  1. HSADC_DESC_MATCH(0x0) will start simpling imediataly in this case.
  2. and HSADC_DESC_THRESH_A will start simpling at trigger threshold_A.

In this case. which behavior will be higher priority? simpling  imediataly or wait unitl THRSH_A trigger?

 

Chip_HSADC_SetupDescEntry(LPC_ADCHS, 0, 0, (HSADC_DESC_CH(1) |

HSADC_DESC_BRANCH_NEXT | HSADC_DESC_MATCH(0x1) | HSADC_DESC_THRESH_A |

HSADC_DESC_RESET_TIMER));

0 Kudos
Reply
1 Solution
2,716 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose that you misunderstood the threshold_A, it is not a trigger source, it is a compare register, the ADC sample result is compared with the threshold_A register automatically, then update flag or fire interrupt which indicates that the analog signal is below a threshold or above a threshold.

If you set HSADC_DESC_MATCH(0x10), the adchs module has an internal counter, the tick is the ADC clock, after hardware/software trigger, when the counter reaches 16 or 0x10, the ADC will convert, so the ADC conversion rate is Fadc/16.is you set  HSADC_DESC_MATCH(0x00), the ADC will generate a sample for each ADC clock cycle.

Hope it can help you

BR

Xiangjun Rong

 

xiangjun_rong_0-1724380546937.pngxiangjun_rong_0-1724380546937.png

 

View solution in original post

0 Kudos
Reply
4 Replies
2,742 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Q1)HSADC_DESC_MATCH(0x0)will start sampling immediately in this case.

>>>>>The HSADC_DESC_MATCH(0x0) does not mean that the ADC converter starts-up immediately, the HSADC_DESC_MATCH(0xxx)  can control the ADC sampling time(ADC conversion rate). Setting HSADC_DESC_MATCH(0x00) means that the ADC can get one sample for each ADC clock.

You can use software trigger to start ADC conversion by setting the SW_TRIGGER bit in Trigger register, pls refer to section 48.6.5 Trigger register.

You can use hardware trigger to start ADC conversion by setting the ADCHS_TRIGGER_IN reg, pls refer to section 18.4.25 ADCHS trigger input multiplexer (ADCHS_TRIGGER_IN).

 

Q2)and HSADC_DESC_THRESH_A will start simpling at trigger threshold_A.

>>>>>DESCRIPTOR0x[THRESHOLD_SEL] selects the ADC result comparsion threshold register, it is NOT related to ADC starting.

Hope it can help you

BR

XiangJun Rong

 

 

 

0 Kudos
Reply
2,727 Views
robberpen
Contributor III

Hi @xiangjun_rong 

I don't quite understand.

Here a case of  both  HSADC_DESC_THRESH_A and HSADC_DESC_MATCH(0x10) set to descriptor.

then  while  threshold_A was trigger at hsadc timer 0x5, what is the timing clock of simpling? clock 0x5, 0x6 or 0x10?

thanks
Peter

0 Kudos
Reply
2,717 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose that you misunderstood the threshold_A, it is not a trigger source, it is a compare register, the ADC sample result is compared with the threshold_A register automatically, then update flag or fire interrupt which indicates that the analog signal is below a threshold or above a threshold.

If you set HSADC_DESC_MATCH(0x10), the adchs module has an internal counter, the tick is the ADC clock, after hardware/software trigger, when the counter reaches 16 or 0x10, the ADC will convert, so the ADC conversion rate is Fadc/16.is you set  HSADC_DESC_MATCH(0x00), the ADC will generate a sample for each ADC clock cycle.

Hope it can help you

BR

Xiangjun Rong

 

xiangjun_rong_0-1724380546937.pngxiangjun_rong_0-1724380546937.png

 

0 Kudos
Reply
2,711 Views
robberpen
Contributor III
Hi xiangjun_rong

thanks for your clarification.
No more question.
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1936985%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ELPC43S70%20HSADC%20THRESHOLD_SEL%3D1(THR_A)%20And%20HSADC%20MATCH_VALUE%3D1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1936985%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3EWant%20to%20know%20the%20behavior%3CSTRONG%3E%20H%3C%2FSTRONG%3E%3CSPAN%3E%3CSTRONG%3ESADC_DESC_MATCH(0x0)%3C%2FSTRONG%3E%20and%3CSTRONG%3E%20HSADC_DESC_THRESH_A%3C%2FSTRONG%3E%26nbsp%3B%3C%2FSPAN%3Ebelow%20example%2C%3C%2FP%3E%3CP%3EAs%20my%20undestand%2C%26nbsp%3B%3C%2FP%3E%3COL%3E%3CLI%3E%3CSTRONG%3EH%3C%2FSTRONG%3E%3CSPAN%3E%3CSTRONG%3ESADC_DESC_MATCH(0x0)%26nbsp%3B%3C%2FSTRONG%3Ewill%20start%20simpling%20imediataly%20in%20this%20case.%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3Eand%26nbsp%3B%3CSTRONG%3EHSADC_DESC_THRESH_A%26nbsp%3B%3C%2FSTRONG%3Ewill%20start%20simpling%20at%20trigger%20threshold_A.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%3CSPAN%3EIn%20this%20case.%20which%20behavior%20will%20be%20higher%20priority%3F%20%3CSTRONG%3Esimpling%26nbsp%3B%20imediataly%20or%20wait%20unitl%20THRSH_A%20trigger%3F%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CDIV%3E%3CDIV%3E%3CBLOCKQUOTE%3E%3CP%3E%3CSPAN%3EChip_HSADC_SetupDescEntry(LPC_ADCHS%2C%200%2C%200%2C%20(HSADC_DESC_CH(1)%20%7C%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EHSADC_DESC_BRANCH_NEXT%20%7C%20HSADC_DESC_MATCH(0x1)%20%7C%20HSADC_DESC_THRESH_A%20%7C%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EHSADC_DESC_RESET_TIMER))%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1938894%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20LPC43S70%20HSADC%20THRESHOLD_SEL%3D1(THR_A)%20And%20HSADC%20MATCH_VALUE%3D1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1938894%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHi%20xiangjun_rong%3CBR%20%2F%3E%3CBR%20%2F%3Ethanks%20for%20your%20clarification.%3CBR%20%2F%3ENo%20more%20question.%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1938845%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20LPC43S70%20HSADC%20THRESHOLD_SEL%3D1(THR_A)%20And%20HSADC%20MATCH_VALUE%3D1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1938845%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3EI%20suppose%20that%20you%20misunderstood%20the%20threshold_A%2C%20it%20is%20not%20a%20trigger%20source%2C%20it%20is%20a%20compare%20register%2C%20the%20ADC%20sample%20result%20is%20compared%20with%20the%20threshold_A%20register%20automatically%2C%20then%20update%20flag%20or%20fire%20interrupt%20which%20indicates%20that%20the%20analog%20signal%20is%20below%20a%20threshold%20or%20above%20a%20threshold.%3C%2FP%3E%0A%3CP%3EIf%20you%20set%20HSADC_DESC_MATCH(0x10)%2C%20the%20adchs%20module%20has%20an%20internal%20counter%2C%20the%20tick%20is%20the%20ADC%20clock%2C%20after%20hardware%2Fsoftware%20trigger%2C%20when%20the%20counter%20reaches%2016%20or%200x10%2C%20the%20ADC%20will%20convert%2C%20so%20the%20ADC%20conversion%20rate%20is%20Fadc%2F16.is%20you%20set%26nbsp%3B%20HSADC_DESC_MATCH(0x00)%2C%20the%20ADC%20will%20generate%20a%20sample%20for%20each%20ADC%20clock%20cycle.%3C%2FP%3E%0A%3CP%3EHope%20it%20can%20help%20you%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EXiangjun%20Rong%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22xiangjun_rong_0-1724380546937.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22xiangjun_rong_0-1724380546937.png%22%20style%3D%22width%3A%20282px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F294885iF06E58595BC269DA%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22xiangjun_rong_0-1724380546937.png%22%20alt%3D%22xiangjun_rong_0-1724380546937.png%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3Exiangjun_rong_0-1724380546937.png%3C%2Fspan%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1938546%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20LPC43S70%20HSADC%20THRESHOLD_SEL%3D1(THR_A)%20And%20HSADC%20MATCH_VALUE%3D1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1938546%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F26034%22%20target%3D%22_blank%22%3E%40xiangjun_rong%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20don't%20quite%20understand.%3C%2FP%3E%3CP%3EHere%20a%20case%20of%26nbsp%3B%20both%26nbsp%3B%26nbsp%3B%3CSTRONG%3EHSADC_DESC_THRESH_A%26nbsp%3B%3C%2FSTRONG%3Eand%26nbsp%3B%3CSPAN%3E%3CSTRONG%3EHSADC_DESC_MATCH(0x10)%3C%2FSTRONG%3E%20set%20to%20descriptor.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ethen%26nbsp%3B%20while%26nbsp%3B%3CSTRONG%3E%26nbsp%3Bthreshold_A%20was%20trigger%3C%2FSTRONG%3E%20at%20hsadc%20timer%200x5%2C%20what%20is%20the%20timing%20clock%20of%20simpling%3F%20clock%200x5%2C%200x6%20or%200x10%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ethanks%3CBR%20%2F%3EPeter%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1937946%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20LPC43S70%20HSADC%20THRESHOLD_SEL%3D1(THR_A)%20And%20HSADC%20MATCH_VALUE%3D1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1937946%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3EQ1)H%3CSPAN%3ESADC_DESC_MATCH(0x0)will%20start%20sampling%20immediately%20in%20this%20case.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26gt%3B%26gt%3B%26gt%3B%26gt%3B%26gt%3BThe%20HSADC_DESC_MATCH(0x0)%20does%20not%20mean%20that%20the%20ADC%20converter%20starts-up%20immediately%2C%20the%20HSADC_DESC_MATCH(0xxx)%26nbsp%3B%20can%20control%20the%20ADC%20sampling%20time(ADC%20conversion%20rate).%20Setting%20HSADC_DESC_MATCH(0x00)%20means%20that%20the%20ADC%20can%20get%20one%20sample%20for%20each%20ADC%20clock.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EYou%20can%20use%20software%20trigger%20to%20start%20ADC%20conversion%20by%20setting%20the%20SW_TRIGGER%20bit%20in%20Trigger%20register%2C%20pls%20refer%20to%20section%2048.6.5%20Trigger%20register.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EYou%20can%20use%20hardware%20trigger%20to%20start%20ADC%20conversion%20by%20setting%20the%20ADCHS_TRIGGER_IN%20reg%2C%20pls%20refer%20to%20section%2018.4.25%20ADCHS%20trigger%20input%20multiplexer%20(ADCHS_TRIGGER_IN).%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%3EQ2)and%26nbsp%3B%3CSTRONG%3EHSADC_DESC_THRESH_A%26nbsp%3B%3C%2FSTRONG%3Ewill%20start%20simpling%20at%20trigger%20threshold_A.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26gt%3B%26gt%3B%26gt%3B%26gt%3B%26gt%3BDESCRIPTOR0x%5BTHRESHOLD_SEL%5D%20selects%20the%20ADC%20result%20comparsion%20threshold%20register%2C%20it%20is%20NOT%20related%20to%20ADC%20starting.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EHope%20it%20can%20help%20you%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EBR%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EXiangJun%20Rong%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CBR%20%2F%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E