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

usb_msc example on a custom board

Hello, i would like to test usb_msc example on a custom board, and i have few questions:

  - will this QSPI flash chip work with nRF52840 QSPI interface, and is it sufficient as a QSPI block device: Microchip SST26VF064B

  - where in the code (i mean usb_msc example) can i specify SOC pin numbers which i want to use for QSPI operation?

  - are there any constraints on whic general purpose SOC pins can i designate as QSPI interface?

Thanks,

W

Parents
  • Hi,

    I had similar requirements on my project. Here's how I approached it.

    - QSPI

    You'll need couple of changes. First is to add support for this chip.

    Make a copy of your own for nrf_serial_flash_params.c - and add to the array of known flash chips, the required ID for your QSPI flash (with the relevant parameters)

    This is a snippet of the relevant part from one of my projects:

    static const nrf_serial_flash_params_t m_sflash_params[] = {
    
        // MXIC MX25R6435F
        {
            .read_id      = {0xC2, 0x28, 0x17},
            .capabilities = 0x00,
            .size         = 8 * 1024 * 1024,
            .erase_size   = 4 * 1024,
            .program_size = 256,
        },
    
        // Winbond W25Q128JV-IQ/JQ
        {
            .read_id      = {0xEF, 0x40, 0x18},
            .capabilities = 0x00,
            .size         = 16 * 1024 * 1024,
            .erase_size   = 4 * 1024,
            .program_size = 256,
        },
    
        // Winbond W25Q128JV-IM/JM
        {
            .read_id      = {0xEF, 0x70, 0x18},
            .capabilities = 0x00,
            .size         = 16 * 1024 * 1024,
            .erase_size   = 4 * 1024,
            .program_size = 256,
        },
    };

    as you can see I added support for the Winbond ones. Look at the Datasheet of your chip, or simply put a breakpoint inside nrf_serial_flash_params_get to see what the values are.

    Make sure to include only your modified nrf_serial_flash_params.c file in your build.

    - Pins

    Look at sdk_config.h for the followings:

    #define NRFX_QSPI_PIN_SCK
    #define NRFX_QSPI_PIN_CSN
    #define NRFX_QSPI_PIN_IO0
    #define NRFX_QSPI_PIN_IO1
    #define NRFX_QSPI_PIN_IO2
    #define NRFX_QSPI_PIN_IO3

    - Limit on GPIOs

    Never had an issue with a specific GPIO I can remember ...

  • Thank you for comprehensive information Shahar, this should allow me to test this chip with usb_msc. 

    Yet another question, maybe you will be able to answer, or maybe someone else will know the answer:

     -  nRF52840 data sheet says that it is able to do "up to 4x SPI master" - if i'm using QSPI flash, am i using all of these SPI master hardware up? In my project, i have more SPI chips, and i need to be able to interact with them using one of these four SPI masters.

    - if that is the case (QSPI is using all four SPI masters, and there is no SPI bus left for other peripherial chips), can i use usb_msc example in 1x SPI mode? If yes - how to adjust the code to achieve this?

    Thanks,

    W

  • The QSPI module interface can't be used as a normal SPI AFAIK, so I assume it is separate from the other SPI interfaces.

    But in any case, even if they shared a resource, the QSPI will only consume one SPI instance, as it uses 4 data lines, not 4 SPI instances.

    But a simple test can verify this for you. Take the Nordic USB MSC example and enable the 4 SPI master instances on various pins on the DevKit (you can use 3 pin SPI to save on GPIOs).

    You can actually use the LEDs GPIOs as the SPI Clock, they will give you a visual indication of outgoing SPI (just make sure to disable the BSP_LED init, so you can use the GPIOs)

Reply
  • The QSPI module interface can't be used as a normal SPI AFAIK, so I assume it is separate from the other SPI interfaces.

    But in any case, even if they shared a resource, the QSPI will only consume one SPI instance, as it uses 4 data lines, not 4 SPI instances.

    But a simple test can verify this for you. Take the Nordic USB MSC example and enable the 4 SPI master instances on various pins on the DevKit (you can use 3 pin SPI to save on GPIOs).

    You can actually use the LEDs GPIOs as the SPI Clock, they will give you a visual indication of outgoing SPI (just make sure to disable the BSP_LED init, so you can use the GPIOs)

Children
No Data
Related