<?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 half transmission IRQ not called</title>
		<link>http://forums.leaflabs.com/topic.php?id=2624</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:06:03 +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=2624" rel="self" type="application/rss+xml" />

		<item>
			<title>crenn on "DMA half transmission IRQ not called"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2624#post-13150</link>
			<pubDate>Tue, 04 Sep 2012 20:16:39 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">13150@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;However there is a LQFP48 STM32F3!&#60;br /&#62;
&#60;a href=&#34;http://www.st.com/internet/mcu/product/253449.jsp&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/internet/mcu/product/253449.jsp&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;That would be equivalent to what the Maple Mini has now but with the Cortex-M4F core.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "DMA half transmission IRQ not called"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2624#post-13147</link>
			<pubDate>Tue, 04 Sep 2012 19:44:05 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">13147@http://forums.leaflabs.com/</guid>
			<description>&#60;blockquote&#62;&#60;p&#62;
Were there any official words about a &#34;mini&#34; in the maple2 family ?
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;No word. There aren't any LQFP48 STM32F4s last I checked, so it'd have to be the same 64-pin chip used on Maple 2. That's too big for the current Mini form factor, so the idea is shelved.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Xavier on "DMA half transmission IRQ not called"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2624#post-13129</link>
			<pubDate>Tue, 04 Sep 2012 04:33:58 +0000</pubDate>
			<dc:creator>Xavier</dc:creator>
			<guid isPermaLink="false">13129@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Several reasons...&#60;/p&#62;
&#60;p&#62;I've never tried the built-in DACS of any STM32.&#60;br /&#62;
My synth uses the Maple mini so i don't have any DAC to compare.&#60;/p&#62;
&#60;p&#62;I'll use the 4922 which has an external ref that will allow me to plug a volume pot.&#60;br /&#62;
The output V range can be higher 0-&#38;gt;4.5V...&#60;/p&#62;
&#60;p&#62;I also trust more external DAC for signal/noise ratio reasons... but i may be wrong, i have no idea how good the buil-in DAC work.&#60;/p&#62;
&#60;p&#62;I saw an old thread about :&#60;br /&#62;
&#60;a href=&#34;http://www.ghielectronics.com/catalog/product/353&#34; rel=&#34;nofollow&#34;&#62;http://www.ghielectronics.com/catalog/product/353&#60;/a&#62;&#60;br /&#62;
Did you try it ? &#60;/p&#62;
&#60;p&#62;Were there any official words about a &#34;mini&#34; in the maple2 family ?&#60;/p&#62;
&#60;p&#62;Xavier
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "DMA half transmission IRQ not called"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2624#post-13105</link>
			<pubDate>Mon, 03 Sep 2012 13:39:59 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">13105@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Xavier - AFAICT the mcp4821/2 DACs are similar in capability to the two built in DACs in the Maple RET6, and STM32F4. &#60;/p&#62;
&#60;p&#62;So are you using it to get extra DAC channels for your synth?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Xavier on "DMA half transmission IRQ not called"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2624#post-13094</link>
			<pubDate>Mon, 03 Sep 2012 03:02:04 +0000</pubDate>
			<dc:creator>Xavier</dc:creator>
			<guid isPermaLink="false">13094@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;You should get a mcp4821 DAC.&#60;br /&#62;
12 bits, 20Mhz SPI... $2.00.&#60;br /&#62;
It reads 16 bits command (4 control bits  + 12 sample bits)...&#60;br /&#62;
So the SPI 16 bits is more than usefull.&#60;/p&#62;
&#60;p&#62;Of course, buy one and play with it only when the maple II is ready ;-)&#60;/p&#62;
&#60;p&#62;Xavier
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "DMA half transmission IRQ not called"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2624#post-13076</link>
			<pubDate>Sun, 02 Sep 2012 00:24:10 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">13076@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Glad things are working for you now!&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
