<?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: Maple mini and Vin pin</title>
		<link>http://forums.leaflabs.com/topic.php?id=836</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:13:09 +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=836" rel="self" type="application/rss+xml" />

		<item>
			<title>gbulmer on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5142</link>
			<pubDate>Sat, 11 Jun 2011 15:21:08 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">5142@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Assuming something is causing a spurious interrupt when powered from the barrel jack, what is the power source?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5141</link>
			<pubDate>Sat, 11 Jun 2011 14:11:53 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">5141@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I'm glad one of the problems is solved.  Thanks are actually due to Perry, who dug through the code and noticed that the function usbDsbISR(), called by disableUSB(), did not in fact disable the ISR.  Oops.  Sorry about that.&#60;/p&#62;
&#60;p&#62;I'll try a simple experiment to see if I can verify Perry's conjecture about spurious interrupts, and push a fix once I feel more confident that I understand what's going on.&#60;/p&#62;
&#60;p&#62;Not sure exactly what you mean about the performance being different depending on what's displayed on the screen.  That's weird.  Do you have a smaller example which doesn't rely on LiquidCrystal?&#60;/p&#62;
&#60;p&#62;And coincidentally enough, robodude, I also may have run into this problem, on the Maple.  I hacked together a couple of VGA driver demos that didn't work properly when the Maple was powered from the barrel jack, but ran just fine when it was powered from USB.  At the time, I was in a hurry (we needed the demos for maker faire) and I just plugged it into USB and forgot all about it.&#60;/p&#62;
&#60;p&#62;The programs manually toggled the GPIOs which were connected to the monitor's color lines as quickly as possible for each horizontal line.  They played the usual trick of spending a little time thinking about the next frame after they'd finished drawing a line, but before the next timer interrupt which triggered an hsync.  I figured out how much time each could spend on this by experiment, just doing more work until they weren't done quickly enough and the display got messed up.  This worked just fine whenever the Maple was plugged in to USB, but would glitch reliably when powered off of a barrel jack.  I had called SerialUSB.end().&#60;/p&#62;
&#60;p&#62;Here they are, for reference; (at time of writing) they're written against an old version of libmaple, so no idea if they'll still run:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/leaflabs/projects/tree/master/vga-colors/&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/projects/tree/master/vga-colors/&#60;/a&#62;&#60;br /&#62;
&#60;a href=&#34;https://github.com/leaflabs/projects/blob/master/vga-pong/&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/projects/blob/master/vga-pong/&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>robodude666 on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5136</link>
			<pubDate>Sat, 11 Jun 2011 08:17:04 +0000</pubDate>
			<dc:creator>robodude666</dc:creator>
			<guid isPermaLink="false">5136@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Maybe monitor what Vcc actually is during the two different power configurations? I know there is a 3.3v regulator, and the STM32 can support a range of input voltages, but it may affect performance.  Have you tried using USB only, or an external bench top supply for Vin instead of a USB cable? Your (white) USB cable may not be properly grounded, or something... Maybe use a benchtop supply and play with Vin to see how its increase/decrease can affect performance.&#60;/p&#62;
&#60;p&#62;Have you tested for this phenomenon on a regular Maple board? Possibly try some additional tests that stress other features of the STM32? A change in performance of 0.25% is rather small and could simply be a coincidence rather than an actual problem.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Xavier on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5134</link>
			<pubDate>Sat, 11 Jun 2011 03:04:21 +0000</pubDate>
			<dc:creator>Xavier</dc:creator>
			<guid isPermaLink="false">5134@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Well done marti ! You found it !&#60;/p&#62;
&#60;p&#62;With the nvic_irq_disable, the performance is very robust.&#60;br /&#62;
It does not depend anymore in the direct USB plug. And do not change anymore when i touch the metal part.&#60;br /&#62;
So this need to be disable when the maple mini USB pins are open.&#60;/p&#62;
&#60;p&#62;Now if you have any idea why the perf depend on what is displayed on the screen ?&#60;br /&#62;
e.g: if i comment the 3 setCursor/print in the setup, i get 90 cpts more...&#60;br /&#62;
I also see a small diffirence when cpt shows up between 0-9 then 10-99 then 100-999. 1 caracter more to display.&#60;/p&#62;
&#60;p&#62;Xavier
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5127</link>
			<pubDate>Fri, 10 Jun 2011 17:28:22 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">5127@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Xavier,&#60;/p&#62;
