How to use DMA with timer/capture input with LPC1830?

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

How to use DMA with timer/capture input with LPC1830?

1,644 Views
ulbed
Contributor I

Hi, I use timer 3 in timer mode and use timer 3 capture input 0 to capture falling and rising edges.

How is it possible to generate a DMA reqeust to store the capture register to a memory buffer whenever a rising or falling edge (capture event) has happened?

As far as I can see, timer DMA requests can only be made by timer match event, but I need it for capture event...

Labels (1)
0 Kudos
5 Replies

1,243 Views
ulbed
Contributor I

I'm sorry, I forgot to state that I'm using an LPC1830.

I configured the DMA for peripheral to memory. Peripheral address is the Timer 3 - CR0, memory address is a buffer with incrementing address, and the DMA is the flow controller. But the DMA requests are not generated for a capture event. It seems they only work for match events.

Am I right, that I would have to use the SCT to generate DMA requests for capture events? Can you give a quick overview or example of how to configure things right?

Another aproach I thought: Is it possible to use an additional timer (i.e. Timer 2) as counter for the same CTIN_0 (GIMA input) signal and set the match value to 1 with 'reset timer on match' to generate the DMA request for every signal edge. Then use the peripheral address of the other timer capture register (Timer 3 in timer mode) for the DMA to continuously store the time of the event. Do you think this would work?

0 Kudos

1,243 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Johannes Reif,

Thanks for your reply.

1. Am I right, that I would have to use the SCT to generate DMA requests for capture events?

No, the capture event is not the request signal.

2.About the alternative approach, I think it can work.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,243 Views
ulbed
Contributor I

Thank you. I can confirm the second approach will work. But there's one thing: Each time the DMA channel is activated there are 2 initial DMA requests/transfers. I don't know where they come from.

One thing I found in the user manual is:

"Remark: The GPDMA pre-loads the data from the source
memory as soon as the channel is enabled. The data
pre-loading occurs independently of receiving a DMA transfer
request.
"

But my source is peripheral, not memory and by pre-load I wouldn't mean a full DMA transfer. Besides that I witness two transfers, not one.

It looks more like some previous unhandled match events.

Do you have a hint to prevent those 2 initial requests?

0 Kudos

1,244 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Johannes Reif,

In the Remark section, the source memory doesn't particular point to the memory, it means the summary of the source.

It seems so weird about the multiple DMA requests, and I'd highly recommend you to refer to the library which includes the DMA demo.

LPC18xx CMSIS-Compliant Standard Peripheral Firmware Driver Library (Keil, IAR) | www.LPCware.com 

Hope it helps.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,240 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Johannes Reif ,

Thank you for interest in NXP Semiconductor products and the opportunity to serve you.

I was wondering if you can tell me which chip you used.

I'm looking forward to your reply.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos