[LPC5528][ADC][DMA] Configuring DMA trigger from ADC in MCUXpresso Config Tools

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

[LPC5528][ADC][DMA] Configuring DMA trigger from ADC in MCUXpresso Config Tools

2,255件の閲覧回数
arekp
Contributor II

What is needed to trigger DMA operation when ADC watermark level is reached?

In ADC peripheral I set FIFO0 Watermark to 7 and check DMA trigger for FIFO 0 watermark event. Do I need to configure something else in MCUXpresso Config Tools?

I have already working code, when I trigger DMA in software by calling DMA_DoChannelSoftwareTrigger(DMA0, 21). I do that in ADC interrupt, which I configured to be called on FIFO 0 watermark level (same as DMA trigger), however if I don't trigger DMA manually, ADC interrupt is called indefinitely because DMA is not called to read from FIFO. When I turn off ADC interrupt, DMA is not triggered at all.

I would like to trigger DMA on FIFO 0 watermark, so that no ADC interrupt needs to be called, just a callback from DMA, in which I can set flag, that copying data from ADC is done.

ラベル(1)
タグ(3)
0 件の賞賛
13 返答(返信)

2,172件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello arekp,

There is no official ADC+DMA demo, how about check this one:

https://community.nxp.com/t5/LPC-Microcontrollers/Using-Configtools-to-set-up-ADC-and-DMA-from-scrat...  

 

BR

Alice

0 件の賞賛

2,246件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello arekp,

How about refer to this thread, it just a ADC+DMA for lpc55s69, using MCUXpresso Config Tools.

https://community.nxp.com/t5/LPC-Microcontrollers-Knowledge/ADC-multi-channel-sampling-and-DMA-trans... 

 

BR

Alice

0 件の賞賛

2,166件の閲覧回数
arekp
Contributor II

Hi, @Alice_Yang

I have seen that topic before (I mentioned it in my second response), but I can't make it working either directly using as much code as possible (changing as little as possible to adjust code for LPCXpresso55S28 board with LPC55S28) or by tweaking and trying different configurations.

0 件の賞賛

2,161件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello arekp,

If so, you only can debug step by step to check where is the problem.

First check whether the ADC signal work well, then use software trigger DMA, does it work well,

if yes, enable ADC hardware trigger ADC.

 

BR

Alice

0 件の賞賛

2,155件の閲覧回数
arekp
Contributor II

Hi @Alice_Yang 

I have already checked that, on watermark event, ADC interrupt is called, then I am using software DMA trigger. However, when I switch to ADC hardware triggering DMA, it doesn't work. So it seems ADC is not triggering DMA.

Just to be clear, in order for DMA to be configured with peripheral, should it be configured for transactional API mode? From the description in MCUXpresso Config Tools I don't understand the difference between those modes.

0 件の賞賛

2,142件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

 This is related to DMA transfer:

Alice_Yang_0-1646213712106.png

I will try to test on my side, and could you please send your project to me, its better can reproduce on lpcxpresso55s28 board, thanks.

 

BR

Alice

 

 

0 件の賞賛

2,131件の閲覧回数
arekp
Contributor II

I am attaching minimum project that shows the problem on LPCXpresso55S28 board.

First see that when DMA transfer triggered in software in ADC interrupt everything works as expected - the timeout doesn't occur and data is being transferred to the buffer.

However if you comment triggering the DMA transfer in ADC interrupt and disable "FIFO0 Watermark interrupt" in ADC0 options in peripherals configuration (even though the "DMA trigger
for FIFO0 watermark" in ADC0 options is checked), the DMA callback is not called and no data is transferred to the buffer.

0 件の賞賛

2,031件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello arekp,

I also do no find the root cause  of your project.

And I find a project provide to customer before, it is development by code, not configuration tool,

you can have a look.

 

BR

Alice

0 件の賞賛

2,026件の閲覧回数
arekp
Contributor II

Unfortunately it's for LPC55S69 microcontroller, not for LPC5528. It looks similar how it's configured in that thread, however it didn't work for me:

https://community.nxp.com/t5/LPC-Microcontrollers/Using-Configtools-to-set-up-ADC-and-DMA-from-scrat...

0 件の賞賛

2,016件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

LPC5528 almost the same with LPC5569 about ADC+DMA.

 

 

0 件の賞賛

2,240件の閲覧回数
arekp
Contributor II

@Alice_Yang Thank you for your reply.

I have seen that example before, but there is no solution to my problem. In the example LPC55S69_Project_multi_channel_DMA the DMA transfer is triggered by software in the main loop (other examples don't use DMA at all). What I would like to achieve is to trigger DMA transfer on the FIFO watermark event, that's how I understand that option in MCUXpresso Config Tools (ADC options, at the bottom of "General Configuration" field).

DMA_trigger_from_ADC.PNG

I have also looked at https://community.nxp.com/t5/LPC-Microcontrollers/Using-Configtools-to-set-up-ADC-and-DMA-from-scrat... but I can't make that working.

0 件の賞賛

2,211件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello arekp,

Yes, you are right, you need enable it in ADC configuration.

Also in DMA part, shoose the right DMA request:

Alice_Yang_0-1645609271741.png

 

BR

Alice

 

0 件の賞賛

2,190件の閲覧回数
arekp
Contributor II

Hi, @Alice_Yang 

Yes, that's what I have set in my configuration, but it still doesn't trigger the DMA when the ADC FIFO0 reaches watermark level.

Is there still something wrong with my configuration? Can you point me to a working example (it doesn't matter if everything is in the code or the code is generated by MCUXpresso Config Tools).

arekp_0-1645779707239.png

 

0 件の賞賛