<?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>How to get UID in external flash via QSPI?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99578/how-to-get-uid-in-external-flash-via-qspi</link><description>Hi, 
 
 I&amp;#39;m using QSPI to control an external flash (w25q128). 
 Is there any API that can help me get the UID of the external flash? 
 
 For w25q128, there is a command for read the UID. 
 https://www.pjrc.com/teensy/W25Q128FV.pdf 
 
 
 
 SDK: NCS 2</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 May 2023 13:38:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99578/how-to-get-uid-in-external-flash-via-qspi" /><item><title>RE: How to get UID in external flash via QSPI?</title><link>https://devzone.nordicsemi.com/thread/425126?ContentTypeID=1</link><pubDate>Thu, 11 May 2023 13:38:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76f04143-492a-422d-bb69-5d1376f243b2</guid><dc:creator>Sigurd</dc:creator><description>[quote userid="92112" url="~/f/nordic-q-a/99578/how-to-get-uid-in-external-flash-via-qspi/425099"]Thanks for your information.&lt;br /&gt;I implemented &lt;code&gt;qspi_read_uid&lt;/code&gt;.&lt;br /&gt;And successfully read the UID of the external flash.&lt;br /&gt;&lt;br /&gt;Here is what I made:[/quote]
&lt;p&gt;Great! And thanks for sharing the code you made :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get UID in external flash via QSPI?</title><link>https://devzone.nordicsemi.com/thread/425099?ContentTypeID=1</link><pubDate>Thu, 11 May 2023 12:22:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec0970a3-74fa-4cef-80dd-0469e8ac54a9</guid><dc:creator>Andy Chang</dc:creator><description>&lt;p&gt;Thanks for your information.&lt;br /&gt;I implemented &lt;code&gt;qspi_read_uid&lt;/code&gt;.&lt;br /&gt;And successfully read the UID of the external flash.&lt;br /&gt;&lt;br /&gt;Here is what I made:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
int qspi_read_uid(const struct device *dev,
                  uint8_t opcode, 
                  uint8_t *tx, uint8_t tx_len,
                  uint8_t *id, uint8_t id_len )
{
    nrf_qspi_cinstr_conf_t cinstr_cfg = {
        .opcode = opcode,
        .length = NRF_QSPI_CINSTR_LEN_1B,
        .io2_level = true,
        .io3_level = true,
    };

    int ret = qspi_device_init(dev);
    nrfx_err_t res = NRFX_SUCCESS;

    if (ret != 0) {
        LOG_DBG(&amp;quot;qspi_device_init: %d&amp;quot;, ret);
        qspi_device_uninit(dev);
        return ret;
    }

    qspi_lock(dev);
    res = nrfx_qspi_lfm_start(&amp;amp;cinstr_cfg);
    if (res != NRFX_SUCCESS) {
        LOG_DBG(&amp;quot;lfm_start: %x&amp;quot;, res);
        goto out;
    }

    res = nrfx_qspi_lfm_xfer(tx, NULL, tx_len, false);
    if (res != NRFX_SUCCESS) {
        LOG_DBG(&amp;quot;lfm_xfer addr: %x&amp;quot;, res);
        goto out;
    }

    res = nrfx_qspi_lfm_xfer(NULL, id, id_len, true);
    if (res != NRFX_SUCCESS) {
        LOG_DBG(&amp;quot;lfm_xfer read: %x&amp;quot;, res);
        goto out;
    }

out:
    qspi_unlock(dev);
    qspi_device_uninit(dev);
    return qspi_get_zephyr_ret_code(res);
}

&lt;/pre&gt;&lt;/p&gt;
&lt;div id="gtx-trans" style="left:145px;position:absolute;top:50.6px;"&gt;
&lt;div class="gtx-trans-icon"&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get UID in external flash via QSPI?</title><link>https://devzone.nordicsemi.com/thread/425045?ContentTypeID=1</link><pubDate>Thu, 11 May 2023 08:53:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:786bb5dc-1de4-4b2e-a7af-1d21b82c7c28</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Andy Chang"]That is to say, there is no way to read UID through QSPI?[/quote]
&lt;p&gt;Even if the flash API does not have this API function, it should be possible to use the QSPI driver to read it.&lt;/p&gt;
&lt;p&gt;Here is the function for how the JEDEC id is read&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.2.99-ncs2/drivers/flash/nrf_qspi_nor.c#L776"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.2.99-ncs2/drivers/flash/nrf_qspi_nor.c#L776&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So you can create a&amp;nbsp;qspi_read_uid() similar to that function, but instead of opcode SPI_NOR_CMD_RDID (0x9F) , you use 0x4B instead (Read Unique ID Number)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get UID in external flash via QSPI?</title><link>https://devzone.nordicsemi.com/thread/424997?ContentTypeID=1</link><pubDate>Thu, 11 May 2023 06:03:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d045827-8f14-4932-9100-cd674bd470c9</guid><dc:creator>Andy Chang</dc:creator><description>&lt;p&gt;Is there any document about QSPI in zephyr?&lt;br /&gt;Currently I don&amp;#39;t see a way to use QSPI in Zephyr.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get UID in external flash via QSPI?</title><link>https://devzone.nordicsemi.com/thread/424989?ContentTypeID=1</link><pubDate>Thu, 11 May 2023 04:45:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e416fe06-1fbe-449b-93c0-2962065bfed1</guid><dc:creator>Dr3w</dc:creator><description>&lt;p&gt;The absence of an API function to read the UID from external flash via QSPI can be a limitation for some applications. However, the command for retrieving the UID can still be sent directly to the flash device using the QSPI interface. It&amp;#39;s important to ensure that the correct command is used and that the data is read back correctly. On another note, &lt;a href="https://games.lol/fake-island-demolish/"&gt;Unico Studio&lt;/a&gt; is a digital marketing agency that recently partnered with &lt;a href="https://answersrepublic.com/travel/clear-water-beaches-in-united-states/"&gt;Clear Water Beaches&lt;/a&gt;, a beach cleanup organization, to help raise awareness and promote their cause. Their collaboration resulted in a successful social media campaign that reached a wider audience and encouraged more people to join the movement in keeping our beaches clean and safe for everyone.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get UID in external flash via QSPI?</title><link>https://devzone.nordicsemi.com/thread/424984?ContentTypeID=1</link><pubDate>Thu, 11 May 2023 03:44:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0cf0ea1-d963-476e-8bd2-5561c6a36948</guid><dc:creator>Andy Chang</dc:creator><description>&lt;p&gt;Since different manufacturers read UIDs in different ways, it is reasonable not to have this API.&lt;/p&gt;
&lt;p&gt;That is to say, there is no way to read UID through QSPI?&lt;/p&gt;
&lt;p&gt;Or is there another way?&lt;br /&gt;For example, use QSPI API or dynamically switch SPI QSPI ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get UID in external flash via QSPI?</title><link>https://devzone.nordicsemi.com/thread/424936?ContentTypeID=1</link><pubDate>Wed, 10 May 2023 15:16:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35042b21-ef90-4fb8-b52d-ed356e4ca0d5</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]Is there any API that can help me get the UID of the external flash?[/quote]
&lt;p&gt;The flash driver has API functions to read SFDP and JEDEC ID,&amp;nbsp;sfdp_read()/read_jedec_id(), but there is no API function to read the this &amp;quot;UID&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>