&#60;p&#62;Try adding the line &#34;nvic_irq_disable(NVIC_USB_LP_CAN_RX0);&#34; to your setup().&#60;/p&#62;
&#60;p&#62;Edit: you may need to #include &#34;nvic.h&#34;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Xavier on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5126</link>
			<pubDate>Fri, 10 Jun 2011 16:02:22 +0000</pubDate>
			<dc:creator>Xavier</dc:creator>
			<guid isPermaLink="false">5126@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks for your answers.&#60;br /&#62;
I added SerialUSB.end(), that does not change anything.&#60;br /&#62;
I also removed the Serial*.isAvailable() part which didn't change the result.&#60;/p&#62;
&#60;p&#62;Here is a short video :&#60;br /&#62;
&#60;a href=&#34;http://www.youtube.com/watch?v=2iI6UtWRg20&#34; rel=&#34;nofollow&#34;&#62;http://www.youtube.com/watch?v=2iI6UtWRg20&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;&#34;cpt : 526185&#34; with Vin + usb&#60;br /&#62;
Less then 525000 with Vin Only.&#60;/p&#62;
&#60;p&#62;That's 0.25% difference. Not sure it will annoy anyone.&#60;br /&#62;
That's not anymore a problem for me, so track this strange thing only if you think it's worth it.&#60;/p&#62;
&#60;p&#62;Thanks,&#60;/p&#62;
&#60;p&#62;Xavier
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5121</link>
			<pubDate>Fri, 10 Jun 2011 14:23:03 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">5121@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I was thinking perhaps the PLL that boosts the 8MHz crystal up toe 72MHz could be failing if there was a problem with the power supply, but the init routine for the PLL is a blocking one, and wont return until it achieves a stable 72MHz - so...throw that one out. &#60;/p&#62;
&#60;p&#62;But yea, how does SerialUsb.end() or disableUSB (you might need #include &#34;usb.h&#34; for that) turn out for you?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>perry on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5072</link>
			<pubDate>Wed, 08 Jun 2011 16:58:58 +0000</pubDate>
			<dc:creator>perry</dc:creator>
			<guid isPermaLink="false">5072@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Xavier,&#60;/p&#62;
&#60;p&#62;Can you disable the USB (disableUSB()) in setup() and see if this changes your results? My theory is that maybe spurious USB interrupts are being generated, glitching your timing. Touching the metal probably bleeds charge off and reduces the amount of spurious interrupts.&#60;/p&#62;
&#60;p&#62;Totally a guess, but worth a try.&#60;/p&#62;
&#60;p&#62;-perry
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Xavier on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5070</link>
			<pubDate>Wed, 08 Jun 2011 16:31:35 +0000</pubDate>
			<dc:creator>Xavier</dc:creator>
			<guid isPermaLink="false">5070@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Yes... Very strange.. is the quartz sensitive to ground noise ? (Not sure that makes sens ;-)&#60;/p&#62;
&#60;p&#62;It's not anymore a blocker for my project, I now insert the samples in a ringbuffer in the main loop and the sound interupt simply picks value from it. That makes things more robust and less sensitive to short performance variation...&#60;br /&#62;
So it works with the external USB power.&#60;/p&#62;
&#60;p&#62;Thanks,&#60;/p&#62;
&#60;p&#62;Xavier
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5063</link>
			<pubDate>Wed, 08 Jun 2011 15:46:01 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">5063@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Xavier,&#60;/p&#62;
&#60;p&#62;Very strange.  Thanks very much for the sample code; it's good of you to take the time.  We'll reproduce and try to figure it out.&#60;/p&#62;
&#60;p&#62;Edit: Bugtracker reference: &#60;a href=&#34;http://code.google.com/p/leaflabs/issues/detail?id=73&#34; rel=&#34;nofollow&#34;&#62;http://code.google.com/p/leaflabs/issues/detail?id=73&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Xavier on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5046</link>
			<pubDate>Tue, 07 Jun 2011 16:42:42 +0000</pubDate>
			<dc:creator>Xavier</dc:creator>
			<guid isPermaLink="false">5046@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;More information on Problem 2....&#60;br /&#62;
The following program makes this obvious even if it's subtil in this case. ('result' is here just to have the CPU doing something... 'cpt' is the only important information.&#60;br /&#62;
When powered directly cpt has a very stable value between 401378 and 401380.&#60;br /&#62;
When powered through Vin : cpt shows up around 401285... &#60;/p&#62;
&#60;p&#62;A very strange thing, when powered through Vin, with a USB cable plugged in the maple mini but not plugged on the other side. Touching the metal part on the unplugged side make the cpt value changing obviously. I saw value down to 350.000 for a short time.&#60;/p&#62;
&#60;p&#62;Any idea ???&#60;br /&#62;
Any explaination ?&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;#include &#38;quot;wirish.h&#38;quot;
#include &#38;quot;libmaple.h&#38;quot;
#include &#38;quot;LiquidCrystal.h&#38;quot;

