LPC54102 adc/dma interrupts

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

LPC54102 adc/dma interrupts

711 Views
chrisoneill
Contributor I

Update: Well, now it seems to be working.  Don't know if it was an issue with the eval board, or what.  I'd still like to know if:

- what I'm doing is the proper method, or if there's a better way

- why the User Guide says to not use the sequence interrupt if you're using dma

- if there's a way for the dma to write the 12-bit conversion value starting at bit 0 instead of bit 4

 

 

Original post:

 

I'm capturing a single ADC channel, 10k total sample size using Sequence B triggering using 10 linked transfer descriptors, 1k each.

 

I'm following the implementation posted elsewhere on the forum on how to use adc/dma in a ping-pong manner.  I'm doing a single 10k capture, and the question is what is the proper way to setup, start and stop the capture.

 

To start, I set the ADC_SEQ_CTRL_BURST bit.

Chip_ADC_StartBurstSequencer(LPC_ADC, ADC_SEQB_IDX)

 

To stop, on the 10th DMA_IRQn interrupt I clr the ADC_SEQ_CTRL_BURST bit.

Chip_ADC_StopBurstSequencer(LPC_ADC, ADC_SEQB_IDX)

 

What I'm seeing with my implementation is that it starts/stops correctly the first time, and data capture is fine.  Then the second time I start the capture the Sequence B interrupts occur continuously, tying up the processor.

 

With respect to the Sequence B interrupt that triggers the DMA, is it required that that interrupt is enabled in the usual sense, an IRQHandler() be defined, etc.?

The user guide says:

"Remark: If DMA is used for a sequence, the corresponding sequence interrupt must be disabled in the INTEN register."

It's enabled in the demo code, but only seems to be used for display.

But if I don't enable it (Chip_ADC_EnableInt(LPC_ADC, ADC_INTEN_SEQB_ENABLE), nothing seems to happen (No DMA_IRQn interrupts).  How do you generate the Sequence B conversion interrupt / DMA trigger without enabling the Sequence B interrupt?

 

So what's the setup for a single run through the transfer descriptors?

And what's the best way to start and stop?

 

Also, the 12-bit adc conversion data is written by the dma to the capture buffers as it appears in the adc channel data register, in the upper 12 bits of the 16 bit field.  Any way to have it written in the lower 12 bits?

 

Source file attached, patterned after adc.c ping-pong example posted on the forum.

Original Attachment has been moved to: adc_dma_seqb.txt.zip

0 Kudos
1 Reply

480 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Chris ONeill,

Thank you for your interest in NXP Semiconductor products and 
the opportunity to serve you.
I think the thread will give you some inspiration.
Have a great day,

TIC

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

0 Kudos