Facing issue in resetting the QSPI NOR flash from program in NCS 2.4.0

Hi, I am using a external QSPI NOR FLASH with my DevKit of NRF52840. Due to some project requirements I have to reset the Flash chip using the QSPI reset command. Previously while working with Nrf SDK 17.0.1, I have access to send the custom command to Flash Chip using which I was able to reset the Flash from program. For example

uint8_t statusRegisterData = 0x02;
    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(&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(&cinstr_cfg, NULL, NULL);
    APP_ERROR_CHECK(err_code);

Using above code.

I am facing issue in doing the same in Nrf Connect SDK 2.4.0 for the same , as I do not have access to use these internal functions. Please suggest me how to achieve similar functionality in Nrf Connect SDK . 

Parents
  • Hi there,

    As of now, for sending custom QSPI instructions you need to access the QSPI nrfx driver directly by calling nrfx_qspi_cinstr_xfer().

    regards

    Jared 

  • Hi there, thanks for reply and suggestion, as if I understand correct, your suggesting something like this .  I have some queries after this implementation. 

    Do I need to call qspi_init function again after resetting the External flash or before calling this function ? As I have checked the code internally QSPI peripheral get uinit and init .

    I have checked the  "qspi_send_cmd" function  which is used inside the SDK for sending some command to given registers , can I use that ?


    Can I directly reset the flash and start using it there after ?

     

        uint8_t statusRegisterData = 0x02;
        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 = nrfx_qspi_cinstr_xfer(&cinstr_cfg, NULL, NULL);
        APP_ERROR_CHECK(err_code);
    
        // Send reset command
        cinstr_cfg.opcode = QSPI_STD_CMD_RST;
        err_code = nrfx_qspi_cinstr_xfer(&cinstr_cfg, NULL, NULL);
        APP_ERROR_CHECK(err_code);
    

  • Sarvesh said:

    Do I need to call qspi_init function again after resetting the External flash or before calling this function ? As I have checked the code internally QSPI peripheral get uinit and init .

    What do you mean, where does the QSPI peripheral get unint and init?

    Sarvesh said:
    I have checked the  "qspi_send_cmd" function  which is used inside the SDK for sending some command to given registers , can I use that ?

    Actually yes you can use that as it calls nrfx_qspi_cinstr_xfer() internally,

    regards

    Jared

  • Hi Jared,  Thanks for your reply, I have tried your way but did not worked out, I dived little more in side the SDK and found that we can set the enter and exit from deep sleep from in built SDK functions. And the following changes are required in overlay file. I have added those and able to set the flash in deep sleep. I can confirm this with the current consumption of my device. But the issue is , I am unable to exit the flash from deep sleep. Please help me with that .

    &qspi {
    	pinctrl-0 = <&qspi_default>;
    	pinctrl-1 = <&qspi_sleep>;
    	pinctrl-names = "default", "sleep";
    	mx25r64: mx25r6435f@0 {
    		compatible = "nordic,qspi-nor";
    		reg = <0>;
    		//changes for GD25Q32E
    		quad-enable-requirements = "S2B1v1";
    		writeoc = "pp4o";
    		readoc = "read4io";
    		sck-frequency = <24000000>; //Note: Can't achieve 32MHz.
    		jedec-id = [ c8 40 16  ];
    		size = <33554432>;
    		has-dpd;
    		t-enter-dpd = < 0x2710 >;
            t-exit-dpd = < 0x88b8 >;
    	};
    };

    These are the inbuilt functions which I am using to enter or exit from the deep sleep for the flash

    pm_device_action_run(flash_dev, PM_DEVICE_ACTION_RESUME);
    pm_device_action_run(flash_dev, PM_DEVICE_ACTION_SUSPEND);

    I have taken reference from file and as here suggested my qspi flash supports these command for DPD. RDPD

    has-dpd:
        type: boolean
        description: |
          Indicates the device supports the DPD (0xB9) command.
    
          Use this property to indicate the flash chip supports the Deep
          Power-Down mode that is entered by command 0xB9 to reduce power
          consumption below normal standby levels.  Use of this property
          implies that the RDPD (0xAB) Release from Deep Power Down command
          is also supported.  (On some chips this command functions as Read
          Electronic Signature; see t-enter-dpd).
          
          t-enter-dpd:
        type: int
        description: |
          Duration required to complete the DPD command.
    
          This provides the duration, in nanoseconds, that CSn must be
          remain deasserted after issuing DPD before the chip will enter
          deep power down.
    
          If not provided the driver does not enforce a delay.
    
      t-exit-dpd:
        type: int
        description: |
          Duration required to complete the RDPD command.
    
          This provides the duration, in nanoseconds, that CSn must be
          remain deasserted after issuing RDPD before the chip will exit
          deep power down and be ready to receive additional commands.
    
          If not provided the driver does not enforce a delay.

    I have checked here 

    Please let me know if you need any more info.

Reply
  • Hi Jared,  Thanks for your reply, I have tried your way but did not worked out, I dived little more in side the SDK and found that we can set the enter and exit from deep sleep from in built SDK functions. And the following changes are required in overlay file. I have added those and able to set the flash in deep sleep. I can confirm this with the current consumption of my device. But the issue is , I am unable to exit the flash from deep sleep. Please help me with that .

    &qspi {
    	pinctrl-0 = <&qspi_default>;
    	pinctrl-1 = <&qspi_sleep>;
    	pinctrl-names = "default", "sleep";
    	mx25r64: mx25r6435f@0 {
    		compatible = "nordic,qspi-nor";
    		reg = <0>;
    		//changes for GD25Q32E
    		quad-enable-requirements = "S2B1v1";
    		writeoc = "pp4o";
    		readoc = "read4io";
    		sck-frequency = <24000000>; //Note: Can't achieve 32MHz.
    		jedec-id = [ c8 40 16  ];
    		size = <33554432>;
    		has-dpd;
    		t-enter-dpd = < 0x2710 >;
            t-exit-dpd = < 0x88b8 >;
    	};
    };

    These are the inbuilt functions which I am using to enter or exit from the deep sleep for the flash

    pm_device_action_run(flash_dev, PM_DEVICE_ACTION_RESUME);
    pm_device_action_run(flash_dev, PM_DEVICE_ACTION_SUSPEND);

    I have taken reference from file and as here suggested my qspi flash supports these command for DPD. RDPD

    has-dpd:
        type: boolean
        description: |
          Indicates the device supports the DPD (0xB9) command.
    
          Use this property to indicate the flash chip supports the Deep
          Power-Down mode that is entered by command 0xB9 to reduce power
          consumption below normal standby levels.  Use of this property
          implies that the RDPD (0xAB) Release from Deep Power Down command
          is also supported.  (On some chips this command functions as Read
          Electronic Signature; see t-enter-dpd).
          
          t-enter-dpd:
        type: int
        description: |
          Duration required to complete the DPD command.
    
          This provides the duration, in nanoseconds, that CSn must be
          remain deasserted after issuing DPD before the chip will enter
          deep power down.
    
          If not provided the driver does not enforce a delay.
    
      t-exit-dpd:
        type: int
        description: |
          Duration required to complete the RDPD command.
    
          This provides the duration, in nanoseconds, that CSn must be
          remain deasserted after issuing RDPD before the chip will exit
          deep power down and be ready to receive additional commands.
    
          If not provided the driver does not enforce a delay.

    I have checked here 

    Please let me know if you need any more info.

Children
Related