fs_mount fatfs in RAM not working -- "fs mount error (-5)"

Hi, I'm using NCS v2 building on VSCode and failing to mount a RAM-backed fatfs instance.

I looked at the code for the usb mass storage example (link) for the code.

The error I get is: [00:00:00.770,233] <err> fs: fs_mount: fs mount error (-5)

My prj.conf is:

CONFIG_DISK_DRIVER_RAM=y
CONFIG_FILE_SYSTEM=y
CONFIG_FAT_FILESYSTEM_ELM=y
CONFIG_DISK_RAM_VOLUME_SIZE=32

My code is:

static void setup_disk(void)
{
    static FATFS fat_fs;
    static struct fs_mount_t fs_mnt;
    memset(&fat_fs, 0, sizeof(fat_fs));
    memset(&fs_mnt, 0, sizeof(fs_mnt));

    fs_mnt.type = FS_FATFS;
    fs_mnt.fs_data = &fat_fs;
    fs_mnt.mnt_point = "/RAM:";

    int rc = fs_mount(&fs_mnt);
}

Can you help me understand what I need to do to get this to work?

Thanks.

Parents Reply Children
  • Can I see what you have done in the overlay file?

  • &pinctrl {
    	uart0_custom: uart0 {
    		group1 {
    			// psels = <NRF_PSEL(UART_TX, 0, 25)>,  // old custom board
    			psels = <NRF_PSEL(UART_TX, 0, 16)>,   // new custom board
                        <NRF_PSEL(UART_RX, 0, 24)>;
    		};
    	};
    };
    
    
    &uart0 {
        status = "okay";
        current-speed = <9600>;
        // current-speed = <38400>;
        pinctrl-0 = <&uart0_custom>;
        label = "UART_0";
    };
    
    &pinctrl {
    	pwm0PinList: pwm0-pin-list {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 6)>,
    				    <NRF_PSEL(PWM_OUT1, 1, 8)>,
    					<NRF_PSEL(PWM_OUT2, 1, 9)>;
    
    		};
    	};
    };
    
    
    &pwm0 {
    	// enable
    	status = "okay";
    
    	// set the pin for given channel
    	pinctrl-0 = <&pwm0PinList>;
    	pinctrl-names = "default";
    };
    
    
    / {
    	pwm0-channels {
    		compatible = "pwm-leds";
    
    		// period specified in ns, so Xms scaled out to ns
    		pwm0_0: pwm0-0 {
    			pwms = <&pwm0 0 (1 * 1000 * 1000) PWM_POLARITY_NORMAL>;
    		};
    		pwm0_1: pwm0-1 {
    			pwms = <&pwm0 1 (1 * 1000 * 1000) PWM_POLARITY_NORMAL>;
    		};
    		pwm0_2: pwm0-2 {
    			pwms = <&pwm0 2 (1 * 1000 * 1000) PWM_POLARITY_NORMAL>;
    		};
    	};
    };
    

Related