This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF52840 Problems Reading from QSPI Flash W25q32jv.

Hi ,

Im trying to read and write data from QSPI w25q32jv chip, for which i get faulty data .

I have used this example : https://github.com/jimmywong2003/nrf52840-QSPI-flash-example

I'm using Raytec Module which utilizes the 52840 chip as an BLE SoC.

I'm trying to write data at offset 0X210000 and read the data for which im observing that the data is getting stored (i guess) after 2 locations.

Please help.

Thanks,

Dhananjay Sutariya

Parents
  • Hi,

    Please provide the details about the failure case.

    if you use my example of the QSPI on the non-Nordic DK board, you need to configure the pin assignment inside the sdk_config.h.

    https://github.com/jimmywong2003/nrf52840-QSPI-flash-example/blob/master/qspi_module_example/pca10056/blank/config/sdk_config.h

    Also, you need to check with the qspi flash on the mode such as read mode / write mode.

    // <0=> FastRead
    // <1=> Read2O
    // <2=> Read2IO
    // <3=> Read4O
    // <4=> Read4IO
    
    #ifndef NRFX_QSPI_CONFIG_READOC
    #define NRFX_QSPI_CONFIG_READOC 4
    #endif
    
    // <o> NRFX_QSPI_CONFIG_WRITEOC  - Number of data lines and opcode used for writing.
    
    // <0=> PP
    // <1=> PP2O
    // <2=> PP4O
    // <3=> PP4IO
    
    #ifndef NRFX_QSPI_CONFIG_WRITEOC
    #define NRFX_QSPI_CONFIG_WRITEOC 3
    #endif

  • Hi,

    Thanks for your response,

    I've already had the changes suggested by you in my sdkconfig file.

    I have taken my data array of uint8_t of size 0X08 which is 4 byte aligned.

    which gets loaded in this loop:

         for (i = 0; i < QSPI_TEST_DATA_SIZE; ++i)
            {
                    m_buffer_tx[i] = (uint8_t)rand()%10;
                    //NRF_LOG_INFO("[Main]Write data %u",m_buffer_tx[i]);
    
            }
    

    Before drv_write api is called i check my  buffer using this part of code in flash_qspi_write

             for (uint8_t i = 0; i < QSPI_TEST_DATA_SIZE; ++i)
            {
                    //m_buffer_tx[i] = (uint32_t)rand()%20;
                    NRF_LOG_INFO("[flash_qspi_write]Write data %u at index[0X%x]",p_tx_buffer[i],i);
    
            }

    And after the data is read i print it inside the flash_qspi_read 

             for (uint8_t i = 0; i < QSPI_TEST_DATA_SIZE   ; ++i)
            {
                    //m_buffer_tx[i] = (uint32_t)rand()%20;
                    NRF_LOG_INFO("[flash_qspi_read]Read data %u at index [0X%x]",p_rx_buffer[i],i);
    
            }

    My output shows the shift here:

    <info> app: Process of erasing first block start
    <info> app: [flash_qspi_write]Write data 17039360 at index[0X0]
    <info> app: [flash_qspi_write]Write data 151191808 at index[0X1]
    <info> app: [flash_qspi_write]Write data 1081344 at index[0X2]
    <info> app: [flash_qspi_write]Write data 5849 at index[0X3]
    <info> app: [flash_qspi_write]Write data 1 at index[0X4]
    <info> app: [flash_qspi_write]Write data 5849 at index[0X5]
    <info> app: [flash_qspi_write]Write data 8 at index[0X6]
    <info> app: [flash_qspi_write]Write data 1081344 at index[0X7]
    <info> app: eflash_QSPI_WRITE_REQ
    <info> app: eflash_QSPI_WRITE_DONE
    <info> app: Process of writing data start at 0X108000
    <info> app: writing data Succ

    <info> app: eflash_QSPI_READ_REQ
    <info> app: flash_qspi_read: address = 108000, len = 8
    <info> app: eflash_QSPI_READ_DONE
    <info> app: [flash_qspi_read]Read data 3149642683 at index [0X0]
    <info> app: [flash_qspi_read]Read data 3149642683 at index [0X1]
    <info> app: [flash_qspi_read]Read data 17039360 at index [0X2]
    <info> app: [flash_qspi_read]Read data 151191808 at index [0X3]
    <info> app: [flash_qspi_read]Read data 1081344 at index [0X4]
    <info> app: [flash_qspi_read]Read data 5849 at index [0X5]
    <info> app: [flash_qspi_read]Read data 1 at index [0X6]
    <info> app: [flash_qspi_read]Read data 5849 at index [0X7]
    <info> app: Data read at line :256 .

    I guess this is alignment error of some sorts. How do we cope with that.

