<?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>Example of how to read QSPI NOR Flash Device ID</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112059/example-of-how-to-read-qspi-nor-flash-device-id</link><description>Hi, can someone provide an example of reading the device ID from an QSPI flash (NOR)? 
 I&amp;#39;m trying to get it using my NRF52840 using the nrf sdk17.1 with the flash IC AT25FF081A but not getting correct values, just zeros. 
 
 
 For the AT25FF081A, the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Jun 2024 09:18:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112059/example-of-how-to-read-qspi-nor-flash-device-id" /><item><title>RE: Example of how to read QSPI NOR Flash Device ID</title><link>https://devzone.nordicsemi.com/thread/488822?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2024 09:18:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abee515b-96ce-4766-bf24-a2df8181941e</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Good to hear you found the issue, and thanks for sharing the solution &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Example of how to read QSPI NOR Flash Device ID</title><link>https://devzone.nordicsemi.com/thread/488754?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2024 21:14:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7df722cf-0159-4a3e-bcab-b328a801b441</guid><dc:creator>Josh</dc:creator><description>&lt;p&gt;Ok looks like I got it working now. Here is the code for others to reference&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* get the manufacturer and device id of the qspi flash ic
   this flash ic has multiple variants (8 Mb, 16 or 32Mb) which have different device id
   it&amp;#39;s up to the developer to know which one to look for after calling this function
   the manufacturer id should always be 0x1F
   the 8Mb dev id is 0x45 and the 32Mb version is 0x47 (for example)
*/

NVM_ERROR at25ffxxxx_get_id(at25ffxxxx_t *self, uint8_t *dev_id, uint8_t *manf_id)
{
    if(NULL == self || NULL == dev_id || NULL == manf_id)
    {
        return NVM_ERROR_INVALID_POINTER;
    }
    nrfx_err_t err_code;
    // Initialize QSPI peripheral
    uint8_t dummy_addr_bytes[8] = {0};
    uint8_t read_bytes[8] = {0};

    // Configure QSPI command
    nrf_qspi_cinstr_conf_t cinstr_cfg = {
        .opcode    = CMD_READ_MANUFACTURER_DEVICE_ID,
        .length    = 6, // cmd bytes + 3 addr bytes + 2 data bytes
        .io2_level = true,
        .io3_level = true,
        .wipwait   = true,
        .wren      = false
    };
    

    // Send command with dummy bytes
    err_code = nrfx_qspi_cinstr_xfer(&amp;amp;cinstr_cfg, &amp;amp;dummy_addr_bytes, read_bytes);

    
    // Output results
    if(NRFX_SUCCESS != err_code)
    {
        NRF_LOG_ERROR(&amp;quot;nrfx_qspi_cinstr_xfer err: %d\n&amp;quot;, err_code);
    }

    for(int i = 0; i&amp;lt;sizeof(read_bytes); i++)
    {
        NRF_LOG_ERROR(&amp;quot;%d 0x%X\n&amp;quot;, i, read_bytes[i]);
    }
    *manf_id = read_bytes[3];
    *dev_id = read_bytes[4];
    return err_code == NRFX_SUCCESS ? NVM_ERROR_NONE : NVM_ERROR_READ_DEVID_FAILED;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Example of how to read QSPI NOR Flash Device ID</title><link>https://devzone.nordicsemi.com/thread/488739?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2024 18:16:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:659ce560-3d1e-4ac5-9c0f-30d820473289</guid><dc:creator>Josh</dc:creator><description>&lt;p&gt;Also, I am able to write and read data from the flash IC&lt;/p&gt;
&lt;p&gt;it&amp;#39;s just the device id I can&amp;#39;t read&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Example of how to read QSPI NOR Flash Device ID</title><link>https://devzone.nordicsemi.com/thread/488737?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2024 17:33:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e48230d7-99da-4ddc-b57b-d0877d37cfc8</guid><dc:creator>Josh</dc:creator><description>&lt;p&gt;That is one way to do it, reset then read the id&lt;/p&gt;
&lt;p&gt;but we want to read the device id after a reset as well (sometime later).&lt;/p&gt;
&lt;p&gt;I guess, my worry is I&amp;#39;m not using&amp;nbsp;nrfx_qspi_cinstr_xfer function correctly.&lt;/p&gt;
&lt;p&gt;If the datasheet says it&amp;nbsp; needs us to send the 1 byte opcode and then 3 dummy (addr) bytes before it sends back the 2 databytes then am I using the nrf sdk function correctly?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Example of how to read QSPI NOR Flash Device ID</title><link>https://devzone.nordicsemi.com/thread/488667?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2024 12:09:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5d25b10-51f7-474a-a800-e995b0acddfe</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Often you need to send a reset command first, before reading out the Jedec ID. Have you checked the datasheet if this is necessary?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you tried to probe the QSPI lines with a scope or logic analyzer to see if the output is as you expect?&lt;/p&gt;
&lt;p&gt;Just looking at the code I can&amp;#39;t really spot the issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>