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

		<item>
			<title>micah on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=4#post-105079</link>
			<pubDate>Sun, 15 Dec 2013 12:23:18 +0000</pubDate>
			<dc:creator>micah</dc:creator>
			<guid isPermaLink="false">105079@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hey again.  I was just reading about some recent updates to the original SdFat library.  Apparently with the Teensy 3.0 board people are getting more than 1.7 MBytes/s write speeds... wow!&#60;/p&#62;
&#60;p&#62;How hard would it be to update the Maple-SdFat port for this new release?  Probably a lot has changed, but the Maple should be able to do anything the Teensy 3.0 can do, I'd think.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://forum.arduino.cc/index.php/topic,128335.0.html&#34;&#62;Here's&#60;/a&#62; the discussion.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dinau on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=4#post-22335</link>
			<pubDate>Sat, 09 Feb 2013 20:03:06 +0000</pubDate>
			<dc:creator>dinau</dc:creator>
			<guid isPermaLink="false">22335@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi, all&#60;/p&#62;
&#60;p&#62;I've tried to use polpla's Maple-SDFat-DMA,&#60;br /&#62;
&#60;a href=&#34;https://github.com/polpla/Maple-SDFat-DMA&#34; rel=&#34;nofollow&#34;&#62;https://github.com/polpla/Maple-SDFat-DMA&#60;/a&#62;.&#60;/p&#62;
&#60;p&#62;I've imported only polpla's DMA part into my SdFatMaple-vld library because&#60;br /&#62;
it has many examples easy to use.&#60;/p&#62;
&#60;p&#62;This information is very tentavive at this time.&#60;br /&#62;
By modifying the DMA part of the library, it seems that read/write functions work.&#60;/p&#62;
&#60;p&#62;Using Maple rev5 compatible borad.&#60;br /&#62;
SPI clock is 18MHz.&#60;br /&#62;
SPI device is SPI2.&#60;br /&#62;
2G byte MicroSD card.&#60;/p&#62;
&#60;p&#62;Results are as follows:&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;[ SdFatBench.pde ]&#60;/strong&#62;&#60;br /&#62;
Type is FAT16&#60;br /&#62;
File size 5 MB&#60;br /&#62;
Starting write test.  Please wait up to a minute&#60;br /&#62;
Write 233.98 kB/sec&#60;/p&#62;
&#60;p&#62;Starting read test.  Please wait up to a minute&#60;br /&#62;
Read &#60;strong&#62;877.19 kB/sec&#60;/strong&#62;&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;[CardInfo.pde]&#60;/strong&#62;&#60;br /&#62;
Initializing SD card...Wiring is correct and a card is present.&#60;/p&#62;
&#60;p&#62;Card type: SD2&#60;/p&#62;
&#60;p&#62;Volume type is FAT16&#60;/p&#62;
&#60;p&#62;Volume size (bytes): 2028896256&#60;br /&#62;
Volume size (Kbytes): 1981344&#60;br /&#62;
Volume size (Mbytes): 1934&#60;/p&#62;
&#60;p&#62;Files found on the card (name, date and size in bytes):&#60;br /&#62;
BENCH.DAT     2013-02-10 09:11:16 5000000&#60;br /&#62;
M3216-01.WAV  2013-02-10 09:11:16 16642410&#60;br /&#62;
M3216-02.WAV  2013-02-10 09:11:16 21361538&#60;br /&#62;
M3216-03.WAV  2013-02-10 09:11:16 16542764&#60;br /&#62;
S441601.WAV   2013-02-10 09:11:16 66768191&#60;br /&#62;
M44K16.WAV    2013-02-10 09:11:16 28914186&#60;br /&#62;
CASIO.ZIP     2013-02-10 09:11:16 690&#60;/p&#62;
&#60;p&#62;Regards,&#60;/p&#62;
&#60;p&#62;dinau
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=4#post-22333</link>
			<pubDate>Sat, 09 Feb 2013 14:17:53 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">22333@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;dinau - Thank you for clarifying the results. That is very much faster. Excellent work, well done.&#60;/p&#62;
&#60;p&#62;Maybe using DMA, and using the two SPI's, you could do RAID :-)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dinau on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=4#post-22332</link>
			<pubDate>Sat, 09 Feb 2013 12:42:25 +0000</pubDate>
			<dc:creator>dinau</dc:creator>
			<guid isPermaLink="false">22332@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi, gbulmer&#60;br /&#62;
