USB Mass Storage Sample Application

Hello. I'm newbie with the NCS environment so tell me if I'm saying nosense. I use the nrf connect extension in vs code ide. (SDK: v2.7.0 toolchain: v2.7.0)

I want to create usb mass storage with spi flash on my own card so I wanted to examine the mass storage example. I copied the sample usb mass storage example with create a new application. I want to build the FAT FS Example as FLASH-based. I read README.rst but I don't understand how to do it. Can you help me with this?

Thank you.

Parents
  • Hello again. command line
    west build -b nrf5340dk_nrf5340_cpuapp -- -DCONFIG_APP_MSC_STORAGE_FLASH_FATFS=y
    But if I compile it I get errors:

    PS C:\nordic\myApps\mass> west build -b nrf5340dk_nrf5340_cpuapp -- -DCONFIG_APP_MSC_STORAGE_FLASH_FATFS=y
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: C:/nordic/myApps/mass
    -- CMake version: 3.31.0-rc2
    -- Cache files will be written to: C:/nordic/myApps/mass/zephyr/.cache
    -- Zephyr version: 4.0.0-rc3 (C:/nordic/myApps/mass/zephyr)
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    CMake Warning at zephyr/cmake/modules/boards.cmake:110 (message):
      Deprecated BOARD=nrf5340dk_nrf5340_cpuapp specified, board automatically
      changed to: nrf5340dk/nrf5340/cpuapp.
    Call Stack (most recent call first):
      zephyr/cmake/modules/zephyr_default.cmake:133 (include)
      zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
      CMakeLists.txt:4 (find_package)
    
    
    -- Board: nrf5340dk, qualifiers: nrf5340/cpuapp
    -- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)
    -- Could NOT find Dtc (missing: DTC) (Required is at least version "1.4.6")
    Hint: The project() command has not yet been called.  It sets up system-specific search paths.
    -- Found BOARD.dts: C:/nordic/myApps/mass/zephyr/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp.dts
    -- Found devicetree overlay: C:/nordic/myApps/mass/boards/nrf5340dk_nrf5340_cpuapp.overlay
    -- Generated zephyr.dts: C:/nordic/myApps/mass/build/zephyr/zephyr.dts
    -- Generated pickled edt: C:/nordic/myApps/mass/build/zephyr/edt.pickle
    -- Generated zephyr.dts: C:/nordic/myApps/mass/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/nordic/myApps/mass/build/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: C:/nordic/myApps/mass/build/zephyr/dts.cmake
    
    warning: HAS_NORDIC_DRIVERS (defined at modules\hal_nordic\Kconfig:7) has direct dependencies 0 with value n, but is currently being y-selected by the following symbols:
     - SOC_SERIES_NRF53X (defined at C:/nordic/myApps/mass/zephyr/soc/nordic/Kconfig.soc:36, C:/nordic/myApps/mass/zephyr/soc/nordic\nrf53\Kconfig.soc:6, 
    C:/nordic/myApps/mass/zephyr/soc/nordic\nrf53\Kconfig:6), with value y, direct dependencies y (value: y), and select condition SOC_FAMILY_NORDIC_NRF (value: y)
    
    warning: HAS_NRFX (defined at modules\hal_nordic\nrfx/Kconfig:4) has direct dependencies 0 with value n, but is currently being y-selected by the following symbols:
     - SOC_SERIES_NRF53X (defined at C:/nordic/myApps/mass/zephyr/soc/nordic/Kconfig.soc:36, C:/nordic/myApps/mass/zephyr/soc/nordic\nrf53\Kconfig.soc:6, 
    C:/nordic/myApps/mass/zephyr/soc/nordic\nrf53\Kconfig:6), with value y, direct dependencies y (value: y), and select condition SOC_FAMILY_NORDIC_NRF (value: y)
    
    warning: HAS_CMSIS_CORE (defined at modules\cmsis\Kconfig:7) has direct dependencies 0 with value n, but is currently being y-selected by the following symbols:
     - CPU_CORTEX_M (defined at C:/nordic/myApps/mass/zephyr/arch/arm\core/Kconfig:6), with value y, direct dependencies ARM (value: y), and select condition ARM (value: y)
    
    warning: NRFX_CLOCK (defined at modules\hal_nordic\nrfx/Kconfig:16) has direct dependencies HAS_NRFX && 0 with value n, but is currently being y-selected by the following symbols:
     - CLOCK_CONTROL_NRF (defined at drivers/clock_control/Kconfig.nrf:13), with value y, direct dependencies DT_HAS_NORDIC_NRF_CLOCK_ENABLED && CLOCK_CONTROL (value: y), and select condition !CLOCK_CONTROL_NRF_FORCE_ALT && DT_HAS_NORDIC_NRF_CLOCK_ENABLED && CLOCK_CONTROL (value: y)
    
    warning: NRFX_DPPI (defined at modules\hal_nordic\nrfx/Kconfig:28) has direct dependencies HAS_NRFX && 0 with value n, but is currently being y-selected by the following symbols:
     - SOC_NRF53_RTC_PRETICK (defined at C:/nordic/myApps/mass/zephyr/soc/nordic\nrf53\Kconfig:82), with value y, direct dependencies ((SYS_CLOCK_EXISTS && SOC_NRF5340_CPUNET) || SOC_NRF5340_CPUAPP) && SOC_SERIES_NRF53X && SOC_FAMILY_NORDIC_NRF (value: y), and select condition ((SYS_CLOCK_EXISTS && SOC_NRF5340_CPUNET) || SOC_NRF5340_CPUAPP) && SOC_SERIES_NRF53X && SOC_FAMILY_NORDIC_NRF (value: y)
     - NRF53_SYNC_RTC (defined at C:/nordic/myApps/mass/zephyr/soc/nordic\nrf53\Kconfig.sync_rtc:4), with value y, direct dependencies NRF_RTC_TIMER && SOC_SERIES_NRF53X && SOC_FAMILY_NORDIC_NRF (value: y), and select condition NRF_RTC_TIMER && SOC_SERIES_NRF53X && SOC_FAMILY_NORDIC_NRF (value: y)      
     - UART_0_ENHANCED_POLL_OUT (defined at drivers/serial\Kconfig.nrfx_uart_instance:21), with value y, direct dependencies !n && HAS_HW_NRF_UARTE0 && (HAS_HW_NRF_PPI || HAS_HW_NRF_DPPIC) && (HAS_HW_NRF_UART0 || HAS_HW_NRF_UARTE0) && UART_NRFX && SERIAL (value: y), and select condition HAS_HW_NRF_DPPIC && !n && HAS_HW_NRF_UARTE0 && (HAS_HW_NRF_PPI || HAS_HW_NRF_DPPIC) && (HAS_HW_NRF_UART0 || HAS_HW_NRF_UARTE0) && UART_NRFX && SERIAL (value: y)      
    Parsing C:/nordic/myApps/mass/Kconfig
    Loaded configuration 'C:/nordic/myApps/mass/zephyr/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_defconfig'
    Merged configuration 'C:/nordic/myApps/mass/prj.conf'
    Merged configuration 'C:/nordic/myApps/mass/build/zephyr/misc/generated/extra_kconfig_options.conf'
    
    warning: NRFX_GPIOTE0 (defined at modules\hal_nordic\nrfx/Kconfig:88) has direct dependencies HAS_NRFX && 0 with value n, but is currently being y-selected by the following symbols:
     - GPIO_NRFX (defined at drivers/gpio/Kconfig.nrfx:4), with value y, direct dependencies DT_HAS_NORDIC_NRF_GPIO_ENABLED && GPIO (value: y), and select condition HAS_HW_NRF_GPIOTE0 && DT_HAS_NORDIC_NRF_GPIO_ENABLED && GPIO (value: y)
    
    warning: NRFX_IPC (defined at modules\hal_nordic\nrfx/Kconfig:143) has direct dependencies HAS_NRFX && 0 with value n, but is currently being y-selected by the following symbols:
     - MBOX_NRFX_IPC (defined at drivers/mbox/Kconfig.nrfx:4), with value y, direct dependencies DT_HAS_NORDIC_MBOX_NRF_IPC_ENABLED && MBOX (value: y), and select condition DT_HAS_NORDIC_MBOX_NRF_IPC_ENABLED && MBOX (value: y)
    
    warning: NRFX_NVMC (defined at modules\hal_nordic\nrfx/Kconfig:157) has direct dependencies (n || n || y || n) && HAS_NRFX && 0 with value n, but is currently being y-selected by the following symbols:
     - SOC_FLASH_NRF (defined at drivers/flash/Kconfig.nrf:10), with value y, direct dependencies (DT_HAS_NORDIC_NRF51_FLASH_CONTROLLER_ENABLED || DT_HAS_NORDIC_NRF52_FLASH_CONTROLLER_ENABLED || DT_HAS_NORDIC_NRF53_FLASH_CONTROLLER_ENABLED || DT_HAS_NORDIC_NRF91_FLASH_CONTROLLER_ENABLED) && !FLASH_NRF_FORCE_ALT && FLASH (value: y), and select condition (DT_HAS_NORDIC_NRF51_FLASH_CONTROLLER_ENABLED || DT_HAS_NORDIC_NRF52_FLASH_CONTROLLER_ENABLED || DT_HAS_NORDIC_NRF53_FLASH_CONTROLLER_ENABLED || DT_HAS_NORDIC_NRF91_FLASH_CONTROLLER_ENABLED) && !FLASH_NRF_FORCE_ALT && FLASH (value: y)
    
    warning: NRFX_POWER (defined at modules\hal_nordic\nrfx/Kconfig:182) has direct dependencies HAS_NRFX && 0 with value n, but is currently being y-selected by the following symbols:
     - USB_NRFX (defined at drivers/usb/device/Kconfig:107), with value y, direct dependencies DT_HAS_NORDIC_NRF_USBD_ENABLED && USB_DEVICE_DRIVER (value: y), and select condition DT_HAS_NORDIC_NRF_USBD_ENABLED && USB_DEVICE_DRIVER (value: y)
    
    warning: NRFX_QSPI (defined at modules\hal_nordic\nrfx/Kconfig:289) has direct dependencies HAS_NRFX && 0 with value n, but is currently being y-selected by the following symbols:
     - NORDIC_QSPI_NOR (defined at drivers/flash/Kconfig.nordic_qspi_nor:4), with value y, direct dependencies DT_HAS_NORDIC_QSPI_NOR_ENABLED && FLASH (value: y), and select condition DT_HAS_NORDIC_QSPI_NOR_ENABLED && FLASH (value: y)
    
    warning: NRFX_CLOCK_LFXO_TWO_STAGE_ENABLED (defined at modules\hal_nordic\nrfx/Kconfig:20) has direct dependencies NRFX_CLOCK && HAS_NRFX && 0 with value n, but is currently being y-selected by the following symbols:
     - CLOCK_CONTROL_NRF_K32SRC_XTAL (defined at drivers/clock_control/Kconfig.nrf:36), with value y, direct dependencies <choice CLOCK_CONTROL_NRF_SOURCE> (value: y), and select condition !SOC_SERIES_BSIM_NRFXX && !CLOCK_CONTROL_NRF_FORCE_ALT && <choice CLOCK_CONTROL_NRF_SOURCE> (value: y)
    
    error: Aborting due to Kconfig warnings
    
    CMake Error at zephyr/cmake/modules/kconfig.cmake:395 (message):
      command failed with return code: 1
    Call Stack (most recent call first):
      zephyr/cmake/modules/zephyr_default.cmake:133 (include)
      zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
      CMakeLists.txt:4 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' -DWEST_PYTHON=C:/Users/cagri.demiral/AppData/Local/Programs/Python/Python310/python.exe '-BC:\nordic\myApps\mass\build' -GNinja -DCONFIG_APP_MSC_STORAGE_FLASH_FATFS=y '-SC:\nordic\myApps\mass'

  • Hi,

    I assume you're referring to the Zephyr sample? https://docs.nordicsemi.com/bundle/ncs-2.7.0/page/zephyr/samples/subsys/usb/mass/README.html 

    Thank you for providing the build logs. There are quite a few warnings here. You mention that you "want to test this on your board". What exactly is your board? Is it a nRF5340DK, or a custom board you've made with a nRF5340?

    Kind regards,
    Andreas

  • Hello,

    I have a custom board with nRF52833 and W25Q512JVEIQ. I wanted to examine a similar example on a different board, because I am new to this and I don't know what to do.

    Thank you for your support.

  • Aha, thank you for clarifying.

    The first issue is that you're building for the wrong target (board) if you ever want to flash the device. Your board is the nRF52833, while the build target you're building for is the nRF5340DK.

    I think I would recommend you to take a few steps back from the project you're working with and instead familiarize yourself with the fundamentals and intermediate NCS courses we have on our academy pages to get to know your board and the SDK a bit better before jumping into the deep end.

    You can find the course for the fundamental course here https://academy.nordicsemi.com/courses/nrf-connect-sdk-fundamentals/ 

    • I recommend you do all lessons, but specially focus on lesson 1, 2 and 3

    and the intermediate here https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/ 

    • I recommend you do all lessons, but specially focus on lesson 1, 2 and 3

    I know this is probably not the solution you were hoping for, but if you spend a day going through these two courses I believe you should be far better of and ready to pick up the challenge with getting the flash sample to work on your custom board

    Kind regards,
    Andreas

  • Actually, I just wanted to build and examine the sample. I know I can't flash it.

    I looked at the tutorial you suggested and I learned that I need to type the command “west build -b adafruit_feather_nrf52840 -- -DCONFIG_APP_MSC_STORAGE_FLASH_FATFS=y” (or any other command) into the cRF Connect terminal. I was typing in powershell terminal before, so I got errors.

    I wanted to mention this to help anyone who has such a problem and reads this article

    Anyway, my problem is solved for now. Now I will have to analyze the sample and adapt it to myself, this is the main issue :)

    Thank you

Reply
  • Actually, I just wanted to build and examine the sample. I know I can't flash it.

    I looked at the tutorial you suggested and I learned that I need to type the command “west build -b adafruit_feather_nrf52840 -- -DCONFIG_APP_MSC_STORAGE_FLASH_FATFS=y” (or any other command) into the cRF Connect terminal. I was typing in powershell terminal before, so I got errors.

    I wanted to mention this to help anyone who has such a problem and reads this article

    Anyway, my problem is solved for now. Now I will have to analyze the sample and adapt it to myself, this is the main issue :)

    Thank you

Children
No Data
Related