<?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 and STM32F103 dual simultaneous sampling</title>
		<link>http://forums.leaflabs.com/topic.php?id=739</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:17:19 +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=739" rel="self" type="application/rss+xml" />

		<item>
			<title>mbolivar on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=5#post-6932</link>
			<pubDate>Thu, 20 Oct 2011 23:34:18 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">6932@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi all,&#60;/p&#62;
&#60;p&#62;tombo,&#60;/p&#62;
&#60;p&#62;samtal's code works in Maple IDE as-is, so you should be able to adapt it to your own purposes.  However, he uses DMA a lot, which can get sort of confusing; there are some notes on DMA in the wiki, but unfortunately they're not that beginner friendly yet:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://wiki.leaflabs.com/index.php?title=DMA&#34; rel=&#34;nofollow&#34;&#62;http://wiki.leaflabs.com/index.php?title=DMA&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;samtal,&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
Can you please add a generic timer interrupt option to the adc conversion start I used? (I need it for my app, but I am not sure how to get it work. I need to start a sequence every 40 microseconds, using a prescaler of 2880 (?)).&#60;br /&#62;
If you do not have the time for the full file, please post here or elsewhere just an example of setting the interrupt and the timer,&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;You should be able to get away with something like this (untested):&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;HardwareTimer timer(1); // uses timer 1; adjust as necessary

void setup() {
    timer.pause(); // pause while we configure
    timer.setPeriod(40); // sets a period of 40 microseconds
    timer.setCompare(TIMER_CH1, 1); // timer channel 1 interrupt occurs when count hits 1
    timer.attachInterrupt(TIMER_CH1, myInterruptHandler); // calls myInterruptHandler when channel 1 hits its count, which we just set to 1
    timer.refresh(); // refresh the timer, to reset the counter to 0
    timer.resume(); // resume counting
}