Sorry for confusion about data rate expression.&#60;/p&#62;
&#60;p&#62;I modify correctly the data rate expression as follows:&#60;/p&#62;
&#60;p&#62;2G byte MicroSD card [Transcend], FAT16&#60;br /&#62;
( Using SdFatBench.pde and Olimexino-STM32(compatible Maple rev5 ) )&#60;/p&#62;
&#60;p&#62;Before: v02&#60;br /&#62;
SD card read/write speed,&#60;br /&#62;
[SPI clock], write, read&#60;br /&#62;
[4.5MHz], 109kB/s, 168kB/s&#60;br /&#62;
[ 9MHz ], 120kB/s, 192kB/s&#60;br /&#62;
[18MHz ], 119kB/s, 192kB/s&#60;/p&#62;
&#60;p&#62;After: v03&#60;br /&#62;
Improved SD card read/write speed,&#60;br /&#62;
[SPI clock], write, read&#60;br /&#62;
[4.5MHz], 153kB/s, 289kB/s&#60;br /&#62;
[ 9MHz ], 176kB/s, 396kB/s&#60;br /&#62;
[18MHz ], 192kB/s, 485kB/s&#60;/p&#62;
&#60;p&#62;Note: [kB/s]=[kilo byte per second]&#60;/p&#62;
&#60;p&#62;Regards,&#60;/p&#62;
&#60;p&#62;dinau
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dinau on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=4#post-22331</link>
			<pubDate>Sat, 09 Feb 2013 11:39:05 +0000</pubDate>
			<dc:creator>dinau</dc:creator>
			<guid isPermaLink="false">22331@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thank you for reply, gbulmer.&#60;/p&#62;
&#60;p&#62;I'm going to study general data rate expression.    &#60;/p&#62;
&#60;p&#62;Regards,&#60;/p&#62;
&#60;p&#62;dinau
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=3#post-22330</link>
			<pubDate>Sat, 09 Feb 2013 09:10:01 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">22330@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;dinau - That looks impressive. &#60;/p&#62;
