<?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; User Favorites: drinkdhmo</title>
		<link><a href='http://forums.leaflabs.com/profile.php?id=582'>582</a></link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:22:57 +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?profile=582" rel="self" type="application/rss+xml" />

		<item>
			<title>nickbike on "hardware quadrature decoding issues"</title>
			<link>http://forums.leaflabs.com/topic.php?id=110#post-10492</link>
			<pubDate>Fri, 04 May 2012 21:45:38 +0000</pubDate>
			<dc:creator>nickbike</dc:creator>
			<guid isPermaLink="false">10492@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I know this post is old, but I have the same request as josiah47. Can some please post a little more code? Maybe something that requests the encoder count and prints to the screen once a second.&#60;br /&#62;
Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>josiah47 on "hardware quadrature decoding issues"</title>
			<link>http://forums.leaflabs.com/topic.php?id=110#post-4910</link>
			<pubDate>Tue, 31 May 2011 12:02:10 +0000</pubDate>
			<dc:creator>josiah47</dc:creator>
			<guid isPermaLink="false">4910@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;drinkdhmo, can you provide the model of the encoder you are using and maybe even the full code for the quadrature encoding? or at least just the encoding parts.&#60;/p&#62;
&#60;p&#62;Thanks
&#60;/p&#62;</description>
		</item>
		<item>
			<title>drinkdhmo on "hardware quadrature decoding issues"</title>
			<link>http://forums.leaflabs.com/topic.php?id=110#post-668</link>
			<pubDate>Tue, 03 Aug 2010 16:53:04 +0000</pubDate>
			<dc:creator>drinkdhmo</dc:creator>
			<guid isPermaLink="false">668@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thank you bnewbold!!! That link helped me find a post that showed me the proper register settings to get full (4x) quadrature decoding. Here is the code I used to set up the timer:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;Timer* encoderTimer;
  encoderTimer = (Timer*)TIMER4_BASE;
  encoderTimer-&#38;gt;CCMR1 = 0xF1F1;
  encoderTimer-&#38;gt;CCMR2 = 0x0000;
  encoderTimer-&#38;gt;CCER = 0x0011;
  encoderTimer-&#38;gt;SMCR = 0x0003;
  encoderTimer-&#38;gt;CR1 = 0x0001;
  encoderTimer-&#38;gt;CR2 = 0x0000;
  encoderTimer-&#38;gt;PSC = 0x0000;
  encoderTimer-&#38;gt;CNT = 0x0000;  //reset the counter before we use it&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;The encoder CHa and CHb pins are connected to Maple pins 5 and 9 respectively.&#60;/p&#62;
&#60;p&#62;Here is where I found the post that steered me in the right direction:&#60;br /&#62;
&#60;a href=&#34;https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Flat.aspx?RootFolder=https%3a%2f%2fmy.st.com%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fARM%20CortexM3%20STM32%2fEncoder%20interface%205793&#38;amp;FolderCTID=0x01200200770978C69A1141439FE559EB459D758000626BE2B829C32145B9EB5739142DC17E&#38;amp;currentviews=615&#34; rel=&#34;nofollow&#34;&#62;https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Flat.aspx?RootFolder=https%3a%2f%2fmy.st.com%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fARM%20CortexM3%20STM32%2fEncoder%20interface%205793&#38;amp;FolderCTID=0x01200200770978C69A1141439FE559EB459D758000626BE2B829C32145B9EB5739142DC17E&#38;amp;currentviews=615&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bnewbold on "hardware quadrature decoding issues"</title>
			<link>http://forums.leaflabs.com/topic.php?id=110#post-663</link>
			<pubDate>Tue, 03 Aug 2010 00:27:28 +0000</pubDate>
			<dc:creator>bnewbold</dc:creator>
			<guid isPermaLink="false">663@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hey drinkhmo!&#60;/p&#62;
&#60;p&#62;Sorry we didn't get back to you faster... I don't have a quad encoder in hand so I can't test your code on the bench. I also don't see an application note which is too bad. It does look like others have gotten quad encoder inputs working on STM32s, so it should be possible (&#60;a href=&#34;https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Extend%20Quadrature%20Encoder%2016-bit%20register&#38;amp;FolderCTID=0x01200200770978C69A1141439FE559EB459D758000626BE2B829C32145B9EB5739142DC17E&#38;amp;currentviews=157&#34; rel=&#34;nofollow&#34;&#62;https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Extend%20Quadrature%20Encoder%2016-bit%20register&#38;amp;FolderCTID=0x01200200770978C69A1141439FE559EB459D758000626BE2B829C32145B9EB5739142DC17E&#38;amp;currentviews=157&#60;/a&#62; ).&#60;/p&#62;
&#60;p&#62;If you're still stuck I can poke through your full code and see if you have any typos.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>drinkdhmo on "hardware quadrature decoding issues"</title>
			<link>http://forums.leaflabs.com/topic.php?id=110#post-629</link>
			<pubDate>Tue, 27 Jul 2010 13:07:25 +0000</pubDate>
			<dc:creator>drinkdhmo</dc:creator>
			<guid isPermaLink="false">629@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I am using the Maple to read a quadrature encoder. I followed the instructions in the STM Reference Manual on pages 360-362 and got things working. I can hook up an encoder to channels 1 and 2 of a timer (timer 4 in my case) and the counter is able to count the pulses from the encoder. This works very well, except that I need 4x decoding, and it appears that I can only get 1x (TIM4_SMCR:SMS=001) and 2x (TIM4_SMCR:SMS=011) decoding, meaning that the counter is only clocking on rising edges. However, the Reference Manual implies that it is possible to clock on rising and falling edges (see Figure 134).&#60;/p&#62;
&#60;p&#62;Here is my code that I use to set up the timer:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;Timer* encoderTimer;
encoderTimer = (Timer*)TIMER4_BASE;
encoderTimer-&#38;gt;CCMR1 &#124;= 0x0001;    //CC1S=01
encoderTimer-&#38;gt;CCMR1 &#38;amp;= ~(0x0002);
encoderTimer-&#38;gt;CCMR1 &#124;= 0x0100;    //CC2S=01
encoderTimer-&#38;gt;CCMR1 &#38;amp;= ~(0x0200);
encoderTimer-&#38;gt;CCER &#38;amp;= ~(0x0002);  //CC1P=0
encoderTimer-&#38;gt;CCER &#38;amp;= ~(0x0020);  //CC2P=0
encoderTimer-&#38;gt;SMCR &#124;= 0x0003;    //SMS=011
encoderTimer-&#38;gt;SMCR &#38;amp;= ~(0x0004);
encoderTimer-&#38;gt;SMCR &#38;amp;= ~(0x0F00);  //no filter
encoderTimer-&#38;gt;CR1 &#124;= 0x0001;     //CEN=1
encoderTimer-&#38;gt;CNT = 0x0000;  //reset the counter before we use it&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