void myInterruptHandler() {
    // this gets called every time the timer count hits 1, which happens once every 40 microseconds
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;See also &#34;Using Timer Interrupts&#34; in the HardwareTimer documentation:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://leaflabs.com/docs/lang/api/hardwaretimer.html#using-timer-interrupts&#34; rel=&#34;nofollow&#34;&#62;http://leaflabs.com/docs/lang/api/hardwaretimer.html#using-timer-interrupts&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Note that using timer 1 interferes with PWM on any pins connected to timer 1's capture/compare channels.  You can find out which pins these are on your board's hardware page; for Maple, they're listed here:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://leaflabs.com/docs/hardware/maple.html#timer-pin-map&#34; rel=&#34;nofollow&#34;&#62;http://leaflabs.com/docs/hardware/maple.html#timer-pin-map&#60;/a&#62;&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
(have you seen my flash example &#60;a href=&#34;http://pastebin.com/h0CxGRQ7&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/h0CxGRQ7&#60;/a&#62; ?)&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;I did see your post about it, but I haven't looked at the code too closely. We've been busy on some internal projects lately, and I haven't been able to spend as much time on the forums as I usually do. I'm working on some changes to libmaple which will hopefully make writing to Flash much easier, though, so don't despair ;). Your goals are aligned with ours.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>tombo on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=5#post-6901</link>
			<pubDate>Wed, 19 Oct 2011 04:16:56 +0000</pubDate>
			<dc:creator>tombo</dc:creator>
			<guid isPermaLink="false">6901@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks Samtal,&#60;/p&#62;
&#60;p&#62;I'm getting there I think, looking at your code, the STM manual and the code posted by atrabile (thanks atrabile) its all getting a bit clearer.&#60;/p&#62;
&#60;p&#62;Thanks for the warning too, I'll look forward to that challenge!&#60;/p&#62;
&#60;p&#62;Tom
&#60;/p&#62;</description>
		</item>
		<item>
			<title>samtal on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=5#post-6883</link>
			<pubDate>Sun, 16 Oct 2011 15:02:18 +0000</pubDate>
			<dc:creator>samtal</dc:creator>
			<guid isPermaLink="false">6883@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello Tom,&#60;br /&#62;
Myself I am not a big expert, and the Dual ADC I have built resulted from necessity (as you can see in the early posts in this thread).&#60;br /&#62;
Nevertheless, after learning the STM manual, I was able to implement a working application that I use in my project.&#60;br /&#62;
As you will see, the program uses very basic commands, manipulating directly the STM32 registers which I believe makes it useful with any compiler.&#60;br /&#62;
You will have to include the adc.h file, but to the best of my knowledge it is included automatically as part of the core.&#60;br /&#62;
I expect and hope a higher level expert will reply your question and guide you, but from my point of view you may copy and use any part of the code free.&#60;br /&#62;
One warning based on experience:&#60;br /&#62;
I found the most difficult part to be the use of the correct value types by proper definition or casting. I hope you know what I mean and that you can deal with it properly.&#60;br /&#62;
Good luck&#60;br /&#62;
samtal
&#60;/p&#62;</description>
		</item>
		<item>
			<title>tombo on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=5#post-6880</link>
			<pubDate>Sun, 16 Oct 2011 08:12:20 +0000</pubDate>
			<dc:creator>tombo</dc:creator>
			<guid isPermaLink="false">6880@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi Samtal (and all),&#60;/p&#62;
&#60;p&#62;I'm very new to this sort of thing, so please forgive any stupid questions. I'm impressed by what you've done to get the dual ADC working on the Maple! Coincidentally the dual ADC is one of the reasons I chose the maple over any of the Arduinos so I'd like to be able to use it in my projects. &#60;/p&#62;
&#60;p&#62;The reality is that I'm still getting to grips with the basics at the moment, so using code like this may be some way off for me. Nevertheless, my stupid questions are:&#60;/p&#62;
&#60;p&#62;Would I be able to use snippets of the code in your example directly in a sketch that I've written in Wirish within the maple IDE?&#60;/p&#62;
&#60;p&#62;If so, do I need to import anything, or include anything specific before I do? As you can tell, I don't quite have my head around how c, c++ and wirish gel together.&#60;/p&#62;
&#60;p&#62;Thanks&#60;br /&#62;
Tom
&#60;/p&#62;</description>
		</item>
		<item>
			<title>samtal on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=5#post-6758</link>
			<pubDate>Wed, 05 Oct 2011 09:04:43 +0000</pubDate>
			<dc:creator>samtal</dc:creator>
			<guid isPermaLink="false">6758@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks mbolivar,&#60;br /&#62;
As you probably know by now, I am not an experienced programmer.&#60;br /&#62;
(A few words about my background: I am a retired high-tech company owner / manager, dealing with industrial data collection, sw and hw. I did write code some 30 years back, but forgot it all together).&#60;br /&#62;
I am glad (and flattered by an expert...) my code works as is, and I was sure there would be many corrections necessary to make it not only work, but also be written in an appropriate manner.&#60;br /&#62;
I don't really care about credits (had enough in my lifetime...). My hope is that others will use it for their benefit, now that is on the GitHub.&#60;br /&#62;
I will download and learn your code corrections, but before that I have one request from you:&#60;/p&#62;
&#60;p&#62;Can you please add a generic timer interrupt option to the adc conversion start I used?  (I need it for my app, but I am not sure how to get it work. I need to start a sequence every 40 microseconds, using a prescaler of 2880 (?)).&#60;br /&#62;
If you do not have the time for the full file, please post here or elsewhere just an example of setting the interrupt and the timer,&#60;/p&#62;
&#60;p&#62;Thanks&#60;br /&#62;
samtal&#60;br /&#62;
(have you seen my flash example &#60;a href=&#34;http://pastebin.com/h0CxGRQ7&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/h0CxGRQ7&#60;/a&#62; ?)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=5#post-6739</link>
			<pubDate>Mon, 03 Oct 2011 17:41:49 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">6739@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi samtal,&#60;/p&#62;
&#60;p&#62;Thank you for updating the code! I just tried it out on Maple Native and it works perfectly. Kudos to you for writing the code in a portable way; I didn't have to change a single line for it to work on Native.&#60;/p&#62;
&#60;p&#62;While I was playing with this, I made some changes that you may wish to incorporate into your own code. To keep track of these changes, I made a GitHub repository, where you can see the latest version:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/mbolivar/DualRegSample/&#34; rel=&#34;nofollow&#34;&#62;https://github.com/mbolivar/DualRegSample/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Don't worry, you get full author credit in that repo ;).&#60;/p&#62;
&#60;p&#62;I broke up each of the changes I made into individual commits, so that it's easier to tell what happened. If you click on the links in this list, you can scroll down and see just the lines that changed, and where they were in your code.&#60;/p&#62;
&#60;ol&#62;
&#60;li&#62; The first commit I made fixed a typo in the comments:&#60;br /&#62;
&#60;a href=&#34;https://github.com/mbolivar/DualRegSample/commit/0ac776f777db4b1b5563d63e221bf97315ae900c&#34; rel=&#34;nofollow&#34;&#62;https://github.com/mbolivar/DualRegSample/commit/0ac776f777db4b1b5563d63e221bf97315ae900c&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;By the way, mistakes like these are exactly why we don't put version comments in source code. That's what source code repositories are for.&#60;/li&#62;
&#60;li&#62; The next commit I made removes some unnecessary code:&#60;br /&#62;
&#60;a href=&#34;https://github.com/mbolivar/DualRegSample/commit/b2b88c5b18b8c96dfd324269845b1f273ff330d3&#34; rel=&#34;nofollow&#34;&#62;https://github.com/mbolivar/DualRegSample/commit/b2b88c5b18b8c96dfd324269845b1f273ff330d3&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Behind the scenes, part of what the Maple IDE does is call the init() function for you, which takes care of a bunch of stuff, like setting up the ADCs. Here's a link to the init() source code for libmaple v0.0.12:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/leaflabs/libmaple/blob/v0.0.12/wirish/boards.cpp#L52&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/libmaple/blob/v0.0.12/wirish/boards.cpp#L52&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;As you can see, init() calls setupADC(), which ends up calling adcDefaultConfig() to configure each of the ADCs:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/leaflabs/libmaple/blob/v0.0.12/wirish/boards.cpp#L121&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/libmaple/blob/v0.0.12/wirish/boards.cpp#L121&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Since this function handles the ADC config identically to the lines I removed, there's no reason for them to be there. I tested it, and removing these lines still works.&#60;/li&#62;
&#60;li&#62;After that, I moved some DMA code:&#60;br /&#62;
&#60;a href=&#34;https://github.com/mbolivar/DualRegSample/commit/cd1085feeafdb0c19880900941fba0caaa4c2954&#34; rel=&#34;nofollow&#34;&#62;https://github.com/mbolivar/DualRegSample/commit/cd1085feeafdb0c19880900941fba0caaa4c2954&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;The last argument to dma_setup_transfer() is meant to be a logical OR of the mode flags which partially configure DMAx_CCR1. See dma.c for all the details.&#60;/li&#62;
&#60;li&#62;Finally, I removed the unused interrupt code:&#60;br /&#62;
&#60;a href=&#34;https://github.com/mbolivar/DualRegSample/commit/984fc9aa558c4359aac0690eaea0ca4bd090d12a&#34; rel=&#34;nofollow&#34;&#62;https://github.com/mbolivar/DualRegSample/commit/984fc9aa558c4359aac0690eaea0ca4bd090d12a&#60;/a&#62;
&#60;/li&#62;
&#60;/ol&#62;
&#60;p&#62;Hope this helps, and thanks again for posting!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>samtal on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=5#post-6734</link>
			<pubDate>Mon, 03 Oct 2011 03:33:30 +0000</pubDate>
			<dc:creator>samtal</dc:creator>
			<guid isPermaLink="false">6734@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;bart_dood (and others)&#60;/p&#62;
&#60;p&#62;Although you do not need it now, I re-uploaded my previous dual adc sample / demo / template.  it is at:&#60;br /&#62;
&#60;a href=&#34;http://pastebin.com/55YrhGvu&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/55YrhGvu&#60;/a&#62;&#60;br /&#62;
The dual adc will give you double sampling speed, and together with the DMA (as is in the attached demo) it's a perfect utilization of the STM32 core.&#60;/p&#62;
&#60;p&#62;Note that the dual adc has several modes that are also intended to enhance sampling speed. &#60;/p&#62;
&#60;p&#62;See:&#60;br /&#62;
&#60;a href=&#34;http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/APPLICATION_NOTE/CD00258017.pdf&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/APPLICATION_NOTE/CD00258017.pdf&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;samtal
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=5#post-6678</link>
			<pubDate>Thu, 29 Sep 2011 17:17:14 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">6678@http://forums.leaflabs.com/</guid>
			<description>&#60;blockquote&#62;&#60;p&#62;Can I just alter the number of clock samples the ADC's are sampled at to reduce how long it takes? &#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Yes, but if you are going to succesfully use the ADC at a higher sample rate, the analogue signal driving the ADC will need to have a low output impedance (i.e. supply a reasonable current)&#60;/p&#62;
&#60;p&#62;Have a look at the code that comes with the IDE.&#60;br /&#62;
In the file adc.c, there is a function called adc_set_sample_rate which sets the number off cycles the ADC will take for conversion.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bart_dood on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=5#post-6659</link>
			<pubDate>Wed, 28 Sep 2011 15:04:06 +0000</pubDate>
			<dc:creator>bart_dood</dc:creator>
			<guid isPermaLink="false">6659@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Sorry to keep replying in this thread, it looks like dual sampling might be over my programming abilities. I don't actually need dual sampling, all I want to do is minimize how much time it takes to complete an analog sample.&#60;/p&#62;
&#60;p&#62;I think I'll post this question in a new thread rather than hijack this one. Thanks.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bart_dood on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=5#post-6654</link>
			<pubDate>Wed, 28 Sep 2011 10:43:18 +0000</pubDate>
			<dc:creator>bart_dood</dc:creator>
			<guid isPermaLink="false">6654@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi all again, I found this in the file adc.h located at maple-ide-0.0.12-windowsxp32\hardware\leaflabs\cores\maple&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * @brief ADC sample times, in ADC clock cycles&#60;br /&#62;
 *&#60;br /&#62;
 * These control the amount of time spent sampling the input voltage.&#60;br /&#62;
 */&#60;br /&#62;
typedef enum {&#60;br /&#62;
    ADC_SMPR_1_5,               /**&#38;lt; 1.5 ADC cycles */&#60;br /&#62;
    ADC_SMPR_7_5,               /**&#38;lt; 7.5 ADC cycles */&#60;br /&#62;
    ADC_SMPR_13_5,              /**&#38;lt; 13.5 ADC cycles */&#60;br /&#62;
    ADC_SMPR_28_5,              /**&#38;lt; 28.5 ADC cycles */&#60;br /&#62;
    ADC_SMPR_41_5,              /**&#38;lt; 41.5 ADC cycles */&#60;br /&#62;
    ADC_SMPR_55_5,              /**&#38;lt; 55.5 ADC cycles */&#60;br /&#62;
    ADC_SMPR_71_5,              /**&#38;lt; 71.5 ADC cycles */&#60;br /&#62;
    ADC_SMPR_239_5              /**&#38;lt; 239.5 ADC cycles */&#60;br /&#62;
} adc_smp_rate;&#60;/p&#62;
&#60;p&#62;Can I just alter the number of clock samples the ADC's are sampled at to reduce how long it takes? anyone know how to do this?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bart_dood on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=5#post-6653</link>
			<pubDate>Wed, 28 Sep 2011 10:20:28 +0000</pubDate>
			<dc:creator>bart_dood</dc:creator>
			<guid isPermaLink="false">6653@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi samtal,&#60;/p&#62;
&#60;p&#62;I am interested in the dual sampling. My code loop must run very fast and I am trying to shave time off where I can. If I can get this dual analog sampling to work I can reduce the time of my loop.&#60;br /&#62;
Your links seem to be dead, is there some other way of obtaining these files and information?&#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>samtal on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=4#post-6095</link>
			<pubDate>Sat, 27 Aug 2011 07:00:54 +0000</pubDate>
			<dc:creator>samtal</dc:creator>
			<guid isPermaLink="false">6095@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;All, &#60;/p&#62;
&#60;p&#62;A few months ago, after acquiring my first Maple r5, I had the need for a Dual Simultaneous ADC feature, but to my disappointment I found out that the option was not developed for the Maple.&#60;br /&#62;
I realized that others had the same need, but could not find any full implementation.&#60;/p&#62;
&#60;p&#62;After a long straggle learning the Maple and the dual adc, at last, I implemented a fully functional Dual Simultaneous ADC sample program with testing and learning capabilities.&#60;br /&#62;
The Maple 0.0.11 pde file is at: DualRegSample.pde  &#60;a href=&#34;http://pastebin.com/p7P1RPFu&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/p7P1RPFu&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Due to missing functions in the libMaple adc files, I enabled two options, (both included in the file):&#60;/p&#62;
&#60;p&#62;1. Run the program as is. The default is direct access to the relevant registers using the native adc.h for the missing commands / functions.&#60;br /&#62;
OR&#60;br /&#62;
2. Download and include a modified adc.h file named dadc.h (can work side-by-side or replace the original adc.h file).&#60;br /&#62;
dadc.h file: &#60;a href=&#34;http://pastebin.com/8z6pPXfN&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/8z6pPXfN&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;For full testing and demonstration, it is recommended to make a hardware setup with real inputs. Recommended instructions are included in the file's header.&#60;br /&#62;
Please read the instructions in the file header!!!!.&#60;/p&#62;
&#60;p&#62;Let me know how it works for you.&#60;/p&#62;
&#60;p&#62;As you will notice, I use two serial ports: The USB for program upload and the Serial1 for program outputs.&#60;br /&#62;
You can use the USB only (need to replace 'SerialUSB' with 'Serial1', but I recommend the use of two separate ports.&#60;br /&#62;
Note that the output display is strongly dependent on the input serial program you use, and you may have some display problem before you find the right program.&#60;br /&#62;
I recommend the freeware AccessPort from &#60;a href=&#34;http://www.sudt.com/en/ap/download.htm&#34; rel=&#34;nofollow&#34;&#62;http://www.sudt.com/en/ap/download.htm&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Also note that for correct display (for decimal fraction) you must include the Maple stdlib.h&#60;/p&#62;
&#60;p&#62;LeafLab: Please let me know how this program can be integrated (freeware) into leaflab's official libraries (examples) and who can test my files and upgrade the adc.h and adc.c to include the required functions.&#60;/p&#62;
&#60;p&#62;Next I will post a 'clean' version (no demo option) that can be used as a template.&#60;/p&#62;
&#60;p&#62;samtal
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=4#post-6089</link>
			<pubDate>Fri, 26 Aug 2011 08:45:39 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">6089@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I am glad to hear you got it working. Also, I am not Marti ;) (although that guy rules).
&#60;/p&#62;</description>
		</item>
		<item>
			<title>samtal on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=4#post-6083</link>
			<pubDate>Thu, 25 Aug 2011 15:01:00 +0000</pubDate>
			<dc:creator>samtal</dc:creator>
			<guid isPermaLink="false">6083@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks Marti,&#60;br /&#62;
I realize now and agree that there are better tools to program the maple if one wants to 'get hands dirty', like writing directly to registers.&#60;br /&#62;
Yet, I have tried to use the Maple IDE to access the registries directly, and found it to be as easy as 123.&#60;br /&#62;
Some simple commands like the following do it easily:&#60;br /&#62;
DMA1-&#38;gt;regs-&#38;gt;CCR1 &#124;=1&#38;lt;&#38;lt;5;  //Set circular mode for DMA1 CCR1 bit 5&#60;br /&#62;
DMA1-&#38;gt;regs-&#38;gt;CCR1 &#124;=1&#38;lt;&#38;lt;1;  //Set Transfer Complete Interrupt DMA1 CCR1 bit 1 .&#60;br /&#62;
uint8 adc1_seq_3_chan = ADC1-&#38;gt;regs-&#38;gt;SQR3 &#38;amp; 0x7C00; //Get the third channel in ADC1 sequence (not very useful example, difficult - channel numbers are 5 bits each)&#60;/p&#62;
&#60;p&#62;Using the RM0008 manual together with the h files makes it really simple, with no need for the c files or h-files modification.&#60;/p&#62;
&#60;p&#62;To program, one has to use the registers map, and simply set or get the bit(s).&#60;br /&#62;
(This is the way we worked 30 years back, and still going strong...).&#60;br /&#62;
The alternative is to build functions to each of these commands in the h or c file.&#60;/p&#62;
&#60;p&#62;In my current program (that I got to work now by adding dma circular mode), I use a mix of existing functions (c and h files) with added direct registry commands like those above for missing functions.&#60;br /&#62;
I'll make it public clean c and h files to cover dual simul adc, but it may take some time to complete (The dual simultaneous is only a small but critical part of my project)&#60;br /&#62;
samtal
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "Maple and STM32F103 dual simultaneous sampling"</title>
			<link>http://forums.leaflabs.com/topic.php?id=739&amp;page=4#post-6080</link>
			<pubDate>Thu, 25 Aug 2011 12:31:11 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">6080@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Samtal, &#60;/p&#62;
&#60;p&#62;Given that you are modifying the low level libraries, I recommend you graduate away from the IDE and start working off a command line environment. It will be much easier for you. The IDE is not-quite-c, and the preprocessor and other hidden elements that operate on your sketches really make it difficult to get down and dirty with low level c-foo. &#60;/p&#62;
&#60;p&#62;As you know, C/C++ programs are made of both header .h (delcaration) files, source .c (definition) files, and source c++ .cpp (class definition) files. .c and cpp files are compiled differently with different compilers. .h files ordinarily are just declarations and really just compile to a symbol table. For efficiency, some functions are defined in the header files for the ADC library because they are static-inline, which means they look like functions but they operate more like macros. Unless you really mean to be declaring static inline functions, you probably want to be modifying the .c files instead. This is the classic interface/implementation separation. &#60;/p&#62;
&#60;p&#62;If you want to use the IDE anyway, the &#34;IDE&#34; way is to put your application in the sketch (main window), include libraries with the drop down menu, and if you really need to edit a library like adc.c/h then edit the library in /mapledirectory/hardware/leaflabs/cores/maple/&#60;/p&#62;
&#60;p&#62;Its *really* tricky to develop core libraries from the IDE.&#60;/p&#62;
&#60;p&#62;If you would like to use the ST libraries, you can! You can setup a build environment similar to the one we describe in our command line toolchain, or setup an eclipse or codeblocks environment. It will certainly work with our hardware. Early on, we did use the ST libraries before abandoning them.&#60;/p&#62;
&#60;p&#62;We don't use the ST library for lots of reasons - all of our tools (the build environment, the bootloader, libmaple, wirish, and the IDE) are all designed to work well and integrate well with each other - this required writing our own libraries that met higher standards, and was more flexible and general than the ST evaluation libs. We don't have as much coverage as the ST eval stuff, but the idea is that Maple is a platform, not just a piece of hardware. &#60;/p&#62;
&#60;p&#62;If you would like to contribute to the low level libmaple/wirish libraries, I recommend you get yourself setup from the command line, get comfortable with git, and set us patches/pull requests. This makes helping you develop your code, and share it with others, and eventually get it incorporated into a release ORDERS of magnitude easier for us. &#60;/p&#62;
&#60;p&#62;Dual simultaneous sampling is a difficult and niche feature to really incorporate well. If you really want to develop a library, thanks and good luck! If you just need this feature for your project, I recommend register banging in your own application, and leave the adc.h/c files alone.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