&#60;p&#62;However, I am a bit confused.&#60;br /&#62;
On your post you wrote, for example:&#60;br /&#62;
&#60;em&#62;&#34;[18MHz ], 192kb/sec, 485kb/sec&#34;&#60;/em&#62;,&#60;br /&#62;
&#34;kb&#34; means kilobits, so read speed is 485000 bits/second&#60;/p&#62;
&#60;p&#62;At &#60;a href=&#34;https://bitbucket.org/dinau/sdfatmaple-vld/wiki/Home&#34; rel=&#34;nofollow&#34;&#62;https://bitbucket.org/dinau/sdfatmaple-vld/wiki/Home&#60;/a&#62; it says&#60;br /&#62;
&#60;em&#62;&#34;18.0MHz 192[KB/sec] 485[KB/sec]&#34;&#60;/em&#62;&#60;br /&#62;
&#34;KB&#34; in SI units is Kelvin Bytes, so I assume that should be &#34;kB&#34; for kilobytes, which is 485000 Bytes/second, or 3880000 bits/second&#60;/p&#62;
&#60;p&#62;Which is it?&#60;br /&#62;
(Edited to make &#34;kb&#34; vs &#34;KB&#34; it clearer)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dinau on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=3#post-22322</link>
			<pubDate>Fri, 08 Feb 2013 17:44:55 +0000</pubDate>
			<dc:creator>dinau</dc:creator>
			<guid isPermaLink="false">22322@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I've improved SdFatMaple-vld library.&#60;br /&#62;
I will update download file(v03) later.&#60;br /&#62;
&#60;a href=&#34;https://bitbucket.org/dinau/sdfatmaple-vld/wiki/Home&#34; rel=&#34;nofollow&#34;&#62;https://bitbucket.org/dinau/sdfatmaple-vld/wiki/Home&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;By optimizing SPI read/write routin (without DMA),&#60;br /&#62;
SD card read/write speed is up by multiple from 1.5 to 2.5.&#60;/p&#62;
&#60;p&#62;2G byte MicroSD card [Transcend], FAT16&#60;br /&#62;
( Using SdFatBench.pde and Olimexino-STM32(compatible Maple rev5 ) )&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;Before:&#60;/strong&#62; v02&#60;br /&#62;
    SD card read/write speed,&#60;br /&#62;
    [SPI clock],       write,       read&#60;br /&#62;
    [4.5MHz],        109kb/sec,     168kb/sec&#60;br /&#62;
    [ 9MHz ],        120kb/sec,     192kb/sec&#60;br /&#62;
    [18MHz ],        119kb/sec,     192kb/sec&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;After:&#60;/strong&#62; v03&#60;br /&#62;
    Improved SD card read/write speed,&#60;br /&#62;
    [SPI clock],       write,       read&#60;br /&#62;
    [4.5MHz],        153kb/sec,     289kb/sec&#60;br /&#62;
    [ 9MHz ],       176kb/sec,     396kb/sec&#60;br /&#62;
    &#60;strong&#62;[18MHz ],      192kb/sec,     485kb/sec&#60;/strong&#62;&#60;br /&#62;
([kb/sec]=[kilo byte/sec])&#60;/p&#62;
&#60;p&#62;I found the latest version of Maple-SDFat-DMA yesterday,&#60;br /&#62;
&#60;a href=&#34;https://github.com/polpla/Maple-SDFat-DMA&#34; rel=&#34;nofollow&#34;&#62;https://github.com/polpla/Maple-SDFat-DMA&#60;/a&#62;&#60;br /&#62;
I'd like to try the DMA version, someday. &#60;/p&#62;
&#60;p&#62;Regards&#60;/p&#62;
&#60;p&#62;dinau
&#60;/p&#62;</description>
		</item>
		<item>
			<title>DavidDavid on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=3#post-20364</link>
			<pubDate>Fri, 19 Oct 2012 09:46:19 +0000</pubDate>
			<dc:creator>DavidDavid</dc:creator>
			<guid isPermaLink="false">20364@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi:&#60;/p&#62;
&#60;p&#62;I plan to use the integrated circuit LTC1659&#60;/p&#62;
&#60;p&#62;Has anyone tried the code and verified it works perfectly?&#60;br /&#62;
You can load the code in the forum?&#60;/p&#62;
&#60;p&#62;Thank you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>micah on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=3#post-12260</link>
			<pubDate>Thu, 09 Aug 2012 12:14:34 +0000</pubDate>
			<dc:creator>micah</dc:creator>
			<guid isPermaLink="false">12260@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;i should clarify that my github name is timbresmith :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>pmp0x on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=3#post-12256</link>
			<pubDate>Thu, 09 Aug 2012 06:10:23 +0000</pubDate>
			<dc:creator>pmp0x</dc:creator>
			<guid isPermaLink="false">12256@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hey!&#60;br /&#62;
I'm working on the WiFly and needed to use the SPI-Interface… Because I had some unexpected behavior I looked into the SPI-Interface code and come upon two things I would like to discuss…&#60;br /&#62;
first the one in HardwareSpi.cpp&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;br /&#38;gt;
void HardwareSPI::write(const uint8 *data, uint32 length) {&#38;lt;br /&#38;gt;
    uint32 txed = 0;&#38;lt;br /&#38;gt;
    while (txed &#38;lt; length) {&#38;lt;br /&#38;gt;
        txed += spi_tx(this-&#38;gt;spi_d, data + txed, length - txed);&#38;lt;br /&#38;gt;
    }&#38;lt;br /&#38;gt;
}&#38;lt;br /&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Firs use the supplied function from spi.c this should avoid some overhead actually.&#60;br /&#62;
But the more important one. For me it seemed quiet crucial to read from the transmit register once after transmitting all data Because even though the other side doesn't send data there seems to be data in the TX-buffer&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;void HardwareSPI::write(const void *data, uint32 length) {
// use the offered function from spi.c
    spi_tx(this-&#38;gt;spi_d, data, length);
    spi_rx_reg(this-&#38;gt;spi_d);
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;the other is the spi.c directly &#38;lt;i&#38;gt;libmaple's spi.c&#38;lt;/i&#38;gt;&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;uint32 spi_tx(spi_dev *dev, const void *buf, uint32 len) {
    uint32 txed = 0;
    uint8 byte_frame = spi_dff(dev) == SPI_DFF_8_BIT;
    while (spi_is_tx_empty(dev) &#38;amp;&#38;amp; (txed &#38;lt; len)) {
        if (byte_frame) {
            dev-&#38;gt;regs-&#38;gt;DR = ((const uint8*)buf)[txed++];
        } else {
            dev-&#38;gt;regs-&#38;gt;DR = ((const uint16*)buf)[txed++];
        }
    }
    return txed;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#38;lt;i&#38;gt;changed spi.c&#38;lt;/i&#38;gt;&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;uint32 spi_tx(spi_dev *dev, const void *buf, uint32 len) {
    uint32 txed = 0;
    uint8 byte_frame = spi_dff(dev) == SPI_DFF_8_BIT;
    while ((txed &#38;lt; len)) {
        while(!spi_is_tx_empty(dev))
            ;
        if (byte_frame) {
            //spi_tx_reg((((const uint8*)buf)[txed++] &#38;amp; 0X0000) );
            dev-&#38;gt;regs-&#38;gt;DR = ((const uint8*)buf)[txed++];
        } else {
            //spi_tx_reg(((const uint16*)buf)[txed++]);
            dev-&#38;gt;regs-&#38;gt;DR = ((const uint16*)buf)[txed++];
        }
    }
    return txed;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I think the original code will just work with transfering one byte. Because after the first round through the while loop (equal to the first byte send over spi). The function spi_is_tx_empty() might return true (and therefor the 2nd byte can be put into the buffer) but thats not certain. But it becomes obvious if we want to transmit the 3rd byte. because now we have to WAIT till the TXE-flag turns and this will never be captured be the libmaple while loop.&#60;br /&#62;
Therefore I thing it needs to be this &#34;blocking&#34; transfer if we want to transmit more than one byte. (see fig. 239 in the documentation)&#60;/p&#62;
&#60;p&#62;BUT because I'm not 100% certain I would like to discuss my changes ;)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>polpla on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=3#post-12255</link>
			<pubDate>Thu, 09 Aug 2012 05:57:33 +0000</pubDate>
			<dc:creator>polpla</dc:creator>
			<guid isPermaLink="false">12255@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;timbresmith added manitou's suggestion to the library. It is already updated in Github: &#60;a href=&#34;https://github.com/polpla/Maple-SDFat-DMA&#34; rel=&#34;nofollow&#34;&#62;https://github.com/polpla/Maple-SDFat-DMA&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Hope it is helpful to all!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>micah on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=3#post-12178</link>
			<pubDate>Fri, 03 Aug 2012 19:04:28 +0000</pubDate>
			<dc:creator>micah</dc:creator>
			<guid isPermaLink="false">12178@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Here are the errors for the failing one: &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;Error: CMD0
Error: Sd2Card::init()
card.init failed
254 != 0
Error: Read
Error: Sd2Card::waitStartBlock()
Error: Sd2Card::readData()
Error: SdVolume::init() Cache for read
254 != 0
Error: Read
Error: Sd2Card::waitStartBlock()
Error: Sd2Card::readData()
Error: SdVolume::init() Cache for read2
volume.init failed
openRoot failed
254 != 0
Error: Read
Error: Sd2Card::waitStartBlock()
Error: Sd2Card::readData()
Could not open file!&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>micah on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=3#post-12176</link>
			<pubDate>Fri, 03 Aug 2012 07:34:58 +0000</pubDate>
			<dc:creator>micah</dc:creator>
			<guid isPermaLink="false">12176@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Alright, I've made some progress.  I got polpla's MapleSdFat repository working with manitou's Sd2Card.cpp file and committed to a fork &#60;a href=&#34;https://github.com/timbresmith/Maple-SDFat-DMA&#34;&#62;here&#60;/a&#62;.&#60;/p&#62;
&#60;p&#62;But now I'm having some issues!!!  I have one sketch for which Sd2Card.init() is successful, and another for which it fails (the one I'm currently working on).  I cannot understand how they are different in any way that would make this happen!&#60;/p&#62;
&#60;p&#62;So without further ado, &#60;a href=&#34;https://gist.github.com/3247105&#34;&#62;here are the two files&#60;/a&#62;, appropriately named &#34;success.cpp&#34; and &#34;failure.cpp&#34;.  Any ideas?  The
&#60;/p&#62;</description>
		</item>
		<item>
			<title>micah on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=3#post-11627</link>
			<pubDate>Sun, 08 Jul 2012 16:48:58 +0000</pubDate>
			<dc:creator>micah</dc:creator>
			<guid isPermaLink="false">11627@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;So I'm finally sitting down to work on my project and am having some trouble getting Manitou's changed Sd2Card.cpp working with the FileSys.pde example.  The Sd2Card::Init() function no longer takes any input, so I got rid of that, but now it seems to be getting hung up in the SdVolume::init function after cacheFlush() is finished. The function that gets hung up seems to be Sd2Card::readData&#60;/p&#62;
&#60;p&#62;My goal was to use the existing examples with Manitou's changes, since the SdFile write functions at first appeared to be compatible with them.  But now I'm not so sure!  Is much more work needed to get SdFile working with the changes?&#60;/p&#62;
&#60;p&#62;P.s. I should mention that my internet access is up and down so I'm referencing these functions and classes from memory.  My bad if I messed up any of the names!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>feurig on "HardwareSPI performance"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1075&amp;page=3#post-11299</link>
			<pubDate>Sat, 16 Jun 2012 15:21:30 +0000</pubDate>
			<dc:creator>feurig</dc:creator>
			<guid isPermaLink="false">11299@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I suppose someone should fork and fix this since the original maintainer isn't.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
