KwikStik ADC and DMA

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

KwikStik ADC and DMA

Jump to solution
1,567 Views
MarkP_
Contributor V

Hi,

need to measure ADC in 20...100kHz sampling rate.

Idea is to use DMA to move ADC-results to circular buffer.

Does AD1:ADC_LDD component support DMA transfer?

Cannot find any selection for it.

Does this bit <ADC0_SC2: DMAEN=0> activate it?

BR,

Mark

0 Kudos
1 Solution
609 Views
ProcessorExpert
Senior Contributor III

Hi,

 

please find attached the demo project for Kwikstik showing  use of ADC, triggering and DMA.

It's built using Processor Expert Peripheral initialization components. 

You can find more details in ProcessorExpert.c file.

 

best regards
Petr Hradsky
Processor Expert Support Team

 

View solution in original post

0 Kudos
8 Replies
609 Views
joebange
Contributor I

How do I get a copy of this demo project.  I have spent two days on this topic and could really use the help a demo project would provide.

0 Kudos
609 Views
Petr_H
NXP Employee
NXP Employee

Hi,

please find it attached to this post.

Unfortunately, the attachment got lost during migration of old posts to the new community.

best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos
610 Views
ProcessorExpert
Senior Contributor III

Hi,

 

please find attached the demo project for Kwikstik showing  use of ADC, triggering and DMA.

It's built using Processor Expert Peripheral initialization components. 

You can find more details in ProcessorExpert.c file.

 

best regards
Petr Hradsky
Processor Expert Support Team

 

0 Kudos
609 Views
anguel
Contributor V

Hi!

What is the reason that this example uses low-level Peripheral Initialization Components instead of higher-level Logical Device Drivers like DMATransfer_LDD? Could this be done using LDDs?

Thanks,

Anguel

0 Kudos
609 Views
Petr_H
NXP Employee
NXP Employee

In this case, the reason is that the DMA_Transfer as a component with unified API has some limitations, so it does not cover all hardware features used by this project.

Other thing is that this project is to be demonstrating the approach of using just peripheral initialization components and direct hardware for users that are familiar with the hardware architecture, are familiar with the MCU and need full control over the peripheral control code.

I have also created an application note for this application, you can read it here :

http://cache.freescale.com/files/32bit/doc/app_note/AN4688.pdf?fsrch=1&sr=18

best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos
609 Views
anguel
Contributor V

Thanks Petr!

I just wonder if it is not possible at all to use ADC + DMA with the RTOS-enabled LDD drivers.

Anyway, thanks for the nice appnote, I already had read it. It will be nice to see more of this kind. The Kinetis devices offer so much but it is not obvious how to use the features in such an elegant way.

Anguel

0 Kudos
609 Views
Petr_H
NXP Employee
NXP Employee

You are welcome.

Could you be more specific on your use-case of the ADC with DMA?

The ADC component is currently not ready to for using DMA as it is. However, we are preparing direct integration of LDD component and DMA  allowing simple use without need of deep knowledge of DMA configuration on specific MCU. This should be available in Processor Expert later this year.

best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos
609 Views
anguel
Contributor V

Petr,

It will be wonderful if you integrate DMA with other PEx components! Most modern MCUs can do so much with DMA alone, while the CPU can do processing of the values in the meantime, so one does not even have to use an RTOS. Unfortunately, most demos coming with MCUs do not make use of DMA so it is simply wasted. Actually your appnote is very very useful, only drawback may be that it cannot be integrated with MQX at that time (e.g. when needing Ethernet in addition to ADC sampling) as it uses only low-level peripheral init components.

What I am interested in right now is reading in many ADC values (like in your appnote), doing some processing by the CPU at the same time and then sending some of them to a bigger graphical LCD via SPI and eGUI (unfortunately the display on the Kwikstik is IMHO terrible), at the same time I would like to log the processed values to SD Card and to stream them out directly via USB CDC. That could probably make good use of DMA and can be all done on the wonderful Kwikstik.

Best regards,
Anguel

0 Kudos