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

USB Mass Storage Class on external QSPI flash

Hello guys,

We are using SES and SDK15.3.0. Our SoC is from nRF52840 family. We have a custom board with external QSPI flash memory that we want to use as USB MSC device. After some consultations with Nordic technical support (see this thread), we selected  MX66L1G45G (3.0V) memory module for our external memory.

usbd_msc example from SDK 15.3.0 did not work on our custom board - disk initialization failed issue:

Changing the addressing mode to 32-bit (because we are using memory that is >128Mb) did not help. We changed the addressing mode inside sdk_config.h file as follows:

// <o> QSPI_CONFIG_ADDRMODE  - Addressing mode.
 
// <0=> 24bit 
// <1=> 32bit 

#ifndef QSPI_CONFIG_ADDRMODE
#define QSPI_CONFIG_ADDRMODE 1
#endif

// <o> NRFX_QSPI_CONFIG_ADDRMODE  - Addressing mode.
 
// <0=> 24bit 
// <1=> 32bit 

#ifndef NRFX_QSPI_CONFIG_ADDRMODE
#define NRFX_QSPI_CONFIG_ADDRMODE 1
#endif

QSPI link between our nRF52840 and external memory is OK because QSPI example is working properly.

Do you have any suggestions on what should we change in order to have usbd_msc example working on our custom board?

Thank you very much for your time and effort! It is really appreciated.

Sincerely,

Bojan.

Parents
  • Hello Bojan, 

    QSPI link between our nRF52840 and external memory is OK because QSPI example is working properly.

     I'm glad to hear that the QSPI example is working properly. 

    Do you have any suggestions on what should we change in order to have usbd_msc example working on our custom board?

    Are the settings the same as with QSPI example? Are you using FAT FS? Can you please provide your project for testing? Difficult for me to say at this moment.

    Thanks!

    Kind regards,
    Øyvind 

Reply
  • Hello Bojan, 

    QSPI link between our nRF52840 and external memory is OK because QSPI example is working properly.

     I'm glad to hear that the QSPI example is working properly. 

    Do you have any suggestions on what should we change in order to have usbd_msc example working on our custom board?

    Are the settings the same as with QSPI example? Are you using FAT FS? Can you please provide your project for testing? Difficult for me to say at this moment.

    Thanks!

    Kind regards,
    Øyvind 

Children
  • Hello ,

    Thanks for your reply!

    My starting point is usbd_msc example. Inside sdk_config.h file I just defined and set QSPI_CONFIG_ADDRMODE and NRFX_QSPI_CONFIG_ADDRMODE to have 32-bit addressing mode and that's all. The rest of the code is actually the code from usbd_msc example.

    Yes, FAT FS is used. The issue appears when disk_initialize(0); function is called within fatfs_init(). This is when I get the error "Disk initialization failed".

    Am I missing something?

    Sincerely,

    Bojan.

  • Hello

    In your post from case 228518, you write that the QSPI sample gives inconsistent data when using a 32-bit address, but 24-bit address gives consistent. Are you sure that you have connected your flash correctly? The MX66L1G45G has according to the datasheet a 32-bit address. 

    How have you connected the MX66L1G45G to your nRF52840? Are the pins connected to the same pins as the QSPI on the nRF52840 DK? Can you provide some more information about your setup? e.g picture of the board, etc?

    Did you try with 24-bit address in USBD_MSC?

  • Hi, .

    Yes, exactly! When I set 32-bit interface in QSPI example (by defining and setting QSPI_CONFIG_ADDRMODE and NRFX_QSPI_CONFIG_ADDRMODE variables in sdk_config.h file), there is data inconsistency (what is written to flash is not equal to what is read from the flash).

    First of all, do I correctly switch to 32-bit addressing mode? Perhaps there is something more I need to do in order to switch from 24-bit to 32-bit addressing.

    Here is how I connected MX66L1G45G to nRF52840:

    As you can see, I used the same nRF52840 pins for QSPI interface as on nRF52840DK board.

    I placed QSPI flash very close to the nRF52840 SoC (in order to make QSPI lines short), as you can see here:

    usbd_msc example with 24-bit addresses and MX66L1G45G does not work. There is the same issue with disk_initialize(0); function when it is called within fatfs_init().

    I hope I helped with this explanation. If you need some more details from my side, just let me know.

    Sincerely,

    Bojan.

  • Hi, 

    I've been trying to find a cause as to why this does not work, but I'm running out of ideas. I will forward your case to our QSPI team. Before I do so, can you please try reading QSPI using nrfjprog. See this thread.

    The nrfjprog commands documentation has several QSPI commands that you use to test that the QSPI flash is working as intended. There is a QspiDefault.ini (C:\Program Files\Nordic Semiconductor\nrf-command-line-tools\bin\QspiDefault.ini) that you need to open in a text editor to verify correct settings. 
    A tip from one of my colleagues was to erase the flash using nrfjprog --qspieraseall. See documentation before starting.

    Let me know how that works for you! 

    -Øyvind

  • Hello, .

    I tried using the following nrfjprog command to read the content of the external QSPI:

    nrfjprog --readqspi D:\test_24bit.txt -f nrf52

    The command executed successfully! I did not change anything from the QspiDefault.ini file. After that, I changed AddressMode parameter in QspiDefault.ini file from BIT24 to BIT32 and tried to execute the same command, saving the results into test_32bit.txt file. Again, the command executed successfully. 

    When I compare two .txt files, I can see some differences. You can find the files attached here.

    What I can conclude from those experiments is that QSPI link between nRF52840 and external memory is functional. , you think that usbd_msc example should work in that case?

    Sincerely,

    Bojan.

    test_24bit.txt
    test_32bit.txt

Related