<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: Pulse Width capture via Timer Input Capture via DMA</title>
		<link>http://forums.leaflabs.com/topic.php?id=1170</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:18:29 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=1170" rel="self" type="application/rss+xml" />

		<item>
			<title>Jairo on "Pulse Width capture via Timer Input Capture via DMA"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1170#post-7474</link>
			<pubDate>Thu, 29 Dec 2011 20:16:17 +0000</pubDate>
			<dc:creator>Jairo</dc:creator>
			<guid isPermaLink="false">7474@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;argh!  seems to have been an electrical problem.  The jumper cable carrying the PPM signals wasn't making good contact with the input pin on the maple mini.  either way, thanks for your help.  it probably would have taken me a longer to figure out what was going on if I didn't split up troubleshooting the timer and dma.&#60;/p&#62;
&#60;p&#62;good luck with your timer to spi-tx dma transfer
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Dweller on "Pulse Width capture via Timer Input Capture via DMA"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1170#post-7472</link>
			<pubDate>Thu, 29 Dec 2011 09:12:04 +0000</pubDate>
			<dc:creator>Dweller</dc:creator>
			<guid isPermaLink="false">7472@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;had a quick look.. didn't verify your bit/register assignments as don't have the datasheet handy here.. &#60;/p&#62;
&#60;p&#62;I'm guessing you've remembered to swap the input pin to one that timer 4 can use, and have looked up the timer input you have to set with the bits.. (I was using TI1 with timer 1/ch1) .. &#60;/p&#62;
&#60;p&#62;also.. try the test without dma.. comment out the dma bits, dont set the dma enable bit, and busy poll on the timer capture&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;//If we weren&#38;#39;t using DMA, we could busy wait on the CC1IF bit in SR
//
//when the timer captures, the CC1IF bit will be set on the timer SR register.
//CC1IF bit is bit 1 (page 332)
while(!bitRead(r.adv-&#38;gt;SR, 1)){
}
SerialUSB.println(&#38;quot;Timer triggered : &#38;quot;);
SerialUSB.println(r.adv-&#38;gt;CCR1);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;If it works with busy poll then its your dma setup that needs fixing, if not, then there's still something to fix with the timer.&#60;/p&#62;
&#60;p&#62;I could never quite work out what actually started the transfers.. but I think the first few values I got were iffy.. but I always did the setup &#38;amp; start very close together.. &#60;/p&#62;
&#60;p&#62;I used internal pullups, (input_pullup), hopefully your circuit has externally sorted that as you just have input&#60;/p&#62;
&#60;p&#62;Otherwise, nice to see the code was helpful to someone =)&#60;/p&#62;
&#60;p&#62;When I get back to my board, I've got to make it DMA from the timer capture, across to the SPI TX.. =)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Jairo on "Pulse Width capture via Timer Input Capture via DMA"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1170#post-7468</link>
			<pubDate>Wed, 28 Dec 2011 19:09:22 +0000</pubDate>
			<dc:creator>Jairo</dc:creator>
			<guid isPermaLink="false">7468@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Dweller,&#60;br /&#62;
Well, first of all, I'd like to thank you for sharing this piece of code.  I ported it for use with the maple mini board and it works like a charm.  Most of what I had to change was the pin for timer1/channel1 on the maple mini (d27).   The other changes I made correspond to changes needed to interface the maple mini with a PPM signal.  What I did was to change the number of TIMERS to only 9, and added the DMA_CIRC_MODE bit to the dma_setup_transfer call (allows to capture &#34;num_transfers&#34; and repeat).&#60;/p&#62;
&#60;p&#62;I'm now trying to change the code to capture the timer values on Timer4, Channel 1.  The changes I made for this are trivial (use &#60;code&#62;HardwareTimer(4)&#60;/code&#62; instead of &#60;code&#62;HardwareTimer(1)&#60;/code&#62;), but I'm not having any luck capturing and printing the timer values.  &#60;/p&#62;
&#60;p&#62;A difference between timer1 and timer4 is that timer4 is a general purpose timer, while timer1 is and advanced timer.  This, however, should not have any functional effect.  The registers all exist under &#60;code&#62;r.gen&#60;/code&#62; (same as &#60;code&#62;r.adv&#60;/code&#62; in the original code).  &#60;/p&#62;
&#60;p&#62;If anybody could look at the code here &#60;a href=&#34;http://pastebin.com/dUjysqwt&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/dUjysqwt&#60;/a&#62; and see if you can spot any obvious mistakes I'd appreciate it.  I'm breaking my head over this, as it all seems right...  specifically look at the functions &#60;code&#62;init_timer_input_capture_dma()&#60;/code&#62; and &#60;code&#62;dma_isr()&#60;/code&#62; which setup the timer and handle the dma request.  &#60;/p&#62;
&#60;p&#62;Jairo
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Dweller on "Pulse Width capture via Timer Input Capture via DMA"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1170#post-7151</link>
			<pubDate>Sat, 12 Nov 2011 09:19:04 +0000</pubDate>
			<dc:creator>Dweller</dc:creator>
			<guid isPermaLink="false">7151@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I just got timer input capture running via DMA, something I've been trying to get working to see if I could free up a bit more cpu to process the captured pulse widths.. &#60;/p&#62;
&#60;p&#62;In case it's of interest to others, here's the code.. I had to play a little with registers to setup input capture, as that's not in timer.h/HardwareTimer yet.. (and this is my first bit of maple code that required reading the datasheet, so I've probably messed up somewhere!) comments welcome =) &#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://pastebin.com/NQtbVCFh&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/NQtbVCFh&#60;/a&#62;
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
