HSADC on KV58F

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

HSADC on KV58F

936 Views
a8Chcx
Contributor V

Hi,

I am using the sequence conversion sample to test HSADC on KV58F and works fine...

Then, I want to use the scan end interrupt in stead of polling. I can't make the interrupt to work.

When I use software to trigger the conversion and I can see the scanA end already generated, but no the interrupt routine is called...

Could you tell me why? How to make the interrupt to work?

Thanks,

Christie

Labels (1)
0 Kudos
5 Replies

522 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Christie,

You may need to add below codes:

void HSADC0_CCA_IRQHandler(void)

{
    HSADC_ClearStatusFlags(DEMO_HSADC_BASEADDR, kHSADC_ConverterAEndOfScanFlag);

}

EnableIRQ(HSADC0_CCA_IRQn);

HSADC_EnableInterrupts(DEMO_HSADC_BASEADDR, kHSADC_ConverterAEndOfScanInterruptEnable);

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
----------------------------------------------------------------------------------------------------------------------

0 Kudos

522 Views
a8Chcx
Contributor V

Hi Robin,

I did the same as what you said and can't trigger the scan end interrupt.

1) Then I add

" HSADC_EnableSampleResultReadyInterrupts(INETVU_HSADC0_BASEADDR, 0x0400, true);" for the last channel(11)

and it works.

2) If I disable "HSADC_EnableInterrupts(DEMO_HSADC_BASEADDR, SADC_ConverterAEndOfScanInterruptEnable);"

and it works as well...

I do not know if I use "scanEndInterrupt" in sequence scan? And what is your suggestion?

Thanks,

Christie

0 Kudos

522 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Would you please tell me which channel are you using? HSADC0A or HSADC0B

ch11.png

If you connect external signal to PTE3, then you may need to :

void HSADC0_CCB_IRQHandler(void)

{
    HSADC_ClearStatusFlags(DEMO_HSADC_BASEADDR, kHSADC_ConverterBEndOfScanFlag);

}

EnableIRQ(HSADC0_CCB_IRQn);

HSADC_EnableInterrupts(DEMO_HSADC_BASEADDR, kHSADC_ConverterBEndOfScanInterruptEnable);

The Conversion complete interrupts and Scan interrupts are different. Please read "41.6 Interrupts" in KV5XP144M240RM.

Conversion Complete and Scan Interrupt.png

HSADC_EnableInterrupts can be used to enable Conversion complete interrupts.

HSADC_EnableInterrupts.png

HSADC_EnableSampleResultReadyInterrupts is used to enable Scan interrupts.

HSADC_EnableSampleResultReadyInterrupts.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

522 Views
a8Chcx
Contributor V

Hi Robin,

I connect as follows:

HSADC0A ch0-->Pin18

HSADC0A ch1-->Pin19

HSADC0A ch2-->Pin27

HSADC0A ch3-->Pin28

HSADC0A ch4-->Pin37

HSADC0A ch5-->Pin38

HSADC0A ch6-->Pin23

HSADC0A ch7-->Pin24

HSADC0B ch3-->Pin82

HSADC0B ch4-->Pin45

HSADC0B ch5-->Pin46

I am using the sequential scan.

If I enable "HSADC_EnableInterrupts(DEMO_HSADC_BASEADDR, SADC_ConverterAEndOfScanInterruptEnable);",

the interrupt will not be generated. But I can see there is the scan end status if I check the state register.

Only way to generate the interrupt is enable any sample interrupt by using " HSADC_EnableSampleResultReadyInterrupts(INETVU_HSADC0_BASEADDR, 0x0400, true);"

I do not know why the scan end interrupt does not work in this case?

Thanks,

Christie

0 Kudos

522 Views
a8Chcx
Contributor V

Hi Robin,

Do you have any update on this?

Please let me know what you find?

Thanks,

Christie

0 Kudos