<?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>Sharing SPI interface between SD card and other peripheral</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/102258/sharing-spi-interface-between-sd-card-and-other-peripheral</link><description>Dear DevZone, 
 I am trying to share a SPI instance between an SD card and an other peripheral. I am working with nRF52840. 
 I already opened a ticket back in time in devzone.nordicsemi.com/.../sd-card-disk_initialization-fails-when-the-fatfs-example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 25 Aug 2023 14:44:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/102258/sharing-spi-interface-between-sd-card-and-other-peripheral" /><item><title>RE: Sharing SPI interface between SD card and other peripheral</title><link>https://devzone.nordicsemi.com/thread/443199?ContentTypeID=1</link><pubDate>Fri, 25 Aug 2023 14:44:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68eb93d3-5b5f-4447-af2e-594f07f7bc9d</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;I don&amp;#39;t know for sure whether I have exact answer for your query or not,&lt;/p&gt;
&lt;p&gt;but we can see in the fatfs example that first static initializations are done and then there are two steps namely disk-initialization and disk-mounting.&amp;nbsp;After these steps you can read and write from the disk.&amp;nbsp;Similarly, afterwards we need to unmount and then uninitialize the disk if we want to use the other peripheral. I can see that just going through fatfs_example function takes approximately 10ms.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sharing SPI interface between SD card and other peripheral</title><link>https://devzone.nordicsemi.com/thread/442615?ContentTypeID=1</link><pubDate>Tue, 22 Aug 2023 14:34:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e74f580-479c-45da-b29f-49c9c1974a0f</guid><dc:creator>Gianlucamilani</dc:creator><description>&lt;p&gt;&lt;span style="background-color:#ffff00;"&gt;I guess that is internal to how disk drivers do the initialization. It might also depend on the size of the SD card.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffff00;"&gt;Can you try different card size and again check if it makes any difference.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffff00;"&gt;Also, number of files stored on the SDCard contribute to that time.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffff00;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Perfect, thanks Naeem&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffff00;"&gt;I don&amp;#39;t know what you mean here.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I mean: do you know the minimal set of commands/functions to reinitialize the SPI instance related to the SD?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sharing SPI interface between SD card and other peripheral</title><link>https://devzone.nordicsemi.com/thread/442609?ContentTypeID=1</link><pubDate>Tue, 22 Aug 2023 14:04:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3a4e2b3-f44a-4c45-a59b-c8a657cf21c7</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hello again,&lt;/p&gt;
[quote user="Gianlucamilani"]it is stated that the pin sharing between instances is possible.[/quote]
&lt;p&gt;It would be possibly but you will have to do more, like uninitialize and reinitialize.&lt;/p&gt;
&lt;p&gt;That is what that ticket has in its conclusion:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;em&gt;Yeah, you&amp;#39;re right. The SPIM0-2 uses SW Chip Select and you&amp;#39;ll have to uninit and then re-init the driver with the new configuration (CS/SS pin and whatever else you want to change) whenever you want to address another slave&lt;/em&gt;&amp;quot;&lt;/p&gt;
[quote user="Gianlucamilani"]which is the minimal initalization procedure for the fatfs SPI[/quote]
&lt;p&gt;I don&amp;#39;t know what you mean here.&amp;nbsp;&lt;/p&gt;
[quote user="Gianlucamilani"]I currently tried to calculate the time to run the fatfs example including the whole disk_initialize function, and it lasts 10ms[/quote]
&lt;p&gt;I guess that is internal to how disk drivers do the initialization. It might also depend on the size of the SD card.&lt;/p&gt;
&lt;p&gt;Can you try different card size and again check if it makes any difference.&lt;/p&gt;
&lt;p&gt;Also, number of files stored on the SDCard contribute to that time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sharing SPI interface between SD card and other peripheral</title><link>https://devzone.nordicsemi.com/thread/442134?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2023 18:59:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e87a3840-8455-409f-82ba-d9544e070900</guid><dc:creator>Gianlucamilani</dc:creator><description>&lt;p&gt;Thanks a lot Naeem.&lt;/p&gt;
&lt;p&gt;I asked this also because in this old DevZone post&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/37737/multiple-spi-instances---share-pins"&gt;Multiple SPI instances - share pins?&lt;/a&gt;&amp;nbsp;, it is stated that the pin sharing between instances is possible. So do you confirm it is not, right?&lt;/p&gt;
&lt;p&gt;In the latter case, I would do what you suggested above, i.e. uninitialize and reinitialize the SPI instance every time I need to switch. I would ask you for a doubt:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;which is the minimal initalization procedure for the fatfs SPI ? I currently tried to calculate the time to run the fatfs example including the whole disk_initialize function, and it lasts 10ms. it is too much time for my application if I need to do it every time I switch. Do you think it would be possible to remove&amp;nbsp;part of this function when I reinitialize the fatfs SPI instance?&lt;/p&gt;
&lt;p&gt;Here the fatfs_example function including the disk_initialize call:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void fatfs_example()
{
    static FATFS fs;
    static DIR dir;
    static FILINFO fno;
    static FIL file;

 

    uint32_t bytes_written;
    FRESULT ff_result;
    DSTATUS disk_state = STA_NOINIT;

 

    // Initialize FATFS disk I/O interface by providing the block device.
    static diskio_blkdev_t drives[] =
    {
            DISKIO_BLOCKDEV_CONFIG(NRF_BLOCKDEV_BASE_ADDR(m_block_dev_sdc, block_dev), NULL)
    };

 

    diskio_blockdev_register(drives, ARRAY_SIZE(drives));

 

    NRF_LOG_INFO(&amp;quot;Initializing disk 0 (SDC)...&amp;quot;);
    SEGGER_RTT_printf(0,&amp;quot;Initializing disk 0 (SDC)...&amp;quot;);
    for (uint32_t retries = 3; retries &amp;amp;&amp;amp; disk_state; --retries)
    {
        disk_state = disk_initialize(0);
    }
    if (disk_state)
    {
        //NRF_LOG_INFO(&amp;quot;Disk initialization failed.&amp;quot;);
        SEGGER_RTT_printf(0,&amp;quot;Disk initialization failed.&amp;quot;);
        return;
    }

 

    uint32_t blocks_per_mb = (1024uL * 1024uL) / m_block_dev_sdc.block_dev.p_ops-&amp;gt;geometry(&amp;amp;m_block_dev_sdc.block_dev)-&amp;gt;blk_size;
    uint32_t capacity = m_block_dev_sdc.block_dev.p_ops-&amp;gt;geometry(&amp;amp;m_block_dev_sdc.block_dev)-&amp;gt;blk_count / blocks_per_mb;
    //NRF_LOG_INFO(&amp;quot;Capacity: %d MB&amp;quot;, capacity);
    SEGGER_RTT_printf(0, &amp;quot;Capacity:  %d &amp;quot;, capacity);

 

    //NRF_LOG_INFO(&amp;quot;Mounting volume...&amp;quot;);
    SEGGER_RTT_printf(0,&amp;quot;Mounting volume...&amp;quot;);
    ff_result = f_mount(&amp;amp;fs, &amp;quot;&amp;quot;, 1);
    if (ff_result)
    {
        //NRF_LOG_INFO(&amp;quot;Mount failed.&amp;quot;);
        SEGGER_RTT_printf(0,&amp;quot;Mount failed.&amp;quot;);
        return;
    }

 

    //NRF_LOG_INFO(&amp;quot;\r\n Listing directory: /&amp;quot;);
    SEGGER_RTT_printf(0,&amp;quot;\r\n Listing directory: /&amp;quot;);
    ff_result = f_opendir(&amp;amp;dir, &amp;quot;/&amp;quot;);
    if (ff_result)
    {
       // NRF_LOG_INFO(&amp;quot;Directory listing failed!&amp;quot;);
        SEGGER_RTT_printf(0,&amp;quot;Directory listing failed!&amp;quot;);
        return;
    }

 

    do
    {
        ff_result = f_readdir(&amp;amp;dir, &amp;amp;fno);
        if (ff_result != FR_OK)
        {
            //NRF_LOG_INFO(&amp;quot;Directory read failed.&amp;quot;);
            SEGGER_RTT_printf(0,&amp;quot;Directory read failed.&amp;quot;);
            return;
        }

 

        if (fno.fname[0])
        {
            if (fno.fattrib &amp;amp; AM_DIR)
            {
                //NRF_LOG_RAW_INFO(&amp;quot;   &amp;lt;DIR&amp;gt;   %s&amp;quot;,(uint32_t)fno.fname);
            }
            else
            {
                //NRF_LOG_RAW_INFO(&amp;quot;%9lu  %s&amp;quot;, fno.fsize, (uint32_t)fno.fname);
            }
        }
    }
    while (fno.fname[0]);
    //NRF_LOG_RAW_INFO(&amp;quot;&amp;quot;);
    //NRF_LOG_INFO(&amp;quot;Writing to file &amp;quot; FILE_NAME &amp;quot;...&amp;quot;);
    SEGGER_RTT_printf(0,&amp;quot;Writing to file &amp;quot; FILE_NAME &amp;quot;...&amp;quot;);

 

    ff_result = f_open(&amp;amp;file, FILE_NAME, FA_READ | FA_WRITE | FA_OPEN_APPEND);
    if (ff_result != FR_OK)
    {
        //NRF_LOG_INFO(&amp;quot;Unable to open or create file: &amp;quot; FILE_NAME &amp;quot;.&amp;quot;);
        SEGGER_RTT_printf(0,&amp;quot;Unable to open or create file: &amp;quot; FILE_NAME &amp;quot;.&amp;quot;);
        return;
    }

 

    ff_result = f_write(&amp;amp;file, TEST_STRING, sizeof(TEST_STRING) - 1, (UINT *) &amp;amp;bytes_written);
    if (ff_result != FR_OK)
    {
        //NRF_LOG_INFO(&amp;quot;Write failed\r\n.&amp;quot;);
        SEGGER_RTT_printf(0,&amp;quot;Write failed\r\n.&amp;quot;);
    }
    else
    {
        //NRF_LOG_INFO(&amp;quot;%d bytes written.&amp;quot;, bytes_written);
        SEGGER_RTT_printf(0,&amp;quot;%d bytes written.&amp;quot;, bytes_written);
    }

 

    (void) f_close(&amp;amp;file);
    return;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here the body of the disk_initalize function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;DSTATUS disk_initialize(BYTE drv)
{
    ASSERT(m_drives);

    if (drv &amp;gt;= m_drives_count)
    {
        return (STA_NODISK | STA_NOINIT);
    }

    if (!m_drives[drv].config.p_block_device)
    {
        return (STA_NODISK | STA_NOINIT);
    }

    if (!(m_drives[drv].state &amp;amp; STA_NOINIT))
    {
        // Disk already initialized.
        return m_drives[drv].state;
    }

    if (m_drives[drv].config.wait_func == NULL)
    {
        m_drives[drv].config.wait_func = default_wait_func;
    }

    m_drives[drv].busy = true;
    ret_code_t err_code = nrf_blk_dev_init(m_drives[drv].config.p_block_device,
                                           block_dev_handler,
                                           (void *) (uint32_t) drv);
    if (err_code == NRF_SUCCESS)
    {
        while (m_drives[drv].busy)
        {
            m_drives[drv].config.wait_func();
        }

        if (m_drives[drv].last_result == NRF_BLOCK_DEV_RESULT_SUCCESS)
        {
            m_drives[drv].state &amp;amp;= ~STA_NOINIT;
        }
    }

    return m_drives[drv].state;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thanks again,&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Gianluca&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sharing SPI interface between SD card and other peripheral</title><link>https://devzone.nordicsemi.com/thread/442017?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2023 07:21:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86e5ce70-f5c1-4901-9960-aca395b4621f</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hi Gianluca,&lt;/p&gt;
&lt;p&gt;No. Different spi instances (e.g. spi0 and spi1) need to be initialized with their own set of pins.&lt;/p&gt;
&lt;p&gt;As in this case, each will have a single device on their bus, they will not need CS pin to enable that.&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Naeem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sharing SPI interface between SD card and other peripheral</title><link>https://devzone.nordicsemi.com/thread/441686?ContentTypeID=1</link><pubDate>Wed, 16 Aug 2023 15:24:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d147cad7-229e-4d77-9939-f95a4d25c662</guid><dc:creator>Gianlucamilani</dc:creator><description>&lt;p&gt;Dear Naeem,&lt;/p&gt;
&lt;p&gt;thank you very much for your answer.&lt;/p&gt;
&lt;p&gt;I tried unitialize and reinitialize the fatfs between each usage of the peripherals, but it seems that the fatfs SPI initialization lasts too much time (around 10ms), which I cannot spend.&lt;/p&gt;
&lt;p&gt;Is it possible then in your opinion to initialize two SPI instances sharing the same CLK, MOSI, MISO pins? as you wrote here:&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffcc00;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffcc00;"&gt;or you can put one device on spi0 and other on spi1 (multiple spi instances) in which case we don&amp;#39;t need to control through the CS pins.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffcc00;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In that case I do not need reinitialization every time right? Is it feasible in your opinion even with the same pins? Do I need to make any particular action?&lt;/p&gt;
&lt;p&gt;Thanks again,&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Gianluca&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sharing SPI interface between SD card and other peripheral</title><link>https://devzone.nordicsemi.com/thread/441553?ContentTypeID=1</link><pubDate>Wed, 16 Aug 2023 09:58:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:802d0311-953d-4bf0-915a-339844de1ab1</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Dear Gianluca,&lt;/p&gt;
&lt;p&gt;Thank you for your patience.&lt;/p&gt;
&lt;p&gt;As you want to have two spi devices (SDCard and another peripheral): you can put both on the same spi controller by having different CS pins, or you can put one device on spi0 and other on spi1 (multiple spi instances) in which case we don&amp;#39;t need to control through the CS pins.&lt;/p&gt;
&lt;p&gt;If you (and your hardware) have the flexibility, then it is preferred to use separate instance for SDCard as sharing another spi peripheral with the SDCard might not be very good idea.&lt;/p&gt;
&lt;p&gt;Nonetheless, as in your case, you have a SDCard and another peripheral that you are putting on the same spi-bus and using spi0 controller.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, as you are using FATFS sample, you have seen that this sample initializes spi internally and you don&amp;#39;t have to do any initialization like you are doing for your other peripheral.&lt;/p&gt;
&lt;p&gt;What I mean is that: for the other peripheral, you have written spi_master_init() function but we have not written any such initialization function for the SDCard as we know that the FATFS must be handling internally.&lt;/p&gt;
&lt;p&gt;Saying that, the problem you are facing seems to be due to the fact that the instance is already initialized, and you are trying to reinitialize it. As per your code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;err_code = spi_master_init();
CDCInit();                    
nrf_delay_ms(1000);

APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
NRF_LOG_DEFAULT_BACKENDS_INIT();
fatfs_example();                 &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you are calling fatfs example first, then do something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;fatfs_example();

nrf_drv_spi_uninit(&amp;amp;spi);

spi_transceiver_init();    

while (1) 
    {   
        // ...
        APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, m_length, m_rx_buf, m_length));
        while (!spi_xfer_done)
        {
          __WFE();
        }
        // ...
        nrf_delay_ms(1000);
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;where, after fatfs example, we uninitialize the spi instance driver, and then re-initializ (in this spi_transceiver_init() function like spi_master_init() ) before using it.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Naeem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sharing SPI interface between SD card and other peripheral</title><link>https://devzone.nordicsemi.com/thread/440444?ContentTypeID=1</link><pubDate>Wed, 09 Aug 2023 09:24:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:009c5f64-7af4-467a-8b20-45f784fd1ffa</guid><dc:creator>Gianlucamilani</dc:creator><description>&lt;p&gt;Dear Naeem,&lt;/p&gt;
&lt;p&gt;thank you very much for your answer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, the standard SPI initialization (the one I use for the other device), handles two devices, not one. This is the reason why in that initialization I set the CS pin as not set (NRF_DRV_SPI_PIN_NOT_USED). Then, every time I need to communicate with those two devices, I manually set the CS pin.&lt;/p&gt;
&lt;p&gt;For the fatfs instead, I am not modifying the example code, which sets a specific CS pin.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Given that, I am wondering if this double initialization can create some kind of issues, but for the time being I tried to avoid modifying the fatfs example which seems to be very customized with respect to the SPI stuff.&lt;/p&gt;
&lt;p&gt;Given that, do you think there can be other possible modifications/solutions I can try?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;For what concerns this:&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#999999;"&gt;Another test can be using a different spi-instance for both devices&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;the devices share the same lines, so I think I cannot create two different instances, right?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;Thank you again,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;Best regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;Gianluca&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sharing SPI interface between SD card and other peripheral</title><link>https://devzone.nordicsemi.com/thread/438708?ContentTypeID=1</link><pubDate>Fri, 28 Jul 2023 09:20:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd5f551e-1852-4557-a3cd-d4344786a37b</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hello Gianluca,&lt;/p&gt;
&lt;p&gt;Thank you for contacting DevZone at NordicSemi. Appreciate your patience.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When you are want to use a spi controller for two or more spi devices, then each device need to have its own chip-select (CS) pin, that will enable only one peripheral for communication. Rest of the lines (MOSI, MISO, CLK) are same pins.&lt;/p&gt;
&lt;p&gt;Yes, we can see that SDCard spi configuration has a definite CS pin (check #define at top of main), so I think your other device should also have a CS pin defined.&lt;/p&gt;
&lt;p&gt;Another test can be using a different spi-instance for both devices to make sure that nothing is wrong with code / procedure and both devices are working with their spi-istances.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&amp;nbsp;&lt;span style="font-family:inherit;"&gt;Naeem&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sharing SPI interface between SD card and other peripheral</title><link>https://devzone.nordicsemi.com/thread/438338?ContentTypeID=1</link><pubDate>Wed, 26 Jul 2023 14:43:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05765703-c0eb-420e-8fe7-b23da3101304</guid><dc:creator>Gianlucamilani</dc:creator><description>&lt;p&gt;I found out that in the fatfs SPI initialization function there is this configuration:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define APP_SDCARD_CONFIG(MOSI_PIN, MISO_PIN, SCK_PIN, CS_PIN) {    \
            .mosi_pin = MOSI_PIN,                                   \
            .miso_pin = MISO_PIN,                                   \
            .sck_pin  = SCK_PIN,                                    \
            .cs_pin   = CS_PIN                                      \
        }
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can this be the problem? In the sense that I set the CS to be a specific pin (while in the other case the CS pin was not set). Anyways, I would expect that the fatfs example work after this initialization&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sharing SPI interface between SD card and other peripheral</title><link>https://devzone.nordicsemi.com/thread/438323?ContentTypeID=1</link><pubDate>Wed, 26 Jul 2023 14:05:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f87fe93d-0c85-4caa-acef-4910de69bcd9</guid><dc:creator>Gianlucamilani</dc:creator><description>&lt;p&gt;I attach here the sdk_config file for completeness:&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/sdk_5F00_configh.txt"&gt;devzone.nordicsemi.com/.../sdk_5F00_configh.txt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>