LiquidCrystal      lcd(2,8,3,4,5,6,7, 27,26,25, 22);

long test[2048];

void setup() {
    lcd.begin(20, 4);
    lcd.setCursor(0,0);
    lcd.print(&#38;quot;Test Perf&#38;quot;);
    lcd.setCursor(0,1);
    lcd.print(&#38;quot;--&#38;gt; : &#38;quot;);
    lcd.setCursor(0,2);
    lcd.print(&#38;quot;res : &#38;quot;);
    lcd.setCursor(0,3);
    lcd.print(&#38;quot;cpt : &#38;quot;);

    for (int k=0; k&#38;lt;2048; k++) {
        test[k] = random(1000);
    } 

    Serial3.begin(31250);
}

long getValueFrom3(long l) {
    return test[(l+512)%1024];
}

long getValueFrom2(long l) {
    return test[(l+43)%2048] + getValueFrom3(l);
}

long getValueFrom(long l) {
    return test[l%2048] + getValueFrom2(l);
}

int iter = 0;

void loop() {
    iter++;
    unsigned int t = millis();
    long cpt = 0;
    long result = 0;
    while ((millis() - t) &#38;lt; 1024) {
        result += getValueFrom(cpt);
        cpt ++;
        if (Serial3.available() &#38;amp;&#38;amp; Serial1.available() &#38;amp;&#38;amp; Serial2.available()) {
            result ++;
        }
    }

    lcd.setCursor(7,1);
    lcd.print(iter);
    lcd.setCursor(7,2);
    lcd.print(result);
    lcd.setCursor(7,3);
    lcd.print(cpt);
}

// Force init to be called *first*, i.e. before static object allocation.
// Otherwise, statically allocated object that need libmaple may fail.
__attribute__(( constructor )) void premain() {
    init();
}

int main(void)
{
    setup();

    while (1) {
        loop();
    }
    return 0;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Update : sample code modified
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Xavier on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5028</link>
			<pubDate>Tue, 07 Jun 2011 02:10:45 +0000</pubDate>
			<dc:creator>Xavier</dc:creator>
			<guid isPermaLink="false">5028@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks for the clarification.&#60;br /&#62;
But problem 1 was not a blocker.&#60;/p&#62;
&#60;p&#62;Any idea on problem 2 which is much more ennoying for me.&#60;/p&#62;
&#60;p&#62;Xavier
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5003</link>
			<pubDate>Mon, 06 Jun 2011 16:59:04 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">5003@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Yes, there was a change on Maple Mini that I think will be reverted on a future design rev. Vin on Maple Mini is intended to be an input pin, not an input/output like on Maple. There is a protection Diode on Vin which will drop .7V as well as prevent Vin from being an output. &#60;/p&#62;
&#60;p&#62;If you need to use Vin as an output (to get 5V from USB) you remove and jump the input diode on Vin. &#60;/p&#62;
&#60;p&#62;I agree, this was a mistake in heindsight, but it was intentional.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Xavier on "Maple mini and Vin pin"</title>
			<link>http://forums.leaflabs.com/topic.php?id=836#post-5001</link>
			<pubDate>Mon, 06 Jun 2011 16:42:37 +0000</pubDate>
			<dc:creator>Xavier</dc:creator>
			<guid isPermaLink="false">5001@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;I have 2 strange behaviors with the Vin pin of the maple mini.&#60;/p&#62;
&#60;p&#62;1 - When the maple mini is powered with the built-in USB the Vin pin voltage is only 4V and cannot power my 5V LiquidCrystal compatible LCD.&#60;br /&#62;
In the same situation, the regular maple Vin voltage is 5V and can power my LCD.&#60;/p&#62;
&#60;p&#62;2 - When powered through Vin with an external USB connection (5V) the maple mini seem to be slower.&#60;br /&#62;
With my synth, when powered through Vin, i can hear many audio glitches when the maximum number of voices is played (maximum cpu usage) and the engine often crash.&#60;br /&#62;
As soon as i pluged a USB directly in the mini, every things works perfectly. I can reproduce it again and again.&#60;/p&#62;
&#60;p&#62;Anything i do wrong, any thing i can try ?&#60;/p&#62;
&#60;p&#62;Thanks,&#60;/p&#62;
&#60;p&#62;Xavier
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
