Using Configtools to set up ADC and DMA from scratch - Sample Project LPC55S69

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

Using Configtools to set up ADC and DMA from scratch - Sample Project LPC55S69

Contributor III

Hallo Everyone!

For those of you who want to set up the ADC with DMA using the MCUXpresso Configtools for the LPC55s69

Attached is a sample project that I created from scratch, that samples 6 inputs with the ADC and transfers the values to ram with the DMA

Hope it is of value to someone who is battling to do the same

Gert van Biljon

PS : 2021/08/01 Be careful please!!! I have picked up that adc[0] value transferred by the DMA does not allways end up im buffer[0], but it can end up randomly in buffer[n], if you can see what I am doing wrong, please let me know.

How it works :

1. ADC set up with 4 conversion commands, 2 inputs each on command 1 and 2, and 1 input each on command 3 and 4
Command 1, Dual CH0 A & B
Command 2, Dual CH3 A & B
Command 3, Single CH2 A
Command 4, Single CH4 A
2. ADC Conversions are triggered at 18kHz by Trigger 5, CTimer 0, Match channel 3
3. ADC Trigger 5 set up that ADC results for Channel A and Channel B both go to FIFO 0
4. Watermerk level on FIFO 0 set to 5, thus the DMA will be triggered to transfer the moment when 6 inputs have been sampled - Imagine the watermark being the ring of dried out tea near the top of an empty teacup

5. DMA set up with 2 Transfer Control Descriptors (TCD), each descriptor transferring 6 ADC result values, the 2 TCDs continuously transfer alternately (ping/pong) to 2 different memory destinations.
6. Printing the consecutively sampled values to 2 different Virtual COM ports, one port displaying the numerical values of the samples, the other plotting a coloured * with left/right position dependent on value of the sample (Colour values best displayed on Windows with Tera Term).

A TechExplorer working with Embedded Software and Electronics in Agriculture and Alternative Energy
0 Replies