<?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>Not able to initalize the QSPI module.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36590/not-able-to-initalize-the-qspi-module</link><description>Hi Everyone 
 
 *ITS VERY URGENT ISSUE*. 
 
 I am using nrf52840 PDK with segger embedded IDE. 
 I was trying to use the QSPI module to write data to the external flash memory. 
 But I am not able to initialize the QSPI module. 
 It throws error &amp;quot;NRF_TIMEOUT_ERROR</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 11 Dec 2019 09:39:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36590/not-able-to-initalize-the-qspi-module" /><item><title>RE: Not able to initalize the QSPI module.</title><link>https://devzone.nordicsemi.com/thread/224871?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 09:39:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2744790a-24fe-4ddb-b4bd-85b31f45a285</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;NRF_ERROR_TIMEOUT is thrown &amp;quot;&lt;span&gt;If the peripheral cannot connect with external memory&amp;quot;. Please check your wiring. If this does not help, please post a new thread where you described your issue in detail.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to initalize the QSPI module.</title><link>https://devzone.nordicsemi.com/thread/224816?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 20:29:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:453dedf8-5b4f-447b-aba0-64d11981efe1</guid><dc:creator>kshitiz</dc:creator><description>&lt;p&gt;I&amp;#39;m using the adafruit nrf52840 feather - and I get the same error (&lt;span&gt;NRF_TIMEOUT_ERROR&lt;/span&gt;) while calling&amp;nbsp;nrf_drv_qspi_init(). This is when running the example in &amp;quot;../examples/peripheral/qspi&amp;quot;. I&amp;#39;m using nrf sdk 15.3.0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to initalize the QSPI module.</title><link>https://devzone.nordicsemi.com/thread/160302?ContentTypeID=1</link><pubDate>Wed, 05 Dec 2018 06:35:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60fa92f3-f0f7-4903-89c2-f6b37e795e48</guid><dc:creator>Rajat</dc:creator><description>&lt;p&gt;For me the problem was quite weird.&lt;/p&gt;