Reply
  • Hi,

    Thanks for your response,

    I've already had the changes suggested by you in my sdkconfig file.

    I have taken my data array of uint8_t of size 0X08 which is 4 byte aligned.

    which gets loaded in this loop:

         for (i = 0; i < QSPI_TEST_DATA_SIZE; ++i)
            {
                    m_buffer_tx[i] = (uint8_t)rand()%10;
                    //NRF_LOG_INFO("[Main]Write data %u",m_buffer_tx[i]);
    
            }
    

    Before drv_write api is called i check my  buffer using this part of code in flash_qspi_write

             for (uint8_t i = 0; i < QSPI_TEST_DATA_SIZE; ++i)
            {
                    //m_buffer_tx[i] = (uint32_t)rand()%20;
                    NRF_LOG_INFO("[flash_qspi_write]Write data %u at index[0X%x]",p_tx_buffer[i],i);
    
            }

    And after the data is read i print it inside the flash_qspi_read 

             for (uint8_t i = 0; i < QSPI_TEST_DATA_SIZE   ; ++i)
            {
                    //m_buffer_tx[i] = (uint32_t)rand()%20;
                    NRF_LOG_INFO("[flash_qspi_read]Read data %u at index [0X%x]",p_rx_buffer[i],i);
    
            }

    My output shows the shift here:

    <info> app: Process of erasing first block start
    <info> app: [flash_qspi_write]Write data 17039360 at index[0X0]
    <info> app: [flash_qspi_write]Write data 151191808 at index[0X1]
    <info> app: [flash_qspi_write]Write data 1081344 at index[0X2]
    <info> app: [flash_qspi_write]Write data 5849 at index[0X3]
    <info> app: [flash_qspi_write]Write data 1 at index[0X4]
    <info> app: [flash_qspi_write]Write data 5849 at index[0X5]
    <info> app: [flash_qspi_write]Write data 8 at index[0X6]
    <info> app: [flash_qspi_write]Write data 1081344 at index[0X7]
    <info> app: eflash_QSPI_WRITE_REQ
    <info> app: eflash_QSPI_WRITE_DONE
    <info> app: Process of writing data start at 0X108000
    <info> app: writing data Succ

    <info> app: eflash_QSPI_READ_REQ
    <info> app: flash_qspi_read: address = 108000, len = 8
    <info> app: eflash_QSPI_READ_DONE
    <info> app: [flash_qspi_read]Read data 3149642683 at index [0X0]
    <info> app: [flash_qspi_read]Read data 3149642683 at index [0X1]
    <info> app: [flash_qspi_read]Read data 17039360 at index [0X2]
    <info> app: [flash_qspi_read]Read data 151191808 at index [0X3]
    <info> app: [flash_qspi_read]Read data 1081344 at index [0X4]
    <info> app: [flash_qspi_read]Read data 5849 at index [0X5]
    <info> app: [flash_qspi_read]Read data 1 at index [0X6]
    <info> app: [flash_qspi_read]Read data 5849 at index [0X7]
    <info> app: Data read at line :256 .

    I guess this is alignment error of some sorts. How do we cope with that.

Children
No Data
Related