<?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: What challanges would I face moving from Arduino?</title>
		<link>http://forums.leaflabs.com/topic.php?id=1022</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:21:14 +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=1022" rel="self" type="application/rss+xml" />

		<item>
			<title>poslathian on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6309</link>
			<pubDate>Mon, 12 Sep 2011 13:57:34 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">6309@http://forums.leaflabs.com/</guid>
			<description>&#60;blockquote&#62;&#60;p&#62;Wow guys, thanks for all the input, I already feel much better about switching&#60;br /&#62;
with this kind of response.
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;As usual, a BIG THANKS from LeafLabs to our AWESOME users!&#60;/p&#62;
&#60;p&#62;On a different note, one of my biggest &#34;why you should switch to fast 32 bit processors from older 8/16 bit stuff&#34; arguments is precisely that it is probably way more performance than you need. That means you can write your app in plain old C/C++, without worrying too much about optimizing, dropping into assembler, or using advanced features to squeeze every last drop of performance out of the processor to meet your requirements. The 80/20 rule really comes in to play when optimizing, I get really frustrated when my prototype is done in a weekend, but then it takes a month to tweak everything so that some loop runs 20% faster. &#60;/p&#62;
&#60;p&#62;The extra cycles/sec, memory, timers, and GPIOs can really be your friend, even when you dont &#34;need&#34; them.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>corguy on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6292</link>
			<pubDate>Sat, 10 Sep 2011 18:40:56 +0000</pubDate>
			<dc:creator>corguy</dc:creator>
			<guid isPermaLink="false">6292@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;That was my point, I doubt I'll use 10% of the STM32 so I don't think the Timer&#60;br /&#62;
overhead will be an issue at all.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>robodude666 on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6291</link>
			<pubDate>Sat, 10 Sep 2011 16:08:14 +0000</pubDate>
			<dc:creator>robodude666</dc:creator>
			<guid isPermaLink="false">6291@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Maybe more information about what you intend to use the Maple for might help us out.&#60;/p&#62;
&#60;p&#62;If you require 100% of the STM32's resources, then you will ultimately want something else for room to grow, however I find it difficult to imagine how someone can exhaust the Maple of all its resources.&#60;/p&#62;
&#60;p&#62;If you're willing to do some dirty work, you can modify libmaple and get direct access to the Timer interrupt handlers and remove ALL overhead if you really need that extra bit of performance.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>corguy on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6290</link>
			<pubDate>Sat, 10 Sep 2011 15:37:42 +0000</pubDate>
			<dc:creator>corguy</dc:creator>
			<guid isPermaLink="false">6290@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Wow guys, thanks for all the input, I already feel much better about switching&#60;br /&#62;