&lt;p&gt;I was using a template project and added the ble files on top of it, Which was causing the problems .&lt;/p&gt;
&lt;p&gt;So i took the ble template instead and added my other files on top of that.&lt;/p&gt;
&lt;p&gt;It worked for me.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Check if it works for you ?&lt;/p&gt;
&lt;p&gt;and Did you try running the example code?&lt;/p&gt;
&lt;p&gt;Does that work fine?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to initalize the QSPI module.</title><link>https://devzone.nordicsemi.com/thread/160110?ContentTypeID=1</link><pubDate>Tue, 04 Dec 2018 05:33:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a974f11-e3f4-46b0-ab19-092e58f4044a</guid><dc:creator>chaoren2651</dc:creator><description>&lt;p&gt;I encounterd this probem too, how did you solved it? thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to initalize the QSPI module.</title><link>https://devzone.nordicsemi.com/thread/141396?ContentTypeID=1</link><pubDate>Wed, 25 Jul 2018 16:01:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2580514c-bca2-4f3c-9c4d-5c37694ee16e</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Can you upload the entire project for us to do some debugging?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to initalize the QSPI module.</title><link>https://devzone.nordicsemi.com/thread/141389?ContentTypeID=1</link><pubDate>Wed, 25 Jul 2018 15:48:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca02c152-b18c-46ee-b7ee-eed414cdbca3</guid><dc:creator>Rajat</dc:creator><description>&lt;p&gt;Yes example code is working fine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to initalize the QSPI module.</title><link>https://devzone.nordicsemi.com/thread/141386?ContentTypeID=1</link><pubDate>Wed, 25 Jul 2018 15:39:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a19a37b7-2ada-4a5d-b1b0-3854e47462ce</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Did you test the&amp;nbsp;&lt;a title="QSPI Example" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/qspi_example.html?cp=4_0_0_4_5_25"&gt;QSPI Example&lt;/a&gt;&amp;nbsp;from the SDK, to make sure the board/device is working as expected?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to initalize the QSPI module.</title><link>https://devzone.nordicsemi.com/thread/140977?ContentTypeID=1</link><pubDate>Mon, 23 Jul 2018 12:32:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f240b3b9-cd0e-4285-a702-68bb33b598b0</guid><dc:creator>Rajat</dc:creator><description>&lt;p&gt;I am using 15.0 version of SDK.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;nrf_drv_qspi_init() function is throwing error.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am using nrf52840 PDK and QSPI device is the onboard external memory of 64Mb(&amp;nbsp;mx25R6435F ,&amp;nbsp; , so the connections would be correct ).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to initalize the QSPI module.</title><link>https://devzone.nordicsemi.com/thread/140975?ContentTypeID=1</link><pubDate>Mon, 23 Jul 2018 12:28:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9221d6e5-2552-45e6-a8c1-6c155df88abc</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Which functioncall is returning&amp;nbsp;NRF_TIMEOUT_ERROR? I can&amp;#39;t see this error code used in the QSPI driver. Which QSPI device are you interfacing? Have you checked that the connections are correct?&lt;/p&gt;
&lt;p&gt;Which SDK version are you using? I would recommend that you switch to using the &lt;a href="https://www.nordicsemi.com/eng/Products/nRF52840-DK"&gt;nRF52840-DK&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to initalize the QSPI module.</title><link>https://devzone.nordicsemi.com/thread/140959?ContentTypeID=1</link><pubDate>Mon, 23 Jul 2018 11:19:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f4787c2-40b2-4c6a-8f7e-9154c7eb14a0</guid><dc:creator>Rajat</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
 * 
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form, except as embedded into a Nordic
 *    Semiconductor ASA integrated circuit in a product or a software update for
 *    such product, must reproduce the above copyright notice, this list of
 *    conditions and the following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 * 
 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 * 
 * 4. This software, with or without modification, must only be used with a
 *    Nordic Semiconductor ASA integrated circuit.
 * 
 * 5. Any software provided in binary form under this license must not be reverse
 *    engineered, decompiled, modified and/or disassembled.
 * 
 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA &amp;quot;AS IS&amp;quot; AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */
/** @file
 *
 * @defgroup ble_sdk_uart_over_ble_main main.c
 * @{
 * @ingroup  ble_sdk_app_nus_eval
 * @brief    UART over BLE application main file.
 *
 * This file contains the source code for a sample application that uses the Nordic UART service.
 * This application uses the @ref srvlib_conn_params module.
 */

#define TASK_DELAY        80           /**&amp;lt; No of ticks */

#include &amp;quot;BLE_INTERRA.h&amp;quot;
#include &amp;quot;UART.h&amp;quot;
#include &amp;quot;FreeRTOS.h&amp;quot;
#include &amp;quot;task.h&amp;quot;
#include &amp;quot;timers.h&amp;quot;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;nrf_drv_clock.h&amp;quot;
#include &amp;quot;sdk_errors.h&amp;quot;
#include &amp;quot;semphr.h&amp;quot;

#include &amp;quot;nrf_drv_qspi.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;


#define QSPI_STD_CMD_WRSR   0x01
#define QSPI_STD_CMD_RSTEN  0x66
#define QSPI_STD_CMD_RST    0x99

#define QSPI_TEST_DATA_SIZE 256



TaskHandle_t led_toggle_task0_handle;
TaskHandle_t led_toggle_task1_handle;
TaskHandle_t led_toggle_task2_handle;
TaskHandle_t led_toggle_task3_handle;
TaskHandle_t uart_put_char_task_handle;
TaskHandle_t ble_put_task_handle;

#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 uint16_t   m_conn_handle          = BLE_CONN_HANDLE_INVALID;                 /**&amp;lt; Handle of the current connection. */
static uint16_t   m_ble_nus_max_data_len = BLE_GATT_ATT_MTU_DEFAULT - 3;            /**&amp;lt; Maximum length of data (in bytes) that can be transmitted to the peer by the Nordic UART service module. */

