<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>SPI, SPIM &amp;amp; SD card</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61179/spi-spim-sd-card</link><description>HI 
 
 I&amp;#39;d like to clarify my understanding of how the three work- 
 
 Does the SD card library use SPI or SPIM? 
 Does SPIM automatically use EasyDMA, or is it configured? I see there is an option to select EDMA in sdk_config.h for the legacy SPI driver</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 08 May 2020 17:34:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61179/spi-spim-sd-card" /><item><title>RE: SPI, SPIM &amp; SD card</title><link>https://devzone.nordicsemi.com/thread/249020?ContentTypeID=1</link><pubDate>Fri, 08 May 2020 17:34:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b85988b7-d2fb-4c97-a160-b4c146661278</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;Perfect, thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI, SPIM &amp; SD card</title><link>https://devzone.nordicsemi.com/thread/249000?ContentTypeID=1</link><pubDate>Fri, 08 May 2020 14:19:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a771ee61-b2e9-4b55-a089-459505323e43</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>[quote user=""]is there a way to give my SPIM peripheral a higher IRQ priority than the SD card?[/quote]
&lt;p&gt;&amp;nbsp;I&amp;#39;m not sure I understand this question. The app_sdcard library uses the SPI/SPIM for interfacing with the SD card. Are you asking if you can set a second SPIM instance at a higher priority?&lt;/p&gt;
&lt;p&gt;The app_sdcard library uses the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrf__drv__spi__config.html#ga2fc3320996ed2dad0f6ee32543ce680a"&gt;SPI_DEFAULT_CONFIG_IRQ_PRIORITY&lt;/a&gt;&amp;nbsp;from the sdk_config.h file. If you want to set a different priority for a second SPIM instance, you can do that by changing the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/structnrf__drv__spi__config__t.html#a1281bb80b96d4c69e56c3cff0df6be86"&gt;irq_priority&lt;/a&gt; parameter in the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/structnrf__drv__spi__config__t.html"&gt;nrf_drv_spi_config_t&lt;/a&gt;&amp;nbsp;struct when initializing the SPI driver instance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI, SPIM &amp; SD card</title><link>https://devzone.nordicsemi.com/thread/248984?ContentTypeID=1</link><pubDate>Fri, 08 May 2020 13:40:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afb67aca-a4ce-4a6d-919b-87116f2f19a5</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;OK thanks... it was mainly so I can get a better understanding of how things hang together.&lt;/p&gt;
&lt;p&gt;I do have a minor issue with my app which has SD -&amp;gt; ring buffer -&amp;gt; Timer -&amp;gt; SPIM -&amp;gt; DAC for playing audio, where access to the SD card interferes with either the timer or SPIM slightly... it manifests itself as a background buzz a little bit like mains hum.&lt;/p&gt;
&lt;p&gt;So yes I do have a pretty high interrupt load - I have the SoftDevice running, SD card access, timer ticking every 23us and a 24-bit SPIM transfer for every tick... hence the last question about IRQ priorities.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Nick&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI, SPIM &amp; SD card</title><link>https://devzone.nordicsemi.com/thread/248934?ContentTypeID=1</link><pubDate>Fri, 08 May 2020 12:14:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1882176-3464-450d-afb1-cce8057c43d9</guid><dc:creator>Turbo J</dc:creator><description>[quote userid="78418" url="~/f/nordic-q-a/61179/spi-spim-sd-card"]The docs say they use shared registers but not much else?[/quote]
&lt;p&gt;For the application developer, this is a &lt;em&gt;complex&lt;/em&gt; peripherial that can be configured as either SPI, SPIM, SPIS, TWI, TWIM or TWIS (and some instances only support SPI variants). You can select only ONE function.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="78418" url="~/f/nordic-q-a/61179/spi-spim-sd-card"]Does SPIM automatically use EasyDMA, or is it configured[/quote]
&lt;p&gt;SPIM &lt;strong&gt;must&lt;/strong&gt; use EasyDMA, as there is no other access to TX and RX data.&lt;/p&gt;
[quote userid="78418" url="~/f/nordic-q-a/61179/spi-spim-sd-card"]Does the SD card library use SPI or SPIM?[/quote]
&lt;p&gt;The needlessly? complex SD example uses nrf_drv_spi, which can be configured via sdk_config to be either, IIRC.&lt;/p&gt;
&lt;p&gt;It also had some bugs in the past - I usually use my own simpler diskio.c implementation for FATFS.&lt;/p&gt;
&lt;p&gt;And wheter you use SPI or SPIM is of &lt;em&gt;almost&lt;/em&gt; no consequence. The FS code needs to wait for every transaction. Unless you run a &lt;em&gt;really&lt;/em&gt; high interrupt load, there will be little speed difference between SPI and SPIM when talking to an SD card.&lt;/p&gt;
&lt;p&gt;The only instance where you wanted a SPIM for SD is the faster SPIM3 on NRF52840. Not available on the nrf52832, though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>