Is it possible to know if LPC4370 ADC filled a sample?

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

Is it possible to know if LPC4370 ADC filled a sample?

615 Views
JiaAn
Contributor I

Hi,

LPC4370 has HSADC.

In the example code, it just enable it and uses DMA to fill the samples.

Chip_GPDMA_PrepareDescriptor(LPC_GPDMA,&adc_lli[0], 30, (uint32_t)&sample, DMA_TRANSFER_SIZE, GPDMA_TRANSFERTYPE_P2M_CONTROLLER_DMA, &adc_lli[1]);
Chip_GPDMA_PrepareDescriptor(LPC_GPDMA,&adc_lli[1], 30, (uint32_t)&sample_2, DMA_TRANSFER_SIZE, GPDMA_TRANSFERTYPE_P2M_CONTROLLER_DMA, &adc_lli[0]);

So is it possible to get a flag or what every time ADC filled a sample?

Like if I use M0 to run ADC. after adc_lli[0] filled sample. Send a flag to M4. And then start adc_lli[1] and fill sample_2.

Labels (2)
0 Kudos
Reply
1 Reply

604 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, JiaAn,

Regarding your question, as you know that it is impossible to read the ADC result from FIFO and write it to memory if you sample the analog channel with 80MSPS, that is why that you have top use DMA to transfer the ADC result from FIFO to memory. Of course, in low sampling frequency, you can use interrupt mode, and in the ISR, you can read the sample from FIFO, and write it to memory.

For your question, if you set the INTERRUPT bit in the corresponding Descriptor, when the descriptor is executed, the DSCR_DONE bit in HSADC status0 register will be set, and an interrupt can be triggered.

In other words, when the analog channel in the descriptor has sampled, the DSCR_DONE bit is set, an interrupt is triggered, you can read the sample from FIFO in ISR in low speed sampling frequency.

Hope it can help you

BR

XiangJun Rong

xiangjun_rong_1-1626342735277.png

 

 

xiangjun_rong_0-1626342507916.png

 

0 Kudos
Reply