static ble_uuid_t m_adv_uuids[]          =                                          /**&amp;lt; Universally unique service identifier. */
{
    {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE}
};

static void configure_memory();
void write_and_check();

static void qspi_handler(nrf_drv_qspi_evt_t event, void * p_context)
{
    UNUSED_PARAMETER(event);
    UNUSED_PARAMETER(p_context);
    m_finished = true;
}



/*
FREE RTOS FUNCTIONS 
*/

void led_toggle_task0_function (void * pvParameter)
{
    UNUSED_PARAMETER(pvParameter);
    TickType_t xLastWakeTime;
 const TickType_t xFrequency = TASK_DELAY;
 xLastWakeTime = xTaskGetTickCount();
    
    while (true)
    {
        
        bsp_board_led_invert(BSP_BOARD_LED_0);
       vTaskDelayUntil( &amp;amp;xLastWakeTime, xFrequency );
        /* Delay a task for a given number of ticks */
       
        

        /* Tasks must be implemented to never return... */
    }
}

void led_toggle_task1_function (void * pvParameter)
{
    UNUSED_PARAMETER(pvParameter);
     TickType_t xLastWakeTime;
 const TickType_t xFrequency = TASK_DELAY;
 xLastWakeTime = xTaskGetTickCount();
    
    while (true)
    {   
        
        bsp_board_led_invert(BSP_BOARD_LED_1);

        /* Delay a task for a given number of ticks */
       vTaskDelayUntil( &amp;amp;xLastWakeTime, xFrequency );
        
        /* Tasks must be implemented to never return... */
    }
}

