<?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>[SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22271/sd-card-sharing-spi-pins-sdcard</link><description>Hi, 
 I&amp;#39;m trying to use the nrf52832 with a sdcard application in SDK_13. I based my code on the example provided and managed to get the sd card working without any problems. 
 However I am now trying to get the another SPI slave working sharing the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 30 Apr 2018 11:58:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22271/sd-card-sharing-spi-pins-sdcard" /><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/130279?ContentTypeID=1</link><pubDate>Mon, 30 Apr 2018 11:58:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f7ee0c3-f070-44f0-9430-2eb089119d56</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Nice!&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll consider the case resolved then.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/130238?ContentTypeID=1</link><pubDate>Mon, 30 Apr 2018 08:19:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f556af23-3424-4943-9ac2-dc8124062182</guid><dc:creator>Raghav Iyer</dc:creator><description>&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;I got it working. I modified the app_sdcard.c and added a spi event callback which propogates the events from the spi event handler of app_sd_card_instance.&lt;/p&gt;
&lt;p&gt;In my display code I listen to callback and&amp;nbsp; I wait for&amp;nbsp;NRF_DRV_SPI_EVENT_DONE between each transfer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/130235?ContentTypeID=1</link><pubDate>Mon, 30 Apr 2018 07:57:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71e43c59-f2ba-489e-920f-fc890f90d101</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Does it work if you only run the SD part, and not the display?&lt;/p&gt;
&lt;p&gt;Does the device reset when you run in release configuration?&lt;/p&gt;
&lt;p&gt;What does your if condition do?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/130196?ContentTypeID=1</link><pubDate>Sun, 29 Apr 2018 11:37:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d22963c-5006-411c-9114-e1d1f6820681</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;You need to initialise the SD card first, as it will power up in SD mode, where CS is active &lt;strong&gt;high. &lt;/strong&gt;Each device needs its own CS line of course. Some devices like sensors use the CS to switch between SPI and I&amp;sup2;C mode, these may not work with other devices on the bus.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/130177?ContentTypeID=1</link><pubDate>Sat, 28 Apr 2018 11:32:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0bcc0aa5-58d6-4010-85b4-b9eeadac929d</guid><dc:creator>Raghav Iyer</dc:creator><description>&lt;p&gt;Hi Martin,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am having the same issue, where I am driving an eink display and a sd card and I want to reuse the same spi instance.&lt;/p&gt;
&lt;p&gt;I managed to get it working by adding an if condition in app_sdcard.c spi event handler.&lt;/p&gt;
&lt;p&gt;but the problem is the display and sd card only work in segger&amp;#39;s debug configuration, when I switch to release configuration, the display stops printing but I don&amp;#39;t get any error.&lt;/p&gt;
&lt;p&gt;I tried running display code without sd card and initialized the spi instance manually and then it runs in the release config.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/87566?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 14:42:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18aadd04-d1dd-4969-abab-f31871654d9d</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Does nrf_drv_spi_transfer() return any errors?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/87565?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 11:17:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7d1bf09-653f-42d1-8f2a-f086f5a10668</guid><dc:creator>gsalazar</dc:creator><description>&lt;p&gt;I cannot put the whole code but I will add an excerpt of it which contains the main logic.&lt;/p&gt;
&lt;p&gt;I do not have to change frequency or anything. what I observe is that the second spi will always enter the app_sdcard.c &lt;code&gt;spi_handler&lt;/code&gt; and the bytes will not be transmitted&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/87564?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 10:59:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:496e7716-db27-4041-8d16-0fc110a8db45</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;I may have misunderstood a thing or two. First, it shouldn&amp;#39;t be any issues with having several slaves connected to the same SPI pins as long as you use the Slave Select pins correctly. Furthermore, unless you have to change frequency, modes, or bit order you should not re-initialize the SPI either.&lt;/p&gt;
&lt;p&gt;Do you mind uploading your code? You can edit your original question and attach a .c file there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/87563?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 10:21:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:140fd7fe-9934-4d91-bd48-28115b5d98b4</guid><dc:creator>gsalazar</dc:creator><description>&lt;p&gt;Do you know if it is possible to use the SD card and another SPI slave using the same pins? Without using the spi_handler available in the app_sdcard.c&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/87562?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 13:28:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9298832-696e-4f28-bee0-bc32d3fdbe8a</guid><dc:creator>gsalazar</dc:creator><description>&lt;p&gt;If I only call it once it does not return error. However I cannot use the second slave that I have on the bus since the spi instance will have the &lt;code&gt;spi_handler&lt;/code&gt; as defined in the app_sdcard.c and throw the &lt;code&gt;APP_ERROR_CHECK(NRF_ERROR_INTERNAL);&lt;/code&gt; in line 979.&lt;/p&gt;
&lt;p&gt;My main goal is being able to use 2 spi slaves in the same bus being a sd card on of them&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/87561?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 12:29:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83eb4225-7ae7-41d7-b677-b6742e2b1155</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;nrf_drv_spi_init() will always return an error and not change your SPI configurations if you call it more than once in your application. That is unless you call nrf_drv_spi_uninit() between each call to nrf_drv_spi_init(). When you say &amp;quot;only initializing it once&amp;quot;, does it mean that you only call nrf_drv_spi_init() once and it still returns an error?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/87560?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 11:36:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a17ddd28-fd22-4bf9-a874-e2df07f8c625</guid><dc:creator>gsalazar</dc:creator><description>&lt;p&gt;Yes, it returns it is already initialized and ends up in a error handler and restarts the microcontroller.
If I initialize the SD card first and then the other slave the problem remains.&lt;/p&gt;
&lt;p&gt;I have not tried un-initializing but I tried only initializing it once, via the SD card, to no avail.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [SD Card] Sharing SPI pins sdcard</title><link>https://devzone.nordicsemi.com/thread/87559?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 11:34:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c641d5fb-1183-4e2c-af4f-378bacb54d32</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;If you don&amp;#39;t uncomment APP_ERROR_CHECK() does the function return an error so you end up in an error handler? &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;Here&lt;/a&gt; is a short guide on how to use return codes.&lt;/p&gt;
&lt;p&gt;Have you tried to un-initialize the SPI driver with nrf_drv_spi_uninit() before you re-initialize it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>