<?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>Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112371/cannot-exit-deep-power-down-mode-qspi-flash</link><description>We designed a board based on the nRF52840, and are using nrf5 SDK 17.1.0 with S140 SoftDevice. We are using a QSPI flash, MX25U51245G ( https://www.macronix.com/Lists/Datasheet/Attachments/8736/MX25U51245G%2054,%201.8V,%20512Mb,%20v1.2.pdf ), we are using</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 Jul 2025 09:17:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112371/cannot-exit-deep-power-down-mode-qspi-flash" /><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/541420?ContentTypeID=1</link><pubDate>Fri, 04 Jul 2025 09:17:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fb6dba5-9c1d-41a1-a9f0-8fdaf61b7805</guid><dc:creator>Adam Varga</dc:creator><description>&lt;p&gt;Hey&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/robca"&gt;robca&lt;/a&gt;&amp;nbsp;!&lt;br /&gt;&lt;br /&gt;I just wanted to give a shoutout to your thorough investigation and good find on the zephyr commit! I faced this exact issue with my Seeed XIAO Sense board with the P25Q16H flash on it, but incorporating that trick solved the problem without needing to modify any SDK file. Thx a lot!&lt;br /&gt;&lt;br /&gt;If anyone&amp;nbsp;faces this issue, this is how my fix looks like:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static uint32_t *QSPI_Status_Ptr = (uint32_t*) 0x40029604;  // Setup for the SEEED XIAO BLE - nRF52840

static nrfx_err_t QSPI_IsReady(void) {
    if (((*QSPI_Status_Ptr &amp;amp; 8) == 8) &amp;amp;&amp;amp; (*QSPI_Status_Ptr &amp;amp; 0x01000000) == 0) {
        return NRFX_SUCCESS;
    } else {
        return NRFX_ERROR_BUSY;
    }
}

static nrfx_err_t QSPI_WaitForReady(void) {
    while (QSPI_IsReady() == NRFX_ERROR_BUSY) {
        // TODO timeout
    }
    return NRFX_SUCCESS;
}

static nrfx_err_t QSPI_RDPWorkaroundInit(void) {
    nrfx_err_t err_code;
    nrf_qspi_pins_t pins;
    nrf_qspi_pins_get(NRF_QSPI, &amp;amp;pins);
    nrf_qspi_pins_t disconnected_pins = {
			.sck_pin = NRF_QSPI_PIN_NOT_CONNECTED,
			.csn_pin = NRF_QSPI_PIN_NOT_CONNECTED,
			.io0_pin = NRF_QSPI_PIN_NOT_CONNECTED,
			.io1_pin = NRF_QSPI_PIN_NOT_CONNECTED,
			.io2_pin = NRF_QSPI_PIN_NOT_CONNECTED,
			.io3_pin = NRF_QSPI_PIN_NOT_CONNECTED,
    };
    nrf_qspi_pins_set(NRF_QSPI, &amp;amp;disconnected_pins);

    nrf_qspi_enable(NRF_QSPI);
    nrf_qspi_event_clear(NRF_QSPI, NRF_QSPI_EVENT_READY);
    nrf_qspi_task_trigger(NRF_QSPI, NRF_QSPI_TASK_ACTIVATE);

    err_code = QSPI_WaitForReady();
    nrf_qspi_pins_set(NRF_QSPI, &amp;amp;pins);
    return err_code;
}

static nrfx_err_t QSPI_SendRDP(void) {
    nrfx_err_t err_code;
    
    // Send RDP cmd to wake up flash from DPM
    nrf_qspi_cinstr_conf_t cinstr_cfg_rdp = {
        .opcode    = 0xAB,
        .length    = NRF_QSPI_CINSTR_LEN_1B,
        .io2_level = true,
        .io3_level = true,
        .wipwait   = false,
        .wren      = true
    };

    err_code = nrfx_qspi_cinstr_xfer(&amp;amp;cinstr_cfg_rdp, NULL, NULL);
    QSPI_WaitForReady();
    return err_code;
}

nrfx_err_t QSPI_FlashInit(void) {
    nrfx_err_t err_code;
    nrfx_qspi_config_t config = NRFX_QSPI_DEFAULT_CONFIG;
    // TODO: set up config according to your needs
    err_code = nrfx_qspi_init(&amp;amp;config, NULL, NULL);
    if(err_code == NRFX_SUCCESS) {
        NRF_LOG_INFO(&amp;quot;QSPI flash inited successfully&amp;quot;);
    } else {
        NRF_LOG_ERROR(&amp;quot;QSPI flash init error (%d), possibly due to flash RDP. Trying workaround...&amp;quot;, err_code);
        if (QSPI_RDPWorkaroundInit() == NRFX_SUCCESS) {
            NRF_LOG_INFO(&amp;quot;QSPI flash inited successfully with RDP workaround.&amp;quot;);
            if (QSPI_SendRDP() != NRFX_SUCCESS) {
                NRF_LOG_ERROR(&amp;quot;Could not wake up flash from deep power-down mode!);
            } else {
                return NRFX_SUCCESS;
            }
        } else {
            NRF_LOG_ERROR(&amp;quot;QSPI flash init failed.&amp;quot;);
        }
    }
    return err_code;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/492470?ContentTypeID=1</link><pubDate>Fri, 05 Jul 2024 13:12:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d630fc3c-78d0-4be5-a60f-cfb118d7e336</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;If you are able to make it work while disconnecting the QSPI pins, I would say that this is better. It doesn&amp;#39;t require any extra GPIOs, and it doesn&amp;#39;t actually output/input a physical signal to a disconnected GPIO.&lt;/p&gt;
&lt;p&gt;It shouldn&amp;#39;t really matter, but it sounds &amp;quot;cleaner&amp;quot; in my opinion.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/492328?ContentTypeID=1</link><pubDate>Thu, 04 Jul 2024 18:26:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e182c3d-e429-4553-a6d6-d38603a1ebb7</guid><dc:creator>robca</dc:creator><description>&lt;p&gt;I just realized that this same issue has been found and reported on the Zephyr-based SDK Connect&amp;nbsp;&lt;a id="" href="https://github.com/zephyrproject-rtos/zephyr/pull/64782"&gt;https://github.com/zephyrproject-rtos/zephyr/pull/64782&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Looking at the commit (&lt;a id="" href="https://github.com/zephyrproject-rtos/zephyr/commit/1727bbcc7046eb5870df7409310d58e0c9483233"&gt;https://github.com/zephyrproject-rtos/zephyr/commit/1727bbcc7046eb5870df7409310d58e0c9483233&lt;/a&gt;), they used a different strategy than mine: instead of defining IO1 as pulldown, the QSPI peripheral is initialized with&amp;nbsp;&lt;span&gt;NRF_QSPI_PIN_NOT_CONNECTED for every pin, the RDP command sent, then QSPI is re-enabled normally&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/members/edvin-holmseth"&gt;Edvin&lt;/a&gt;&amp;nbsp;can you please provide input on the safest way to send an RDP for SDK 17.1.0? Use IO1 pulldown or disconnect the QSPI pins? I do realize that SDK 17.1.0 is in maintenance mode, so I&amp;#39;m not asking for a fix, just an opinion on the best option to work around it.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/491441?ContentTypeID=1</link><pubDate>Sat, 29 Jun 2024 19:17:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51a6a0e5-96f7-40f3-b51b-281942bf1d56</guid><dc:creator>robca</dc:creator><description>&lt;p&gt;I decided to test with a modified nrfx_qspi.c implementation. I cloned&amp;nbsp;nrfx_qspi_init() into&amp;nbsp;nrfx_qspi_init_rdp() and added the code to configure DIO1 with pulldown, init the QSPI peripheral, then within that same function call&amp;nbsp;nrfx_qspi_cinstr_xfer() with the 0xAB&amp;nbsp;CMD_RELEASE_PWRDOWN command, finally redefining DIO1 as the other QSPI pins.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Basically QSPI init for EEPROM devices in Deep Power Down Mode that require 0xAB to exit. I confirmed that when the peripheral sends the first 0x05 with the EEPROM in DPM, the status register reads 0x00 (no data), and as soon as the 0xAB is sent, the EEPROM status reads 0x40. And the QSPI doesn&amp;#39;t timeout, even if there&amp;#39;s nothing on DIO1. Here&amp;#39;s the trace of the &lt;span&gt;nrfx_qspi_init_rdp()&amp;nbsp;&lt;/span&gt;call followed by&amp;nbsp;nrfx_qspi_mem_busy_check() (which reads 0x40 as expected)&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1719688562410v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m posting the modified files for reference. Other people might find this ticket when dealing with modern NOR flash chips. Can&amp;#39;t promise it will work in all case, it&amp;#39;s not fully tested yet&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrf_5F00_drv_5F00_qspi.h"&gt;devzone.nordicsemi.com/.../nrf_5F00_drv_5F00_qspi.h&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrfx_5F00_qspi.c"&gt;devzone.nordicsemi.com/.../nrfx_5F00_qspi.c&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrfx_5F00_qspi.h"&gt;devzone.nordicsemi.com/.../nrfx_5F00_qspi.h&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/491424?ContentTypeID=1</link><pubDate>Fri, 28 Jun 2024 22:20:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3324925c-a870-4564-a07d-3712d19d8830</guid><dc:creator>robca</dc:creator><description>&lt;p&gt;Problem is: I need to save power, so I need to deinitialize the QSPI peripheral when in low power. Also, it will be disabled anyway when the device goes into sd_power_system_off(), and I need to initialize the QSPI to start sending commands.&lt;/p&gt;
&lt;p&gt;I already tried disabling&amp;nbsp;&lt;span&gt;qspi_ready_wait() in&amp;nbsp;nrfx_qspi_init() (or ignoring the error timeout), but the QSPI peripheral remains in error mode, and doesn&amp;#39;t send anything else. Is there a way to clear a pending error?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The most concerning thing for me now is that I noticed an inconsistency between the board with the dead bug soldering and another board. So I used a PCBite setup on the 4 SPI pins of the QSPI interface, for the non-working board (I only have 4 PCBite probes). Then that board started working, too (DPM and RDP). In the end, I verified that if I have a logic analyzer probe on DIO1, the QSPI peripheral never times out (even when sending 0x05 to a sleeping EEPROM and not receiving 0x40 as a response. Just DIO1, all other pins make no difference.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I think we used the recommended QSPI pins, minus P0.18 which in the past gave us problems with PINRESET. And those same pins work just fine for everything else, only recover from DPM is a problem.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;#define BSP_QSPI_CSN_PIN P0_16&lt;br /&gt;#define BSP_QSPI_SCK_PIN P0_19&lt;br /&gt;#define BSP_QSPI_IO0_PIN P0_21&lt;br /&gt;#define BSP_QSPI_IO1_PIN P0_22&lt;br /&gt;#define BSP_QSPI_IO2_PIN P0_23&lt;br /&gt;#define BSP_QSPI_IO3_PIN P1_00&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My logic analyzer (a DSlogic Plus) has never caused problems before, so I&amp;#39;m a a loss to understand how it could make such a huge difference for QSPI initialization. And I tried with an oscilloscope probe, which also is enough to solve the problem. So there&amp;#39;s some hair-trigger logic situation happening (on all boards, also checked)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Of course if we could clear the QSPI error and send 0xAB after the error, it shouldn&amp;#39;t matter&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And I just found a horrible hack that seems to work. By editing the&amp;nbsp;nrfx_qspi_init() and&amp;nbsp;nrfx_qspi_cinstr_xfer() functions to configure the DIO1 pin as input pulldown (instead of input nopull), the init function returns success, and so does sending 0xAB. Basically, forcing DIO1 low seems to prevent the QSPI peripheral from noticing that the QSPI chip is not responding, until it sends 0xAB and the chip responds again.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I created a clone of init and xfer, where I define the DIO1 pin as input pulldown on entry and redefine as input no pull on exit. The rest of the library is unchanged. I mean, I guess it could work, but I really don&amp;#39;t like this &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;. It&amp;#39;s &amp;quot;too clever by half&amp;quot; and those things tend to come back and bite.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/491280?ContentTypeID=1</link><pubDate>Fri, 28 Jun 2024 10:12:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d21eb20-c531-4004-81a9-c9183f81f8b7</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I see the same 0x05 as you see:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/0777.pastedimage1719569456651v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Out of curiousity, does it work if you don&amp;#39;t uninit the QSPI? But send the 0xAB like you did with the&amp;nbsp;CMD_DEEP_PWRDOWN packet? I don&amp;#39;t know the consequences of this yet, but it is worth a shot just to check that everything else is working as intended.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;edit: Or since we are already at this stage, what happens if you comment out the&amp;nbsp;qspi_ready_wait() in&amp;nbsp;nrfx_qspi_init(), and then send the 0xAB packet?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/491147?ContentTypeID=1</link><pubDate>Thu, 27 Jun 2024 14:00:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07d44436-26db-4616-8209-0b13a648f501</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;wow! This is great!&amp;nbsp;&lt;/p&gt;
[quote user="robca"]To be honest, dead-bug soldering eight 35AWG wires directly the bottom of the WSON-8 version of&amp;nbsp;&lt;span&gt;MX25U51245G&amp;nbsp;is not too bad,&lt;/span&gt;[/quote]
&lt;p&gt;I agree that it is doable, but I don&amp;#39;t have the chip-only either, so to test properly, I need some HW either way. And the breakout board is easier to re-purpose for different tests that may pop up later. I am sorry, but there is a lot to do, because many of our staff has started their summer holidays. I have modified my DK to be able to analyze the QSPI pins, but I have not yet been able to capture the trace. I will set it up, and see if I get time tonight.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I will get back to you with more updates.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/490968?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2024 23:51:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35c15d2c-9cf8-4435-ba28-e65b499a010d</guid><dc:creator>robca</dc:creator><description>&lt;p&gt;Once again, I appreciate everything you are doing. And, funny you should ask, but I came to the exact same conclusion: we were flying blind and it was unfair for me to ask you to help without a logic analyzer trace. So I bit the bullet, desoldered the chip and create a horrible rat&amp;#39;s nest of bodge wire.&lt;/p&gt;
&lt;p&gt;My logic analyzer channels are: 0 - clock, 1 - DIO0, 2 - DIO1, 3 - DIO2, 4 - DIO3, 5 - CS&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s what happens when&amp;nbsp;nrf_drv_qspi_init() runs. The QSPI peripheral actually sends 0x05 (Read Status Register), the EEPROM replies&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/QSPI_5F00_Init.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;Then we have configure_memory. As you can see, every instruction is preceded by sending once more 0x05. It looks as if every instruction starts with 0x05 again, but I&amp;#39;m not sure I understand the 0x06 (Write Enable) before 0x66 (Reset Enable), 0x99 (Reset) and the change to the configuration register 0x01 0x40&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/QSPI_5F00_config.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;Using your code, the instructions in line 5-12 look like this, i.e. sends yet another 0x05, followed by 0xB9 (deep power down)&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/QSPI_2D00_ifconfig.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;Incidentally, absolutely the same as this code&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    nrf_qspi_cinstr_conf_t cinstr_cfg = {
        .opcode    = CMD_DEEP_PWRDOWN,
        .length    = NRF_QSPI_CINSTR_LEN_1B,
        .io2_level = true, // High level during transmission
        .io3_level = true, // High level during transmission
        .wipwait   = true,
        .wren      = false};

    err_code = nrfx_qspi_cinstr_xfer(&amp;amp;cinstr_cfg, NULL, NULL);
    APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;as you can see here&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/QSPI_2D00_B9.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;Good, so now we are in deep sleep.&lt;/p&gt;
&lt;p&gt;Then we get to lines 16-21 in&amp;nbsp; your code snippet, which is supposed to wake up the EEPROM. As you can see, it simply tries to toggle CS as per the &amp;quot;old&amp;quot; EEPROM convention to exit DPM using only CS&amp;nbsp; (I needed to use 2 screengrabs due to the different zoom levels, look at the timing on top to make sense of them)&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/QSPI_2D00_RDP_2D00_init.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/QSPI_2D00_RDP_2D00_init2.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;The device is not out of DPM, though.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m seeing inconsistent results between the device I bodge-wired and another, and I need to do a bit more soldering, but wanted to start capturing some traces and share them.&lt;/p&gt;
&lt;p&gt;Also, if I read the spec sheet correctly, this device should work like mine, and exit DPM only when receiving 0xAB. But I haven&amp;#39;t tested it&amp;nbsp;&lt;a id="" href="https://www.adafruit.com/product/5634"&gt;https://www.adafruit.com/product/5634&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To be honest, dead-bug soldering eight 35AWG wires directly the bottom of the WSON-8 version of&amp;nbsp;&lt;span&gt;MX25U51245G&amp;nbsp;is not too bad, so I&amp;#39;m not entirely sure you need a breakout board for the tests&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: please let me know what traces you need. I&amp;#39;m seeing a slightly different behavior between the board with a dead bug soldered device and the unmodified one. I&amp;#39;m tired now, though, and I&amp;#39;m not sure if I&amp;#39;m doing something else wrong.&lt;/p&gt;
&lt;p&gt;But if there were a way to send 0xAB instead of 0x05 during the qspi init call ,that would solve all problems. Otherwise it looks as if the init returns timeout because there&amp;#39;s no reply from the EEPROM&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/490959?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2024 21:58:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3258cadb-0ccf-4f40-87b8-19fee81a6082</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="robca"]NRF_QSPI-&amp;gt;IFCONFIG so I used&amp;nbsp;NRF_QSPI-&amp;gt;IFCONFIG1 instead, I&amp;#39;m sure it&amp;#39;s just a typo)[/quote]
&lt;p&gt;Indeed.&lt;/p&gt;
[quote user="robca"]Is there a way to send 0xAB as a custom QSPI instruction instead of using&amp;nbsp;nrf_drv_qspi_cinstr_xfer()?[/quote]
&lt;p&gt;It is not very clear to me. I did see that it is part of the &lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52840/page/qspi.html#ariaid-title10"&gt;instruction set&lt;/a&gt;, but I am not yet sure how this is used.&lt;/p&gt;
&lt;p&gt;Do you have the possiblilty to analyze the QSPI pins using a logic analyzer to see whats actually happens when we try to reinitialize the QSPI and bring the chip back to life?&lt;/p&gt;
&lt;p&gt;I was planning on doing so, but I don&amp;#39;t have the QSPI flash chip that you are using. Also, it requires some modifications to the DK (which I can do), but if you have the possibility, it would perhaps give a better picture of what&amp;#39;s going on, since it seems to work without issues on my side.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Or even better, if we can both do it, we can compare the traces to see what it waits for. If not, I need to check if I can get hold of a breakout board with the QSPI chip that you are using. Are you aware of any breakout boards containing the flash chip that you are using?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/490725?ContentTypeID=1</link><pubDate>Tue, 25 Jun 2024 22:22:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce2beaed-92c7-4844-92cd-bdef63bba95e</guid><dc:creator>robca</dc:creator><description>&lt;p&gt;Thanks again for the code.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I first tried adding&amp;nbsp;&amp;nbsp;WAIT_FOR_PERIPH(); after the DPM instruction as you suggested, and it hangs forever. I believe that, at that point, the chip is already in DPM&lt;/p&gt;
&lt;p&gt;So I removed it and added the rest of your code (just a note that line 14 uses&amp;nbsp;NRF_QSPI-&amp;gt;IFCONFIG so I used&amp;nbsp;NRF_QSPI-&amp;gt;IFCONFIG1 instead, I&amp;#39;m sure it&amp;#39;s just a typo)&lt;/p&gt;
&lt;p&gt;This is what I get&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;[00:00:03.219,238] &amp;lt;info&amp;gt; app: after change: IFCONFIG1: F1040401
[00:00:03.219,238] &amp;lt;info&amp;gt; app: after uninit: IFCONFIG1: F1040401
[00:00:03.219,299] &amp;lt;info&amp;gt; app: QSPI closed in DPM.
[00:00:03.726,013] &amp;lt;info&amp;gt; app: after delay: F1040401
[00:00:03.726,013] &amp;lt;info&amp;gt; app: after change: IFCONFIG1: F0040401
[00:00:03.728,820] &amp;lt;info&amp;gt; app: QSPI opened again.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Alas, line 23 call to configure_memory() errs with the same&amp;nbsp;NRF_ERROR_TIMEOUT on the first nrf_drv_qspi_cinstr_xfer(). Since there is no 0xAB sent to the chip, it&amp;#39;s still in DPM. Not sure why this time the&amp;nbsp;nrf_drv_qspi_init() call worked (unlike in my case), but the QSPI peripheral doesn&amp;#39;t seem to be able to send anything&lt;/p&gt;
&lt;p&gt;I tried adding&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    nrf_qspi_cinstr_conf_t cinstr_cfg = {
        .opcode    = CMD_RELEASE_PWRDOWN,
        .length    = NRF_QSPI_CINSTR_LEN_1B,
        .io2_level = true, // High level during transmission
        .io3_level = true, // High level during transmission
        .wipwait   = true,
        .wren      = false};

    err_code = nrfx_qspi_cinstr_xfer(&amp;amp;cinstr_cfg, NULL, NULL);
    APP_ERROR_CHECK(err_code); &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;to actually send 0xAB, but it also errs on the&amp;nbsp;nrf_drv_qspi_cinstr_xfer() (&lt;span&gt;NRF_ERROR_TIMEOUT)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is there a way to send 0xAB as a custom QSPI instruction instead of using&amp;nbsp;nrf_drv_qspi_cinstr_xfer()?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/490508?ContentTypeID=1</link><pubDate>Tue, 25 Jun 2024 08:17:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dc97562-dd82-4880-a8d6-ee9ee7f7f85b</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I see.&lt;/p&gt;
&lt;p&gt;Unfortunately, I am not able to reproduce this with what I have at hand, because the QSPI chip on the DK reacts on the CSN pin only.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you please try to replace the rest of the main function, from line 115 in your snippet, with this one, and let me know what the log says?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    err_code = nrfx_qspi_cinstr_xfer(&amp;amp;cinstr_cfg, NULL, NULL);          // send deep power down instruction
    APP_ERROR_CHECK(err_code);
    WAIT_FOR_PERIPH();                                                  // Check if this one makes a difference first.

    NRF_QSPI-&amp;gt;IFCONFIG1 |= 0x01000000;
    nrf_delay_ms(100);
    NRF_LOG_INFO(&amp;quot;after change: IFCONFIG1: %08x&amp;quot;, NRF_QSPI-&amp;gt;IFCONFIG1);

    nrf_drv_qspi_uninit();
    NRF_LOG_INFO(&amp;quot;after uninit: IFCONFIG1: %08x&amp;quot;, NRF_QSPI-&amp;gt;IFCONFIG1);
    NRF_LOG_INFO(&amp;quot;QSPI closed in DPM.&amp;quot;);
    nrf_delay_ms(500);
    
    NRF_LOG_INFO(&amp;quot;after delay: %08x&amp;quot;, NRF_QSPI-&amp;gt;IFCONFIG);

    NRF_QSPI-&amp;gt;IFCONFIG1 &amp;amp;= ~(0x01000000);
    NRF_LOG_INFO(&amp;quot;after change: IFCONFIG1: %08x&amp;quot;, NRF_QSPI-&amp;gt;IFCONFIG1);

    err_code = nrf_drv_qspi_init(&amp;amp;config, qspi_handler, NULL);      // NRF_ERROR_TIMEOUT error here
    APP_ERROR_CHECK(err_code);
    NRF_LOG_INFO(&amp;quot;QSPI opened again.&amp;quot;);

    configure_memory();

    err_code = nrf_drv_qspi_read(m_buffer_rx, QSPI_TEST_DATA_SIZE, 0);
    WAIT_FOR_PERIPH();
    NRF_LOG_INFO(&amp;quot;Data read 2&amp;quot;);

    for (;;)
    {
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You can try only adding line 3 first, and then try to write to the IFCONFIG1 register. According to the documentation, this should be written to to enable DPM. Let me know whether it changes anything.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/490418?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2024 17:40:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a9dfd43-7ab9-40e1-a8a2-8f1953bd724e</guid><dc:creator>robca</dc:creator><description>&lt;p&gt;Thanks for looking into my issue.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using this code, a small variation of the code linked in the original question&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;quot;nrf_drv_qspi.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;app_util_platform.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;

#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;
#include &amp;quot;sdk_config.h&amp;quot;

#define QSPI_STD_CMD_WRSR   0x01
#define QSPI_STD_CMD_RSTEN  0x66
#define QSPI_STD_CMD_RST    0x99
#define CMD_DEEP_PWRDOWN    0xB9

#define QSPI_TEST_DATA_SIZE 256

#define WAIT_FOR_PERIPH() do { \
        while (!m_finished) {} \
        m_finished = false;    \
    } while (0)

static volatile bool m_finished = false;
static uint8_t m_buffer_tx[QSPI_TEST_DATA_SIZE];
static uint8_t m_buffer_rx[QSPI_TEST_DATA_SIZE];

static void qspi_handler(nrf_drv_qspi_evt_t event, void * p_context)
{
    UNUSED_PARAMETER(event);
    UNUSED_PARAMETER(p_context);
    m_finished = true;
}

static void configure_memory()
{
    uint8_t temporary = 0x40;
    uint32_t err_code;
    nrf_qspi_cinstr_conf_t cinstr_cfg = {
        .opcode    = QSPI_STD_CMD_RSTEN,
        .length    = NRF_QSPI_CINSTR_LEN_1B,
        .io2_level = true,
        .io3_level = true,
        .wipwait   = true,
        .wren      = true
    };

    // Send reset enable
    err_code = nrf_drv_qspi_cinstr_xfer(&amp;amp;cinstr_cfg, NULL, NULL);
    APP_ERROR_CHECK(err_code);

    // Send reset command
    cinstr_cfg.opcode = QSPI_STD_CMD_RST;
    err_code = nrf_drv_qspi_cinstr_xfer(&amp;amp;cinstr_cfg, NULL, NULL);
    APP_ERROR_CHECK(err_code);

    // Switch to qspi mode
    cinstr_cfg.opcode = QSPI_STD_CMD_WRSR;
    cinstr_cfg.length = NRF_QSPI_CINSTR_LEN_2B;
    err_code = nrf_drv_qspi_cinstr_xfer(&amp;amp;cinstr_cfg, &amp;amp;temporary, NULL);
    APP_ERROR_CHECK(err_code);
}


int main(void)
{
    uint32_t i;
    uint32_t err_code;

    err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);

    NRF_LOG_DEFAULT_BACKENDS_INIT();

    NRF_LOG_INFO(&amp;quot;&amp;quot;
                 &amp;quot;QSPI write and read example using 24bit addressing mode&amp;quot;);

    srand(0);
    for (i = 0; i &amp;lt; QSPI_TEST_DATA_SIZE; ++i)
    {
        m_buffer_tx[i] = (uint8_t)rand();
    }

    nrf_drv_qspi_config_t config = NRF_DRV_QSPI_DEFAULT_CONFIG;

    config.phy_if.dpmen = false;
    config.prot_if.dpmconfig = true;
    NRF_QSPI-&amp;gt;DPMDUR = (0x3 &amp;lt;&amp;lt; 16) | 0x3;
    
    err_code = nrf_drv_qspi_init(&amp;amp;config, qspi_handler, NULL);
    APP_ERROR_CHECK(err_code);
    NRF_LOG_INFO(&amp;quot;QSPI example started.&amp;quot;);

    configure_memory();

    m_finished = false;

    err_code = nrf_drv_qspi_read(m_buffer_rx, QSPI_TEST_DATA_SIZE, 0);
    WAIT_FOR_PERIPH();
    NRF_LOG_INFO(&amp;quot;Data read&amp;quot;);

    uint32_t nConfigOld = NRF_QSPI-&amp;gt;IFCONFIG1;

    nrf_qspi_cinstr_conf_t cinstr_cfg = {
        .opcode    = CMD_DEEP_PWRDOWN,
        .length    = NRF_QSPI_CINSTR_LEN_1B,
        .io2_level = true, // High level during transmission
        .io3_level = true, // High level during transmission
        .wipwait   = true,
        .wren      = false};

    err_code = nrfx_qspi_cinstr_xfer(&amp;amp;cinstr_cfg, NULL, NULL);          // send deep power down instruction
    APP_ERROR_CHECK(err_code);

    nrf_drv_qspi_uninit();
    NRF_LOG_INFO(&amp;quot;QSPI closed in DPM.&amp;quot;);
    nrf_delay_ms(500);

    NRF_QSPI-&amp;gt;IFCONFIG1 = nConfigOld;

    err_code = nrf_drv_qspi_init(&amp;amp;config, qspi_handler, NULL);      // NRF_ERROR_TIMEOUT error here
    APP_ERROR_CHECK(err_code);
    NRF_LOG_INFO(&amp;quot;QSPI opened again.&amp;quot;);

    configure_memory();

    err_code = nrf_drv_qspi_read(m_buffer_rx, QSPI_TEST_DATA_SIZE, 0);
    WAIT_FOR_PERIPH();
    NRF_LOG_INFO(&amp;quot;Data read 2&amp;quot;);

    for (;;)
    {
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This code works for any SPI NOR flash chip that can be released from deep power down using the CS line. For most NOR flash chips, the datasheet says&amp;nbsp;&amp;ldquo;After CS# goes high, there is a delay of tRDP before the device transitions from Deep Power-down mode back to Stand-by mode.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;In the newer 512 Mbit chips (all of them, not just mine), the device doesn&amp;#39;t exit deep power down only using the CS line, it explicitly requires a 0xAB instruction to release. Problem is, the QSPI peripheral won&amp;#39;t let me send anything, can&amp;#39;t even complete the init function.&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t connected a logic analyzer yet, because it would require removing the chip and soldering wires. But from everything I have seen, when initializing the QSPI peripheral, it sends 0x05 to the chip to verify that a chip is connected. In my case, the chip ignores the 0x05 because the only instruction it recognizes&amp;nbsp;is 0xAB. So QSPI times out (I changed&amp;nbsp;&lt;span&gt;QSPI_DEF_WAIT_TIME_US&amp;nbsp; but it makes no difference, given it&amp;#39;s not a real timeout issue)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I need a way to either change the QSPI peripheral initialization to send 0xAB instead of 0x05, or a way to &amp;quot;trick&amp;quot; the QSPI peripheral to initialize even if the flash chip doesn&amp;#39;t reply, so that I can send 0xAB either as a custom instruction or a&amp;nbsp;nrfx_qspi_cinstr_xfer()&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Let me try to convey why this is more than just a minor issue for a specific case: all new 256/512Mbit chips cannot exit deep power down only by using CS, as far as I can tell. They all need the 0xAB instruction (it&amp;#39;s done to improve security and avoid exiting low power by&amp;nbsp; mistake). As such, none of those chips can be properly used by the nRF52840 QSPI when extreme low power is needed.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot exit deep power down mode (QSPI flash)</title><link>https://devzone.nordicsemi.com/thread/490337?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2024 14:01:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82bb9fe5-bcb5-408d-8be1-39b311754bb9</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t have the same flash chip that you are using, but have you tried to use a logic analyzer and capture a logic trace of when the NRF_QSPI_TASKS_ACTIVATE is called? Does it generate any data on the QSPI pins? Have you tried to increase the QSPI_DEF_WAIT_TIME_US from 10 to a higher number? Just for debugging purposes.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, is it possible to upload the application that you are using to reproduce this issue?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>