void led_toggle_task2_function (void * pvParameter)
{
    UNUSED_PARAMETER(pvParameter);
    
       TickType_t xLastWakeTime;
 const TickType_t xFrequency =TASK_DELAY;
 xLastWakeTime = xTaskGetTickCount();
  
    while (true)
    {
   
        bsp_board_led_invert(BSP_BOARD_LED_2);

        /* Delay a task for a given number of ticks */
         vTaskDelayUntil( &amp;amp;xLastWakeTime, xFrequency );
        
        /* Tasks must be implemented to never return... */
    }
}
void led_toggle_task3_function (void * pvParameter)
{
    UNUSED_PARAMETER(pvParameter);
           TickType_t xLastWakeTime;
 const TickType_t xFrequency = TASK_DELAY;
 xLastWakeTime = xTaskGetTickCount();
    
    while (true)
    {
    
        bsp_board_led_invert(BSP_BOARD_LED_3);

        /* Delay a task for a given number of ticks */
        vTaskDelayUntil( &amp;amp;xLastWakeTime, xFrequency );
        
       
        /* Tasks must be implemented to never return... */
    }
}
void uart_put_char_task_function(void * pvParameter)
{
UNUSED_PARAMETER(pvParameter);

 TickType_t xLastWakeTime;
 const TickType_t xFrequency = TASK_DELAY;
 xLastWakeTime = xTaskGetTickCount();
int uart_rx=8;
int uart_tx=6;
char val=&amp;#39;R&amp;#39;;
char *val_str=&amp;quot;Hey You! by Pink Floyd&amp;quot;;
uart_init_terra(uart_rx,uart_tx);
while(1)
{
    uart_write_char(&amp;#39;d&amp;#39;);
    uart_write_data(val_str);
   
   
   vTaskDelayUntil( &amp;amp;xLastWakeTime, xFrequency );
   

}


}

void ble_put_task_function(void * pvParameter)
{
UNUSED_PARAMETER(pvParameter);

TickType_t xLastWakeTime;
 const TickType_t xFrequency = TASK_DELAY;
 xLastWakeTime = xTaskGetTickCount();
char *my_data=&amp;quot;Mydata123#@12&amp;quot;;


init_ble();
while(1)
{

    start(my_data);
    vTaskDelayUntil(&amp;amp;xLastWakeTime, xFrequency );
   
}
}




int main(void)
{
     
    //printf(&amp;quot;Before Task Creation : %d\n&amp;quot;,xPortGetFreeHeapSize());
   ret_code_t err_code;
  
    /* Initialize clock driver for better time accuracy in FREERTOS */
    err_code = nrf_drv_clock_init();
    APP_ERROR_CHECK(err_code);
   write_and_check();
    /* Configure LED-pins as outputs */
    //bsp_board_init(BSP_INIT_LEDS);
  
   
  // bsp_board_led_invert(BSP_BOARD_LED_1)
  UNUSED_VARIABLE(xTaskCreate(led_toggle_task0_function, &amp;quot;L0&amp;quot;, configMINIMAL_STACK_SIZE+50 , NULL, 2, &amp;amp;led_toggle_task0_handle));
  //UNUSED_VARIABLE(xTaskCreate(led_toggle_task1_function, &amp;quot;L1&amp;quot;, configMINIMAL_STACK_SIZE+30 , NULL, 2, &amp;amp;led_toggle_task1_handle));
 //UNUSED_VARIABLE(xTaskCreate(led_toggle_task2_function, &amp;quot;L2&amp;quot;, configMINIMAL_STACK_SIZE+30 , NULL, 2, &amp;amp;led_toggle_task2_handle));
 //UNUSED_VARIABLE(xTaskCreate(led_toggle_task3_function, &amp;quot;L3&amp;quot;, configMINIMAL_STACK_SIZE+30 , NULL, 2, &amp;amp;led_toggle_task3_handle));
//UNUSED_VARIABLE(xTaskCreate(uart_put_char_task_function, &amp;quot;U1&amp;quot;, configMINIMAL_STACK_SIZE + 100, NULL,1, &amp;amp;uart_put_char_task_handle));
  //UNUSED_VARIABLE(xTaskCreate(ble_put_task_function, &amp;quot;le&amp;quot;,configMINIMAL_STACK_SIZE + 200, NULL, 2, &amp;amp;ble_put_task_handle));  
    
    /* Activate deep sleep mode */
   //SCB-&amp;gt;SCR |= SCB_SCR_SLEEPDEEP_Msk;
  
    //printf(&amp;quot;After Task Creation : %d\n&amp;quot;,xPortGetFreeHeapSize());
    /* Start FreeRTOS scheduler. */
  vTaskStartScheduler();
    while(1);

}
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);
}




void write_and_check()
{

     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;);

    
    for (i = 0; i &amp;lt; QSPI_TEST_DATA_SIZE; ++i)
    {
        m_buffer_tx[i] = 52;
    }

    nrf_drv_qspi_config_t config = NRF_DRV_QSPI_DEFAULT_CONFIG;

    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_erase(NRF_QSPI_ERASE_LEN_4KB, 0);
    APP_ERROR_CHECK(err_code);
    WAIT_FOR_PERIPH();
    NRF_LOG_INFO(&amp;quot;Proc ess of erasing first block start&amp;quot;);

    err_code = nrf_drv_qspi_write(m_buffer_tx, QSPI_TEST_DATA_SIZE, 0);
    APP_ERROR_CHECK(err_code);
    WAIT_FOR_PERIPH();
    NRF_LOG_INFO(&amp;quot;Process of writing data start&amp;quot;);

    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;);
    NRF_LOG_INFO(&amp;quot;%d&amp;quot;,m_buffer_rx[2]);
    NRF_LOG_INFO(&amp;quot;Compare...&amp;quot;);
    if (memcmp(m_buffer_tx, m_buffer_rx, QSPI_TEST_DATA_SIZE) == 0)
    {
        NRF_LOG_INFO(&amp;quot;Data consistent&amp;quot;);
    }
    else
    {
        NRF_LOG_INFO(&amp;quot;Data inconsistent&amp;quot;);
    }

    nrf_drv_qspi_uninit();

   
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is the code that i have been using&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>