with this kind of response. &#60;/p&#62;
&#60;p&#62;Some specific comments and questions:&#60;/p&#62;
&#60;p&#62;robodude66:&#60;br /&#62;
you said &#34;Timers and interrupts all work as expected. There is a minor delay due to overhead when using the interrupt handlers, but they are being worked on.&#34;&#60;/p&#62;
&#60;p&#62;I've read a little bit about this here and my take is it's not a big issue unless&#60;br /&#62;
your really working your MCU at 100% and need all the clock cycles you can get. Am I correct in that assumption?&#60;/p&#62;
&#60;p&#62;Crenn: I'm familiar with level shifting and do all my pcb's from scratch so I can add the needed parts for any 5v parts I need to use. I'll be glad to give your code a try and provide feedback. &#60;/p&#62;
&#60;p&#62;gbulmer: I've used other MCU's and I use a mixture of arudino and direct AVR code. I see a few benefits to a switch to the STM32: The cost of the ATMega2560 plus the needed FTRL232 chips is a few dollars more than the STM32F103RB and saves tons of board space. Even in quantity the FT232RL is almost $4 and it pains me to pay that for what I get. The second is the raw power of the STM compared to the ATMEGA. And the ATMEGA AVR for better or worse suffers from the stigma of being associated with hobbyists due to the Arduino and that it's only an 8bit MCU. Yes I know that an 8bit AVR compares well and has beat the odds against 32 bit processors for many years and continues to do so, but somehow your products are perceived as lacking if you use a AVR mcu. ARM on the other hand has a rep of being difficult to use and more &#34;black magic&#34; and therefore you must be advanced to use it. I don't agree with a lot of this but perceptions are market reality.&#60;/p&#62;
&#60;p&#62;I've read your direct response to my questions 4 or 5 times now and I think it will come in very handy when I start to move forward. Thanks for taking the time to address each one with such detailed response. Since I2C is a question mark I may do some testing before I get too far along.&#60;/p&#62;
&#60;p&#62;Thanks for the input guys, I hope to be able to contribute as I move forward.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>crenn on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6282</link>
			<pubDate>Fri, 09 Sep 2011 19:23:22 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">6282@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I'm using libmaple's I2C implementation which is included in hardware/leaflabs/cores/maple/i2c.* since v0.0.10 I believe.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6248</link>
			<pubDate>Fri, 09 Sep 2011 09:34:28 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">6248@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;crenn - when you say &#34;... but I believe they're implementing the highest priority for the I2C&#34; are you using someone elses I2C library to drive the STM32F I2C peripheral hardware?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>crenn on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6236</link>
			<pubDate>Thu, 08 Sep 2011 21:39:36 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">6236@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;It's not very extensive, I'm just seeing whether errors are being flagged when communicating with devices. I'm haven't looked in depth into the Hardware I2C implementation, but I believe they're implementing the highest priority for the I2C.&#60;/p&#62;
&#60;p&#62;Yep, they are:&#60;/p&#62;
&#60;p&#62;&#34;In order to ensure that events are not missed, the i2c interrupt must not be preempted. We set the i2c interrupt priority to be the highest interrupt in the system (priority level 0). All other interrupts have been initialized to priority level 16. See nvic_init().&#34;&#60;/p&#62;
&#60;p&#62;i2c.c - Lines 476 to 479
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6235</link>
			<pubDate>Thu, 08 Sep 2011 21:03:40 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">6235@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;crenn - how extensive is your test suite? &#60;/p&#62;
&#60;p&#62;Reading the STM32F103xB Errata,&#60;br /&#62;
&#60;a href=&#34;http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/ERRATA_SHEET/CD00190234.pdf&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/ERRATA_SHEET/CD00190234.pdf&#60;/a&#62;&#60;br /&#62;
Section 2.11&#60;br /&#62;
there appears to be a bunch of states that the I2C can experience which have complex workarounds. Some demand I2C runs at the highest priority, others recommend using DMA, and some require running at 88KHz, etc.&#60;/p&#62;
&#60;p&#62;Are you confident you have solved and tested for them?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>crenn on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6234</link>
			<pubDate>Thu, 08 Sep 2011 20:44:14 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">6234@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;gbulmer, my Wire implementation does actually use hardware I2C, and implements a small amount of error handling, although it doesn't allow timeout conditions to occur currently due to problems I've been having with the speed controllers, I'll be adding the option of enabling the timeout condition soon enough. And hardware I2C is available working well as a C library in v0.0.11. It's not too hard to use but the wire library should be fixing that. I should make sure that the Wire version on my server is up to date to the current version and is available for early use with example sketches.&#60;/p&#62;
&#60;p&#62;It is my hope that when I have released it, it will be as easy to use as the Arduino's Wire library implementation. I'm going to be changing a couple of things before release, but the current implementation is working fine.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6230</link>
			<pubDate>Thu, 08 Sep 2011 19:59:07 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">6230@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;corguy - Is the ATmega the only microcontroller that you have experience of?&#60;br /&#62;
