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

		<item>
			<title>konan on "DMA problems"</title>
			<link>http://forums.leaflabs.com/topic.php?id=977#post-5997</link>
			<pubDate>Tue, 16 Aug 2011 14:29:03 +0000</pubDate>
			<dc:creator>konan</dc:creator>
			<guid isPermaLink="false">5997@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Ok, thank you. I've already solved the problem in different way: checking the TCIF bit of the DMA's ISR register in loop() routine :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "DMA problems"</title>
			<link>http://forums.leaflabs.com/topic.php?id=977#post-5986</link>
			<pubDate>Mon, 15 Aug 2011 19:52:01 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">5986@http://forums.leaflabs.com/</guid>
			<description>&#60;blockquote&#62;&#60;p&#62;
it seems that Maple hangs up at first interrupt
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;The DMA support that shipped with 0.0.11 had a bug that caused this behavior; you'll need to use the development version to get working DMA interrupts.&#60;/p&#62;
&#60;p&#62;If you want to continue using Maple IDE, you can replace its dma.c with this version, which is known to work:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/leaflabs/libmaple/blob/f99e0310faf34ab37f7fb31ff2592fa6d6c3213d/libmaple/dma.c&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/libmaple/blob/f99e0310faf34ab37f7fb31ff2592fa6d6c3213d/libmaple/dma.c&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;dma.c is located in hardware/leaflabs/cores/maple/.  The location of the 'hardware' folder depends on your platform; for instance, on OS X, it's in MapleIDE.app/Contents/Resources/Java.&#60;/p&#62;
&#60;p&#62;If you want to use the bleeding edge libmaple in general, there are instructions on getting set up with Git here:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://leaflabs.com/docs/unix-toolchain.html&#34; rel=&#34;nofollow&#34;&#62;http://leaflabs.com/docs/unix-toolchain.html&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;If you're interested in details, robodude666 found the bug:&#60;br /&#62;
&#60;a href=&#34;http://forums.leaflabs.com/topic.php?id=861&#38;amp;page=2#post-5329&#34; rel=&#34;nofollow&#34;&#62;http://forums.leaflabs.com/topic.php?id=861&#38;amp;page=2#post-5329&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;This is the commit where the fix went in:&#60;br /&#62;
&#60;a href=&#34;https://github.com/leaflabs/libmaple/commit/f99e0310faf34ab37f7fb31ff2592fa6d6c3213d&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/libmaple/commit/f99e0310faf34ab37f7fb31ff2592fa6d6c3213d&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>konan on "DMA problems"</title>
			<link>http://forums.leaflabs.com/topic.php?id=977#post-5982</link>
			<pubDate>Sun, 14 Aug 2011 04:30:38 +0000</pubDate>
			<dc:creator>konan</dc:creator>
			<guid isPermaLink="false">5982@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello all!&#60;/p&#62;
&#60;p&#62;I've got a problem trying to program DMA transfer from memory to the USART. When I put DMA in circular mode (DMA_CIRC_MODE) everything works fine, but when I clear this bit and set the DMA_TRNS_CMPLT, it seems that Maple hangs up at first interrupt (I see on the oscilloscope that the 1st transfer is going, and the board LED, that must blink every 0,5s, just turns on). I even tried to remove from the interrupt handler all the operations with DMA controller, it didn't help. What I'm doing wrong? Here's the code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;#include &#38;quot;dma.h&#38;quot;

uint8 buf[512];
int dma_cmplt = 1;

void intDMA(void)
{
  dma_cmplt = 1;
}

void setup()
{
  pinMode(BOARD_LED_PIN, OUTPUT);

  Serial3.begin(9600);
  dma_init(DMA1);
  dma_setup_transfer(DMA1,
		   DMA_CH2,
		   &#38;amp;USART3_BASE-&#38;gt;DR,
		   DMA_SIZE_8BITS,
		   buf,
		   DMA_SIZE_8BITS,
		   (DMA_MINC_MODE &#124; DMA_FROM_MEM &#124; DMA_TRNS_CMPLT));
  dma_attach_interrupt(DMA1, DMA_CH2, intDMA);
  USART3_BASE-&#38;gt;CR3 &#124;= USART_CR3_DMAT;
}  

void loop()
{
  if (millis() % 500 == 0)
  {
    digitalWrite(BOARD_LED_PIN, (millis()/500) % 2);
  }
  if (dma_cmplt)
  {
    dma_disable(DMA1, DMA_CH2);
    dma_set_mem_addr(DMA1, DMA_CH2, buf);
    dma_set_num_transfers(DMA1, DMA_CH2, 512);
    dma_enable(DMA1, DMA_CH2);
    dma_cmplt = 0;
  }
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
