Looking for USB MSC + nRF52840 internal flash + FATFS sample

Hi, DEVZONE, 

nRF52840DK

nRF connect SDK,  v3.0.1

sample :    ~~\ncs\v3.0.1\zephyr\samples\subsys\usb\mass

it has    internal ram-based FAT,  external-Flash FAT configuration, but it doesn't have internal-Flash + FAT configuration.

Can someone suggest any sample for it ?

Or can someone teach me how to update the sample code to use internal flash ?


Regards,

Parents
  • USB MSC with nRF52840 Internal Flash and FATFS Sample

    Based on your request for a USB Mass Storage Class (MSC) sample using nRF52840's internal flash with FATFS in nRF Connect SDK v3.0.1, here's what I can tell you:

    Current Situation

    The mass storage sample in `ncs\v3.0.1\zephyr\samples\subsys\usb\mass` indeed provides configurations for:
    - RAM-based FAT (virtual disk)
    - External flash (like SPI NOR flash) with FATFS

    But it doesn't include a configuration for internal flash (the nRF52840's 1MB flash) with FATFS.

    How to Modify for Internal Flash

    To adapt the sample to use internal flash, you'll need to:

    1. Configure the storage partition in your devicetree overlay:
    ```dts
    / {
    chosen {
    zephyr,flash-controller = &flash_controller;
    zephyr,storage-partition = &storage_partition;
    };

    partitions {
    compatible = "fixed-partitions";
    #address-cells = <1>;
    #size-cells = <1>;

    storage_partition: partition@F0000 {
    label = "storage";
    reg = <0x000F0000 0x00010000>;
    };
    };
    };
    ```

    2. Modify prj.conf to use internal flash:
    ```
    CONFIG_DISK_DRIVER_FLASH=y
    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_FILE_SYSTEM=y
    CONFIG_FAT_FILESYSTEM_ELM=y
    ```

    3. Update the code to use the internal flash driver instead of external flash.

    Alternative Solutions

    1. Check newer SDK versions: nRF Connect SDK v3.1.0+ might have better support for this configuration.

    2. Nordic DevZone examples: Search for "USB MSC internal flash" on Nordic's DevZone for community examples.

    3. Zephyr documentation: Refer to Zephyr's USB and filesystem documentation for guidance on combining these features.

Reply
  • USB MSC with nRF52840 Internal Flash and FATFS Sample

    Based on your request for a USB Mass Storage Class (MSC) sample using nRF52840's internal flash with FATFS in nRF Connect SDK v3.0.1, here's what I can tell you:

    Current Situation

    The mass storage sample in `ncs\v3.0.1\zephyr\samples\subsys\usb\mass` indeed provides configurations for:
    - RAM-based FAT (virtual disk)
    - External flash (like SPI NOR flash) with FATFS

    But it doesn't include a configuration for internal flash (the nRF52840's 1MB flash) with FATFS.

    How to Modify for Internal Flash

    To adapt the sample to use internal flash, you'll need to:

    1. Configure the storage partition in your devicetree overlay:
    ```dts
    / {
    chosen {
    zephyr,flash-controller = &flash_controller;
    zephyr,storage-partition = &storage_partition;
    };

    partitions {
    compatible = "fixed-partitions";
    #address-cells = <1>;
    #size-cells = <1>;

    storage_partition: partition@F0000 {
    label = "storage";
    reg = <0x000F0000 0x00010000>;
    };
    };
    };
    ```

    2. Modify prj.conf to use internal flash:
    ```
    CONFIG_DISK_DRIVER_FLASH=y
    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_FILE_SYSTEM=y
    CONFIG_FAT_FILESYSTEM_ELM=y
    ```

    3. Update the code to use the internal flash driver instead of external flash.

    Alternative Solutions

    1. Check newer SDK versions: nRF Connect SDK v3.1.0+ might have better support for this configuration.

    2. Nordic DevZone examples: Search for "USB MSC internal flash" on Nordic's DevZone for community examples.

    3. Zephyr documentation: Refer to Zephyr's USB and filesystem documentation for guidance on combining these features.

Children
No Data
Related