<?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: BIG BUG on  interrupt functionality :(</title>
		<link>http://forums.leaflabs.com/topic.php?id=714</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:17:20 +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=714" rel="self" type="application/rss+xml" />

		<item>
			<title>mbolivar on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4146</link>
			<pubDate>Mon, 04 Apr 2011 16:23:27 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">4146@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Roberto,&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
@mbolivar&#60;br /&#62;
What do you think about this bug ?
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;In short, &#34;What snigelen said&#34;.&#60;/p&#62;
&#60;p&#62;The EXTI lines mux together the corresponding GPIO bits, so you can't use PD14 and PE14 to serve different interrupts at the same time.&#60;/p&#62;
&#60;p&#62;Are you still having any other problems with external interrupts using the latest refactor code?  I found and fixed a few bugs while I was redoing that interface, so things should work better now.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>redfox74 on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4130</link>
			<pubDate>Mon, 04 Apr 2011 10:47:27 +0000</pubDate>
			<dc:creator>redfox74</dc:creator>
			<guid isPermaLink="false">4130@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;mhh I try to deactivate one of this two pin but the other don't start to  work .. now i check again :)&#60;br /&#62;
Best&#60;br /&#62;
Roberto
&#60;/p&#62;</description>
		</item>
		<item>
			<title>snigelen on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4129</link>
			<pubDate>Mon, 04 Apr 2011 10:05:57 +0000</pubDate>
			<dc:creator>snigelen</dc:creator>
			<guid isPermaLink="false">4129@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Yes, exactly. And that's why they say this on the LeafLabs EXTI-documentation:&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;In effect, this means that every pin on the Maple maps to a certain EXTI line, and within that EXTI line, only &#60;strong&#62;one&#60;/strong&#62; of the pins that maps to it can be used as an external interrupt at a time.&#60;/blockquote&#62;
 (my emphasis).
&#60;/p&#62;</description>
		</item>
		<item>
			<title>redfox74 on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4128</link>
			<pubDate>Mon, 04 Apr 2011 09:17:02 +0000</pubDate>
			<dc:creator>redfox74</dc:creator>
			<guid isPermaLink="false">4128@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi Snigelen do you mean that if i put all bit to 1111 the micro don't reply to all the PIN ?  PA14,PB14,PC14,PD14,PE14,PF14,PG14 ?&#60;br /&#62;
Best&#60;br /&#62;
Roberto
&#60;/p&#62;</description>
		</item>
		<item>
			<title>snigelen on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4127</link>
			<pubDate>Mon, 04 Apr 2011 08:31:13 +0000</pubDate>
			<dc:creator>snigelen</dc:creator>
			<guid isPermaLink="false">4127@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I think anton is right, each ext.int.line can only be connected to a given pin-number on _one_ port.&#60;/p&#62;
&#60;p&#62;You say &#34;The right configuration will be : EXTI14[3:0] 0111&#34;, but that isn't a valid number in that register (for the Maple, it may be valid on a larger device with more ports). According to the reference manual it's (i replaced x with 14 here):&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;EXTI14[3:0]: EXTI 14 configuration
These bits are written by software to select the source input for EXTI14 external interrupt.
0000: PA[14] pin
0001: PB[14] pin
0010: PC[14] pin
0011: PD[14] pin
0100: PE[14] pin
0101: PF[14] pin
0110: PG[14] pin&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;so the bit's isn't a bit mask, it's a port number. So you can only select one of them.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>redfox74 on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4126</link>
			<pubDate>Mon, 04 Apr 2011 08:08:30 +0000</pubDate>
			<dc:creator>redfox74</dc:creator>
			<guid isPermaLink="false">4126@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;@mbolivar&#60;br /&#62;
What do you think about this bug ?&#60;br /&#62;
Best&#60;br /&#62;
Roberto
&#60;/p&#62;</description>
		</item>
		<item>
			<title>redfox74 on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4125</link>
			<pubDate>Mon, 04 Apr 2011 08:06:14 +0000</pubDate>
			<dc:creator>redfox74</dc:creator>
			<guid isPermaLink="false">4125@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi Anton,&#60;br /&#62;
why the problem can't be solved ? The document of leaflab was Maple V5 that is medium density , I using High Density , native code ... in  the  doc &#60;/p&#62;
&#60;p&#62;The right configuration will be : EXTI14[3:0] 0111 ?&#60;br /&#62;
Is possible to activate all 2 pin togheter ? What do yo think ?&#60;br /&#62;
Best&#60;br /&#62;
Roberto
&#60;/p&#62;</description>
		</item>
		<item>
			<title>anton on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4124</link>
			<pubDate>Mon, 04 Apr 2011 05:34:30 +0000</pubDate>
			<dc:creator>anton</dc:creator>
			<guid isPermaLink="false">4124@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;PD14/PE14 problem can't be solved.&#60;br /&#62;
&#60;a href=&#34;http://leaflabs.com/docs/external-interrupts.html&#34; rel=&#34;nofollow&#34;&#62;http://leaflabs.com/docs/external-interrupts.html&#60;/a&#62;&#60;br /&#62;
&#60;a href=&#34;http://www.st.com/stonline/products/literature/rm/13902.pdf&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/stonline/products/literature/rm/13902.pdf&#60;/a&#62; page 192.&#60;/p&#62;
&#60;p&#62;Nibble of AFIO_EXTICRx corresponding to pin number&#60;br /&#62;
should be cleared before OR with new value.&#60;br /&#62;
pin = 14; port = 3; // PD14&#60;br /&#62;
__writexor(afio_regs[pin/4], (port &#38;lt;&#38;lt; ((pin % 4) * 4)));&#60;br /&#62;
writes 0x0300 to AFIO_EXTICR4&#60;br /&#62;
next after&#60;br /&#62;
pin = 14; port = 4; // PE14&#60;br /&#62;
__writexor(afio_regs[pin/4], (port &#38;lt;&#38;lt; ((pin % 4) * 4)));&#60;br /&#62;
AFIO_EXTICR4 contents invalid value 0x0700 instead of 0x0400
&#60;/p&#62;</description>
		</item>
		<item>
			<title>redfox74 on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4123</link>
			<pubDate>Mon, 04 Apr 2011 05:11:02 +0000</pubDate>
			<dc:creator>redfox74</dc:creator>
			<guid isPermaLink="false">4123@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I Try your patch , but don't work and don't solve the problem of PD14 and PE14&#60;/p&#62;
&#60;p&#62;afio_regs[pin/4] &#38;amp;= ~(0xF &#38;lt;&#38;lt; ((pin % 4) * 4));&#60;br /&#62;
afio_regs[pin/4] &#124;= (port &#38;lt;&#38;lt; ((pin % 4) * 4));&#60;/p&#62;
&#60;p&#62;This is my code &#60;/p&#62;
&#60;p&#62;#define __write(reg, value)      (*(volatile uint32*)(reg) = (value)) // old write&#60;br /&#62;
#define __writexor(reg, value)      (*(volatile uint32*)(reg) &#124;= (value)) // write with or in register.&#60;br /&#62;
Best&#60;br /&#62;
Roberto
&#60;/p&#62;</description>
		</item>
		<item>
			<title>anton on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4121</link>
			<pubDate>Sun, 03 Apr 2011 22:25:23 +0000</pubDate>
			<dc:creator>anton</dc:creator>
			<guid isPermaLink="false">4121@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;If you call attach_interript with &#124;= for PD14 and PE14 it will connect 14 exti chanel to missing PH14 pin.&#60;br /&#62;
And this bug is patched in the refactor branch:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;void afio_exti_select(afio_exti_num exti, afio_exti_port gpio_port) {
    __io uint32 *exti_cr = &#38;amp;AFIO_BASE-&#38;gt;EXTICR1 + exti / 4;
    uint32 shift = 4 * (exti % 4);
    uint32 cr = *exti_cr;

    cr &#38;amp;= ~(AFIO_EXTI_SEL_MASK &#38;lt;&#38;lt; shift);
    cr &#124;= gpio_port &#38;lt;&#38;lt; shift;
    *exti_cr = cr;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>anton on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4120</link>
			<pubDate>Sun, 03 Apr 2011 20:13:23 +0000</pubDate>
			<dc:creator>anton</dc:creator>
			<guid isPermaLink="false">4120@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Yes, there is 16 EXTI cannels and chanel number corresponds pin number. attach_interript with the same pin number rewrites AFIO_EXTICRx.&#60;br /&#62;
I'll try your patch.&#60;br /&#62;
I think it should look like&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;afio_regs[pin/4] &#38;amp;= ~(0xF &#38;lt;&#38;lt; ((pin % 4) * 4));
afio_regs[pin/4] &#124;= (port &#38;lt;&#38;lt; ((pin % 4) * 4));&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>redfox74 on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4119</link>
			<pubDate>Sun, 03 Apr 2011 19:01:25 +0000</pubDate>
			<dc:creator>redfox74</dc:creator>
			<guid isPermaLink="false">4119@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I doing the test ..&#60;br /&#62;
So it's better of my last test , now there're only 2 pin that don' work under interrupt pin 89 and pin 57 that correspond at :&#60;br /&#62;
PD14 and PE14 ... mhhh the two pin are 14 ... ?!? Could be this the answer at my problem .&#60;br /&#62;
Tomorrow will check ... my 2 cents to this good project ;)&#60;br /&#62;
Best&#60;br /&#62;
Roberto
&#60;/p&#62;</description>
		</item>
		<item>
			<title>redfox74 on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4118</link>
			<pubDate>Sun, 03 Apr 2011 18:02:43 +0000</pubDate>
			<dc:creator>redfox74</dc:creator>
			<guid isPermaLink="false">4118@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Dear Friends,&#60;br /&#62;
I found the problem in __write function , it update the register only with the last pin and don't doing an &#124;= xor with other pin yet set.&#60;br /&#62;
This is the patch ...&#60;/p&#62;
&#60;p&#62;    uint32 channel = pin;&#60;/p&#62;
&#60;p&#62;    /* map port to channel */&#60;br /&#62;
//    __write(afio_regs[pin/4], (port &#38;lt;&#38;lt; ((pin % 4) * 4)));&#60;br /&#62;
    __writexor(afio_regs[pin/4], (port &#38;lt;&#38;lt; ((pin % 4) * 4))); // i add in util.h the function #define __writexor(reg, value)      (*(volatile uint32*)(reg) &#124;= (value)) add an or ... so is better of first test .. but i think that there are other problem again ...&#60;/p&#62;
&#60;p&#62;    /* Unmask appropriate interrupt line  */&#60;br /&#62;
    __set_bits(EXTI_IMR, BIT(channel));
&#60;/p&#62;</description>
		</item>
		<item>
			<title>redfox74 on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4116</link>
			<pubDate>Sun, 03 Apr 2011 07:13:18 +0000</pubDate>
			<dc:creator>redfox74</dc:creator>
			<guid isPermaLink="false">4116@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Can other people doing the test on Maple V5 ?&#60;br /&#62;
Best&#60;br /&#62;
Roberto
&#60;/p&#62;</description>
		</item>
		<item>
			<title>redfox74 on "BIG BUG on  interrupt functionality :("</title>
			<link>http://forums.leaflabs.com/topic.php?id=714#post-4114</link>
			<pubDate>Sat, 02 Apr 2011 19:24:49 +0000</pubDate>
			<dc:creator>redfox74</dc:creator>
			<guid isPermaLink="false">4114@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;So i testing a functionality for manage a multiple interrupt on more port ... the code is simple :&#60;/p&#62;
&#60;p&#62;#define CH1 22&#60;br /&#62;
#define CH2 23&#60;br /&#62;
#define CH3 24&#60;br /&#62;
#define CH4 89&#60;br /&#62;
#define CH5 59&#60;br /&#62;
#define CH6 62&#60;br /&#62;
#define CH7 57&#60;br /&#62;
#define CH8 60&#60;/p&#62;
&#60;p&#62;void rx1(void)&#60;br /&#62;
{&#60;br /&#62;
		if (digitalRead(CH1))&#60;br /&#62;
		{&#60;br /&#62;
        Serial4.print(&#34;1UP&#34;);&#60;br /&#62;
		}&#60;br /&#62;
		else&#60;br /&#62;
		{&#60;br /&#62;
		Serial4.print(&#34;1DOWN&#34;);&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;void rx2(void)&#60;br /&#62;
{&#60;br /&#62;
		if (digitalRead(CH2))&#60;br /&#62;
		{&#60;br /&#62;
        Serial4.print(&#34;2UP&#34;);&#60;br /&#62;
		}&#60;br /&#62;
		else&#60;br /&#62;
		{&#60;br /&#62;
		Serial4.print(&#34;2DOWN&#34;);&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;}&#60;br /&#62;
void rx3(void)&#60;br /&#62;
{&#60;br /&#62;
		if (digitalRead(CH3))&#60;br /&#62;
		{&#60;br /&#62;
        Serial4.print(&#34;3UP&#34;);&#60;br /&#62;
		}&#60;br /&#62;
		else&#60;br /&#62;
		{&#60;br /&#62;
		Serial4.print(&#34;3DOWN&#34;);&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;}&#60;br /&#62;
void rx4(void)&#60;br /&#62;
{&#60;br /&#62;
		if (digitalRead(CH4))&#60;br /&#62;
		{&#60;br /&#62;
        Serial4.print(&#34;4UP&#34;);&#60;br /&#62;
		}&#60;br /&#62;
		else&#60;br /&#62;
		{&#60;br /&#62;
		Serial4.print(&#34;4DOWN&#34;);&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;}&#60;br /&#62;
void rx5(void)&#60;br /&#62;
{&#60;br /&#62;
		if (digitalRead(CH5))&#60;br /&#62;
		{&#60;br /&#62;
        Serial4.print(&#34;5UP&#34;);&#60;br /&#62;
		}&#60;br /&#62;
		else&#60;br /&#62;
		{&#60;br /&#62;
		Serial4.print(&#34;5DOWN&#34;);&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;}&#60;br /&#62;
void rx6(void)&#60;br /&#62;
{&#60;br /&#62;
		if (digitalRead(CH6))&#60;br /&#62;
		{&#60;br /&#62;
        Serial4.print(&#34;6UP&#34;);&#60;br /&#62;
		}&#60;br /&#62;
		else&#60;br /&#62;
		{&#60;br /&#62;
		Serial4.print(&#34;7DOWN&#34;);&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;}&#60;br /&#62;
void rx7(void)&#60;br /&#62;
{&#60;br /&#62;
		if (digitalRead(CH7))&#60;br /&#62;
		{&#60;br /&#62;
        Serial4.print(&#34;7UP&#34;);&#60;br /&#62;
		}&#60;br /&#62;
		else&#60;br /&#62;
		{&#60;br /&#62;
		Serial4.print(&#34;7DOWN&#34;);&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;pinMode(CH1,INPUT);&#60;br /&#62;
pinMode(CH2,INPUT);&#60;br /&#62;
pinMode(CH3,INPUT);&#60;br /&#62;
pinMode(CH4,INPUT);&#60;br /&#62;
pinMode(CH5,INPUT);&#60;br /&#62;
pinMode(CH6,INPUT);&#60;br /&#62;
pinMode(CH7,INPUT);&#60;br /&#62;
pinMode(CH8,INPUT);&#60;/p&#62;
&#60;p&#62;attachInterrupt(CH1, rx1, RISING);&#60;br /&#62;
attachInterrupt(CH2, rx2, RISING);&#60;br /&#62;
attachInterrupt(CH3, rx3, RISING);&#60;br /&#62;
attachInterrupt(CH4, rx4, RISING);&#60;br /&#62;
attachInterrupt(CH5, rx5, RISING);&#60;br /&#62;
attachInterrupt(CH6, rx6, RISING);&#60;br /&#62;
attachInterrupt(CH7, rx7, RISING);&#60;/p&#62;
&#60;p&#62;If i activate all interrupt ... only CH1 CH2 CH3 CH7 work fine , the other interrupt don't work ... channel CH4 CH5 Ch6  not working properly.&#60;/p&#62;
&#60;p&#62;Instead if i activate only one channel and test all pin the interrupt function work fine ... when i testing all interrupt i check only 1 input port then the other input port ecc don't all port togheter .. &#60;/p&#62;
&#60;p&#62;So Where is the problem ? My idea is that there re some problem on exti.c&#60;br /&#62;
in this portion of code :&#60;/p&#62;
&#60;p&#62;void __irq_exti9_5(void) {&#60;br /&#62;
    /* Figure out which channel it came from  */&#60;br /&#62;
    uint32 pending;&#60;br /&#62;
    uint32 i;&#60;br /&#62;
    pending = REG_GET(EXTI_PR);&#60;br /&#62;
    pending = GET_BITS(pending, 5, 9);&#60;/p&#62;
&#60;p&#62;    /* Dispatch every handler if the pending bit is set */&#60;br /&#62;
    for (i = 0; i &#38;lt; 5; i++) {&#60;br /&#62;
        if (pending &#38;amp; 0x1) {&#60;br /&#62;
            dispatch_handler(EXTI5 + i);&#60;br /&#62;
            clear_pending(EXTI5 + i);&#60;br /&#62;
        }&#60;br /&#62;
        pending &#38;gt;&#38;gt;= 1;&#60;br /&#62;
    }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void __irq_exti15_10(void) {&#60;br /&#62;
    /* Figure out which channel it came from  */&#60;br /&#62;
    uint32 pending;&#60;br /&#62;
    uint32 i;&#60;br /&#62;
    pending = REG_GET(EXTI_PR);&#60;br /&#62;
    pending = GET_BITS(pending, 10, 15);&#60;/p&#62;
&#60;p&#62;    /* Dispatch every handler if the pending bit is set */&#60;br /&#62;
    for (i = 0; i &#38;lt; 6; i++) {&#60;br /&#62;
        if (pending &#38;amp; 0x1) {&#60;br /&#62;
            dispatch_handler(EXTI10 + i);&#60;br /&#62;
            clear_pending(EXTI10 + i);&#60;br /&#62;
        }&#60;br /&#62;
        pending &#38;gt;&#38;gt;= 1;&#60;br /&#62;
    }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;Best&#60;br /&#62;
Roberto
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
