Using the Mass example on my custom board, but first getting it running on the nRF52840dk QSPI flash

Hi,

I've been using the nRF5 SDK (17.1.0) USB Mass storage code for a data logger I have made.  I am using a memory chip larger than 16KB and that code has bugs when you go over that size.  So I'm moving to the nRF Connect SDK on advice I read on different forums.  My first question is, has anyone used this code on a NOR Flash that is 2Gbit in size?  Will it work?

So, I've used the nRF5 SDK for many years and have recently moved over to the nRF Connect SDK.  It's a bit of a learning curve, but it's making sense.  I am missing something, though, when I try to build and run the Mass sample.  I am using the nRF52840dk which has a QSPI NOR flash attached.  Instead of using the adafruit board like in the example, I'd just like to get this running on the nRF52840dk (PCA10056).  

I have copied the Mass folder into a different location where I keep all my examples (and DevAcademy files), so it's out of tree of the SDK.

I opened the existing application.  I created a new build based on the nRF52840dk_nrf52840.  In the build file I optimized for debugging so I could see what was going on.

Then I typed the following into the nRF Terminal:

west build -b nrf52840dk/nrf52840 -- -DCONFIG_APP_MSC_STORAGE_FLASH_FATFS=y

I left out the location of the files since I was in that directory (and the first time I tried it there was an error that it couldn't find the files).  I also changed the board to the nRF52480dk.

Everything build and compiles correctly and I can flash it on to my board.  However, when I then plug it into a windows machine, It says I need to format the device in order to use it.  Ok, that seems normal, but when I try to format it, I says the size is unknown and the sector size is unknown and the format fails.  

Here is the output of the build after typing in the above command:

PS C:\Nordic\ExampleProjects\mass> west build -b nrf52840dk/nrf52840 -- -DCONFIG_APP_MSC_STORAGE_FLASH_FATFS=y
>>
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base (cached)).
-- Application: C:/Nordic/ExampleProjects/mass
-- CMake version: 3.21.0
-- Cache files will be written to: C:/ncs/v2.7.0/zephyr/.cache
-- Zephyr version: 3.6.99 (C:/ncs/v2.7.0/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: nrf52840dk, qualifiers: nrf52840
-- 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)
-- Found BOARD.dts: C:/ncs/v2.7.0/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840.dts
-- Found devicetree overlay: C:/Nordic/ExampleProjects/mass/boards/nrf52840dk_nrf52840.overlay
-- Generated zephyr.dts: C:/Nordic/ExampleProjects/mass/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/Nordic/ExampleProjects/mass/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/Nordic/ExampleProjects/mass/build/zephyr/dts.cmake
Parsing C:/Nordic/ExampleProjects/mass/Kconfig
Loaded configuration 'C:/Nordic/ExampleProjects/mass/build/zephyr/.config'
No change to configuration in 'C:/Nordic/ExampleProjects/mass/build/zephyr/.config'
No change to Kconfig header in 'C:/Nordic/ExampleProjects/mass/build/zephyr/include/generated/autoconf.h'
CMake Warning at C:/ncs/v2.7.0/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
CONFIG_USB_DEVICE_VID has default value 0x2FE3.

This value is only for testing and MUST be configured for USB products.


-- Configuring done
-- Generating done
-- Build files have been written to: C:/Nordic/ExampleProjects/mass/build
←[92m-- west build: building application
[9/9] Linking C executable zephyr\zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 89260 B 1 MB 8.51%
RAM: 24272 B 256 KB 9.26%
IDT_LIST: 0 GB 32 KB 0.00%
Generating files from C:/Nordic/ExampleProjects/mass/build/zephyr/zephyr.elf for board: nrf52840dk
PS C:\Nordic\ExampleProjects\mass>

Here is the RTT output

SEGGER J-Link V8.10c - Real time terminal output
SEGGER J-Link (unknown) V1.0, SN=1050248664
Process: JLink.exe
*** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***
[00:00:00.427,124] <inf> flashdisk: Initialize device NAND
[00:00:00.427,154] <inf> flashdisk: offset 0, sector size 512, page size 4096, volume size 131072
[00:00:00.427,368] <inf> main: Ian is Testing.

Area 0 at 0x0 on mx25r6435f@0 for 131072 bytes
[00:00:00.427,490] <inf> flashdisk: Initialize device NAND
[00:00:00.427,520] <inf> flashdisk: offset 0, sector size 512, page size 4096, volume size 131072
Mount /NAND:: 0
/NAND:: bsize = 512 ; frsize = 1024 ; blocks = 8128 ; bfree = 6082
/NAND: opendir: 0
F 0 000041C6.TXT
F 0 0000167E.TXT
F 0 00002781.TXT
D 0 SYSTEM~1
End of files
[00:00:00.489,135] <inf> main: The device is put in USB mass storage mode.

It looks like the memory chip is found and everything is okay.  I am worried that it says NAND, but I looked up the adafeather board in the example and it also seems to NOR not NAND.

When I plug the board into my computer, I don't see any more messages on the COM or RTT.  

Thank you for you help,

ian

Related