I could not find how to set the SPI_DFF_16_BIT using the library.&#60;/p&#62;
&#60;p&#62;Did i miss something ?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;There's currently no way to set 16-bit data frames using HardwareSPI, so unless you want to drop down to the C layer, your workaround is your best bet for now. Perhaps we should add 16-bit data frame support to HardwareSPI? I hadn't run into a use-case for it yet, which is why I left support for it in spi.h only.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Xavier on "DMA half transmission IRQ not called"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2624#post-13073</link>
			<pubDate>Sat, 01 Sep 2012 16:20:49 +0000</pubDate>
			<dc:creator>Xavier</dc:creator>
			<guid isPermaLink="false">13073@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks a lot for the explaination, that totally makes sens.&#60;/p&#62;
&#60;p&#62;I get rid of the DMA for these few bytes transfer.&#60;br /&#62;
I laverage the non blocking SPI feature by setting directly my uint16 samples in the register :&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
    SPI1-&#38;gt;regs-&#38;gt;DR = sample;&#60;br /&#62;
&#60;/code&#62;&#60;br /&#62;
(I'm really after saving each CPU cycle ).&#60;br /&#62;
And it Works like a charm...&#60;/p&#62;
&#60;p&#62;I had to modify &#34;enable_device() &#34; in HardwareSPI to replace SPI_DFF_8_BIT by SPI_DFF_16_BIT and recompile.&#60;br /&#62;
I could not find how to set the SPI_DFF_16_BIT using the library.&#60;/p&#62;
&#60;p&#62;Did i miss something ?&#60;/p&#62;
&#60;p&#62;I added a 12 bits DAC (mcp 4822) to my synth and use both channels... My synth is now stereo !!!  :-)&#60;/p&#62;
&#60;p&#62;Xavier
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "DMA half transmission IRQ not called"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2624#post-13029</link>
			<pubDate>Fri, 31 Aug 2012 17:26:58 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">13029@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Here's the source for dma_get_irq_cause() in case it helps clear things up:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/leaflabs/libmaple/blob/master/libmaple/stm32f1/dma.c#L261&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/libmaple/blob/master/libmaple/stm32f1/dma.c#L261&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "DMA half transmission IRQ not called"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2624#post-13028</link>
			<pubDate>Fri, 31 Aug 2012 17:19:24 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">13028@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;dma_get_irq_cause() is a hack whose right to exist I've often questioned. It works fine in simple situations, but has unintuitive behavior in edge cases like these.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
First question : during the DMA half transmission IRQ, do the DMA transfer stop ?&#60;br /&#62;
Can i assume during the interupt that only 2 bytes have been sent and that it will continue only when the IRQ function exits ?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;No, you can't assume either. AFAIK, the DMA peripheral pends the interrupt then keeps going on with the transfer. This is likely the source of your problems, since your number of transfers is so small.&#60;/p&#62;
&#60;p&#62;If you want to check every flag (error, half-complete, complete, etc.) individually, then dma_get_isr_bits()/dma_clear_isr_bits() is the pair of the functions you're interested in.&#60;/p&#62;
&#60;p&#62;Here's my understanding of why you're seeing this behavior, and a proposed workaround:&#60;/p&#62;
&#60;p&#62;The DMA status register bits (for half-transfer and transfer complete, etc.) get set regardless of whether you've got an interrupt enabled for them. Because of this, in your configuration, dma_get_irq_cause() first checks if the transfer complete flag is set. If so, it immediately returns DMA_TRANSFER_COMPLETE. Only if the transfer-complete status register bit is zero does it check if the half-transfer complete bit is set. This is necessary because if you only specify DMA_TRNS_CMPLT, the half-transfer _and_ transfer complete bits will both be set when the transfer completes.&#60;/p&#62;
&#60;p&#62;In the case that your interrupt handler is called after half-transfer but before transfer complete, this works fine -- you get interrupted twice and everything works like you'd expect.&#60;/p&#62;
&#60;p&#62;If the DMA transfer is small and completes in between the time the half-transfer interrupt pends and the time that your IRQ handler actually gets control and you call dma_get_irq_cause(), the transfer-complete flag might also have gotten set. You then get told your transfer is complete (which it is), and you never see DMA_TRANSFER_HALF_COMPLETE.&#60;/p&#62;
&#60;p&#62;In other words, you may not get interrupted twice, as it's possible that the transfer could complete while the interrupt is still pending (during the time that libmaple's interrupt handler is running, before it calls your interrupt handler, or during register stacking before libmaple's interrupt handler even gets called, or during some other, higher-priority interrupt...). The DMA peripheral then pends an already-pending interrupt, and so you only get the single call. (dma_get_irq_cause() clears _all_ status bits, so you don't get re-interrupted for the half-transfer. If it didn't, then you'd be very confused, as you'd see DMA_TRANSFER_COMPLETE &#60;em&#62;before&#60;/em&#62; seeing DMA_TRANSFER_HALF_COMPLETE!)&#60;/p&#62;
&#60;p&#62;I think your best bet may be to transfer the first two bytes and check for DMA_TRANSFER_COMPLETE. The first time that happens, your interrupt handler can do the GPIO twiddling and then start the transfer of the other two bytes.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Xavier on "DMA half transmission IRQ not called"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2624#post-13010</link>
			<pubDate>Thu, 30 Aug 2012 17:07:40 +0000</pubDate>
			<dc:creator>Xavier</dc:creator>
			<guid isPermaLink="false">13010@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;I'm working on a maple_mini with libmaple 0.12.&#60;br /&#62;
I'm using DMA to feed a SPI double DAC (mcp4822)...&#60;/p&#62;
&#60;p&#62;I'm trying to send both channel (left right) in one DMA request of 4 bytes. I need an interupt after 2 bytes to do some GPIO modification to validate the first channel.&#60;/p&#62;
&#60;p&#62;First question : during the DMA half transmission IRQ, do the DMA transfer stop ?&#60;br /&#62;
Can i assume during the interupt that only 2 bytes have been sent and that it will continue only when the IRQ function exits ?&#60;/p&#62;
&#60;p&#62;My main problem is that the DMA_HALF_TRNS is never called... DMA_TRNS_CMPLT works.&#60;br /&#62;
The consequences is that with the following i only have one of the stero channel working.&#60;/p&#62;
&#60;p&#62;Here's the init :&#60;/p&#62;
&#60;pre&#62;
    spi.begin(SPI_18MHZ, MSBFIRST, 0);
    dma_init(DMA1);
    spi_tx_dma_enable(SPI1);
    dma_setup_transfer(DMA1, DMA_CH3, &#38;amp;SPI1-&#38;gt;regs-&#38;gt;DR, DMA_SIZE_8BITS,
                        &#38;amp;samples, DMA_SIZE_8BITS, (DMA_MINC_MODE &#124; DMA_TRNS_CMPLT
                        &#124; DMA_HALF_TRNS &#124; DMA_FROM_MEM));
    dma_attach_interrupt(DMA1, DMA_CH3, DMAEvent);
    dma_set_priority(DMA1, DMA_CH3, DMA_PRIORITY_VERY_HIGH);
&#60;/pre&#62;
&#60;p&#62;Then in an IRQ called every 1/32768 sec (sampling frequency = 32768Khz):&#60;/p&#62;
&#60;pre&#62;
    dma_set_num_transfers(DMA1, DMA_CH3, 4);
    dma_enable(DMA1, DMA_CH3);
&#60;/pre&#62;
&#60;p&#62;And the DMAEvent function :&#60;/p&#62;
&#60;pre&#62;
void DMAEvent() {
    //we get the DMA event
    dma_irq_cause event = dma_get_irq_cause(DMA1, DMA_CH3);
    if (event == DMA_TRANSFER_COMPLETE) {
        csHigh();
        dma_disable(DMA1, DMA_CH3);
        synth.incReadCursor();
    } else {
        csHigh();
        delay(100); // Tells me it never calls else it should not work with such a delay!!
        csLow();
    }
}
&#60;/pre&#62;
&#60;p&#62;Is there any minimal number of bytes in the DMA transmition to be called in the middle ?&#60;/p&#62;
&#60;p&#62;Thanks a lot for any help,&#60;/p&#62;
&#60;p&#62;Xavier
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