Do you only use Arduino libraries, or program through some other libraries, or does your code go directly to the hardware registers?&#60;br /&#62;
Why are you considering migrating? What do you see as the benefit of the STM32F-based Maple of the ATmega?&#60;/p&#62;
&#60;p&#62;The STM32F103 is a more complex device than an ATmega. &#60;/p&#62;
&#60;p&#62;1. The way that attachinterrupt works, and calls your code is comparable between the two microcontrollers and libraries. It is feasible to use more efficient ways of handling interrupts (on both microcontrollers), but that hasn't been completed in the Maple libraries (though the mechanism is their if you want to dig into it, and shave off every 13.9nS :-).&#60;br /&#62;
BUT there is extra complexity. The STM32F103 has the concept of interrupt priorities, which the ATmega does not have. So you may need to deal with the Nested vectored interrupt controller (NVIC), and consider how interrupts interact.&#60;br /&#62;
When the STM32F takes an interrupt, the hardware saves more registers than the ATmega, so even though the STM32F processor is much faster than the ATmega core, interrupt latency will be similar because of the extra data automatically saved, and there is nothing that can be done about this. IMHO, it is unlikely to be an issue as I'd expect the interrupt handler will probably execute faster on an STM32F.&#60;/p&#62;
&#60;p&#62;2. The STM32F103 timers are much more sophisticated than the ones on ATmega's. STM32F103 timers can do everything that an ATmega timer can do and more. Fortunately, something like a 1 second timer with an interrupt can be handled by the Maple libraries without having to delve into the details of the hardware. The STM32F timers are all 16 bit (and can be linked to emulate a 32-bit count). The prescaler which divides the clock is 16 bits, so there is more flexibility on setting the count frequency than ATmega timers. There are more modes too. The Maple libraries give mre flexibility than Arduino libraries, but if you need to dig into the hardware of the timers, there is more to understand than the ATmega timers.&#60;/p&#62;
&#60;p&#62;3. How do you use the analogue input on your ATmega? Do you only use the Arduino analogRead library function?&#60;br /&#62;
If that is the case, then, as robodude666 says, the Maple library is comparable, and you won't see any major difference other than 12bit resolution, and something like 15x faster. Having a very fast analogRead might cause issues if your code relies on the delay caused by the Arduino analogRead (of about 100microSeconds). If you code directly to the Analogue to Digital Converter (ADC) hardware on the ATmega, then the STM32F103 ADC is much more sophisticated. For example, the STM32F103 has more than 1 ADC, each ADC can be programmed to automatically scan inputs. So if you want to do anything other than a simple analogRead you'll have more complexity to understand, but have much more capability than an ATmega. &#60;/p&#62;
&#60;p&#62;4. As robodude666 and crenn say, the SPI has been around for a while, and there are multiple SPI peripherals on Maple's STM32F.&#60;/p&#62;
&#60;p&#62;Other than crenn's I2C libray, the Maple I2C library does not use the I2C hardware, but is software based. The STM32F is quite fast, so this is not necessarily an issue, but it depends on what you are doing. There are a bunch of hardware bugs mentioned in the Errata for the STM32F103 for the I2C hardware with workarounds, some of which require the I2C interrupts to run at the highest level (which may be inconvenient for you), others strongly recommend using DMA, which may be a significant change from what you are used to doing (If you have only used an Arduino). As well as LeafLabs staff, I know at least two people who have had trouble getting the I2C hardware peripheral to work properly. It is not as straightforward as the ATmega.&#60;/p&#62;
&#60;p&#62;I am hoping that crenn's library will fix this.&#60;/p&#62;
&#60;p&#62;As all of the Maple library source code is available, it is feasible for people to get to grips with direct control of the peripherals by using the source as examples. There is also quite an extensive set of examples from ST Micro, who make the STM3F103, but their code tends to be more generic and verbose (they make a range of microcontrollers), and some people find it harder to understand than the Maple libraries.&#60;/p&#62;
&#60;p&#62;(full disclosure: I am not a member of LeafLabs staff)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>crenn on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6229</link>
			<pubDate>Thu, 08 Sep 2011 17:33:44 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">6229@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Remember that the Arduino is 5V and the Maple is 3.3V (generally this is the case with all of the 32-bit Arduino Compatible boards). If you need to talk with 5V devices, there are ways to do it. For example, I use Sparkfun's Logic Level Converters which I communicate with 5V I2C devices.&#60;/p&#62;
