AnsweredAssumed Answered

ADC and DMA help.

Question asked by AITOR ARANZABAL on Oct 9, 2015
Latest reply on Oct 23, 2015 by AITOR ARANZABAL

Hello all,

 

I am woriking with the FRDM-KL25Z board in a project where I need to make about 2000 ADC conversions with a very low conversion time.

Using ADC_LDD component, I am able to configure the component reducing the conversion time up to 1.58us. But then, when I run the project and I measure the real conversion time with the oscilloscope I see that it takes 8us each conversion (I measure the time needed for the 2000 conversions and then I divide it by 2000).

 

So I am dealing with the DMA in order to reduce the convesion time. I read the KL25 sub-family reference manual as well as other documents, posts and tutorials, and I think at last I understood how DMA works more or less. What I would need is to transfer the data from the ADC Result Register to a memory buffer.

 

Peripheral to memory transfer.png

 

Could your please help me with the following questions?

 

1.- Cycle-steal mode or Constinuos mode?. The datasheet says:

• Cycle-steal mode (DCRn[CS] = 1)—Only one complete transfer from source to destination occurs for each request. If DCRn[ERQ] is set, the request is peripheral initiated. A software-initiated request is enabled by setting DCRn[START].

• Continuous mode (DCRn[CS] = 0)—After a software-initiated or peripheral request, the DMA continuously transfers data until BCRn reaches zero. The DMA performs the specified number of transfers, then retires the channel.

 

If DMA is configured in Continuos mode, initiated by peripheral request (by ADC0_DMA_Request) and BCR (Byte Counter Register) = 2000, does it means that every data transfer "waits" until each conversion is finished? Or should I work in Cycle-steal mode and repeit it 2000 times?

 

 

2.- What of the components of the PE should I use? DMA_LDD, DMAChannel_LDD, DMATransfer_LDD, Init_DMA? All of them?

Every time I add the component DMA_LDD, the following error message is shown: "Peripheral is already in used by the component DMA1".

I remove the component and add it again to the project and I get the same message. Any help?

 

 

I am afraid I am a beginner and any help will be appreciated.

Thank you in advance.

 

Aitor.

Outcomes