LPC832 - ADC interrupt handler not called when configured via Peripherals page

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

LPC832 - ADC interrupt handler not called when configured via Peripherals page

Jump to solution
604 Views
aaronm
Contributor III

I followed the SDK example for LPC832 ADC and it "worked": the interrupts and program flow behaved as expected, but I think the values on the ADC pin were incorrect.  That's not the issue; but it does show basic expected operation.

I then used the MCUXpresso Peripherals configuration page to declare an ADC on channel 3 (pin 1 on TSSOP20).  The main loop and interrupt handler are the same, but the interrupt handler never gets called.  I make sure to hit the "Update Code" button after making changes in the Peripherals screen, so it doesn't seem to be some simple oversight.  I could be wrong.

As I go through the code from the SDK example and the peripheral.c code generated by MCUXpresso, I don't see drastic changes or omissions.  The generated code is different, and things aren't necessarily called in the same sequence, but the majority of the logic is there.  However, when I execute the project, the interrupt handler is never called, and my loop trigger condition is never set, so it just hangs.

I can zip the project and send it along, if it'll help.

Labels (1)
0 Kudos
1 Solution
559 Views
aaronm
Contributor III

Hi Raul,

Ok, so I read through the LPC83x User Manual, the SDK example code, and my project code, and I see that the User Manual and SDK example code both mention and reference the PDRUNCFG register to power on the ADC.  However, the generated project code does *not* specifically turn on the ADC via the PDRUNCFG register.  I had to place the following call --

POWER_DisablePD(kPDRUNCFG_PD_ADC0);

Before

BOARD_InitBootPeripherals();

And then my project, including the ADC interrupts, would work.  That seems like it would be a bug of sorts, since I do specify in the Peripherals configuration page to "Perform auto-calibration on startup," but auto-calibration can't happen if the ADC is not powered on.  Or it should not be able to happen without the ADC being powered on.

At any rate, while I'm not getting the expected ADC values - which I'll investigate, but it's probably related to voltage level settings - the basic mechanics of the ADC are working, as near as I can tell, so I'm going to mark this issue as closed.

View solution in original post

3 Replies
578 Views
RaRo
NXP TechSupport
NXP TechSupport

Hello @aaronm,

If our understanding is correct, you are expecting to have something like void DEMO_ADC_IRQ_HANDLER_FUNC (void) after configuring the ADC trough ConfigTools, is this correct?

RaulRomero_0-1677270640944.png

[SDK's LPC832 lpcxpresso832max_lpc_adc_interrupt example]

Peripherals Tool is used to configure initialization of a selected peripheral like ADC, so the part we mentioned at the beginning should be written by the user.

RaulRomero_1-1677270640949.png

[Peripherals Tool ADC Configuration]

You could copy to clipboard the interrupt handler name and use it later in your main code as in the examples.

If this is not what you are looking for, please let us know and share your project.

Best regards, Raul.

0 Kudos
560 Views
aaronm
Contributor III

Hi Raul,

Ok, so I read through the LPC83x User Manual, the SDK example code, and my project code, and I see that the User Manual and SDK example code both mention and reference the PDRUNCFG register to power on the ADC.  However, the generated project code does *not* specifically turn on the ADC via the PDRUNCFG register.  I had to place the following call --

POWER_DisablePD(kPDRUNCFG_PD_ADC0);

Before

BOARD_InitBootPeripherals();

And then my project, including the ADC interrupts, would work.  That seems like it would be a bug of sorts, since I do specify in the Peripherals configuration page to "Perform auto-calibration on startup," but auto-calibration can't happen if the ADC is not powered on.  Or it should not be able to happen without the ADC being powered on.

At any rate, while I'm not getting the expected ADC values - which I'll investigate, but it's probably related to voltage level settings - the basic mechanics of the ADC are working, as near as I can tell, so I'm going to mark this issue as closed.

567 Views
aaronm
Contributor III

Hi, Raul, yes I have a function of that name in the program scope.  The "Copy to Clipboard" was one of the many attempts I tried to get the interrupt called.  As I mentioned, the interrupt handler is called when compiled like the example application.  But if I use the Peripherals configuration tool, my interrupt is never called.

However, I just got back from three days on the road and want to look at the user manual to see if I'm overlooking something simple, but I will follow up on this.

0 Kudos