&#60;p&#62;There is also a Wire implementation that is available for use, the one included with the IDE is software based, however the one I've written is available for use, and feedback is appreciated. It will be released as soon as I get time to comment it.&#60;/p&#62;
&#60;p&#62;But generally if you encounter a problem, the staff or even other Maple users like myself and robodude66 will attempt to help.&#60;/p&#62;
&#60;p&#62;Enjoy,&#60;br /&#62;
Crenn
&#60;/p&#62;</description>
		</item>
		<item>
			<title>robodude666 on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6227</link>
			<pubDate>Thu, 08 Sep 2011 16:33:33 +0000</pubDate>
			<dc:creator>robodude666</dc:creator>
			<guid isPermaLink="false">6227@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hey corguy,&#60;/p&#62;
&#60;p&#62;I absolutely love my Maple. I've spent hundreds of hours searching for available platforms, and by far Maple is my favorite. Not only is the hardware top quality, but the software is well written and well documented -- you can thank mbolivar for that!&#60;/p&#62;
&#60;p&#62;Very few things need to be modified when porting Arduino code to the Maple. Some things include:&#60;/p&#62;
&#60;p&#62;- Since the Maple has multiple serial ports, use Serial1, Serial2, Serial3, like the Arduino Mega has it. On the Maple (classic) boards, D0 and D1 represent Serial2.&#60;/p&#62;
&#60;p&#62;- STM32 has no pgmspaces header and no similar functions. Instead you can replace PROGMEM with __FLASH__ and access the variable like any other (read-only).&#60;/p&#62;
&#60;p&#62;- The SPI class is called HardwareSPI, and instances of it are not pre-defined  for you.&#60;/p&#62;
&#60;p&#62;Otherwise, the arduino's functions work the same with some extra features to take advantage of the STM32. pinMode, digitalWrite, digitalRead, analogRead, analogWrite, etc. all work as expected. The docs has additional information regarding the added features from the STM32.&#60;/p&#62;
&#60;p&#62;Timers and interrupts all work as expected. There is a minor delay due to overhead when using the interrupt handlers, but they are being worked on. Most of the STM32's hardware features are available to use via the low-level C libmaple library, and many are usable through a higher-level C++ &#34;wirish&#34; library.&#60;/p&#62;
&#60;p&#62;Happy Mapling,&#60;br /&#62;
-robodude66
&#60;/p&#62;</description>
		</item>
		<item>
			<title>corguy on "What challanges would I face moving from Arduino?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1022#post-6225</link>
			<pubDate>Thu, 08 Sep 2011 12:30:24 +0000</pubDate>
			<dc:creator>corguy</dc:creator>
			<guid isPermaLink="false">6225@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I'm really sold on the Maple and I've read much of the past forum posts but&#60;br /&#62;
I'd like to get some input before I take the plunge and move all my&#60;br /&#62;
development to Maple. &#60;/p&#62;
&#60;p&#62;I reviewed all my code and the big things that concern me are:&#60;/p&#62;
&#60;p&#62;1. I use a variety of interrupts using attachInterrupt, are these&#60;br /&#62;
going to be an issue?&#60;/p&#62;
&#60;p&#62;2. Timers, I use some avr code to setup a one second timer and ISR. Is this&#60;br /&#62;
doable in Maple and it is solid. &#60;/p&#62;
&#60;p&#62;3. Should I be worried about simple things like analog inputs? Other than&#60;br /&#62;
12bit resolution are there any other issues?&#60;/p&#62;
&#60;p&#62;4. I also use make use of I2C/SPI chips using the arduino libs wire/spilib and from what I can tell these seem to be solid in the Maple?&#60;/p&#62;
&#60;p&#62;I have not been able to get a good feel for the recent status of these things by reading&#60;br /&#62;
through the forum. I hope someone that's done some of these things can give me some&#60;br /&#62;
feedback. &#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
