music_sink nvds(0) flush failed issue

main branch, merging the music_sink example into SF32LB56.

Currently, the file system mount directories are set up as follows: A root directory (FatFs) is created in ROM, and then two subdirectories, “nand” and “sdcard”, are created within it to mount NAND (LittleFS) and SD card (FatFS), respectively.

However, recently when attempting to merge in the music_sink example, I noticed the log reports an error: nvds(0) flush failed. After reviewing the reference example, it appears this might be because I haven’t mounted the root partition’s file system. My question is: while keeping the current directory structure, how can I properly create a partition for nvds? Also, if using NAND with DHARA enabled, does that mean I can’t use FatFS simultaneously for both NAND and SD card?

const struct romfs_dirent children_dir[] = {
    {ROMFS_DIRENT_DIR, "nand", RT_NULL, 0},
    {ROMFS_DIRENT_DIR, "sdcard", RT_NULL, 0},
};

const struct romfs_dirent romfs_root = {
    ROMFS_DIRENT_DIR,
    "/",
    (const rt_uint8_t *)children_dir,
    sizeof(children_dir) / sizeof(children_dir[0]),
};

int mnt_init(void)
{
    fal_init();

    HAL_PIN_Set(PAD_PA76, GPIO_A76, PIN_PULLDOWN, 1);
    rt_pin_mode(76, PIN_MODE_INPUT);
    if(rt_pin_read(76))
        LOG_I("SD card inserted\n");
    else
        LOG_I("SD card not inserted\n");

    if(dfs_mount(RT_NULL, "/", "rom", 0, &romfs_root) == RT_EOK)
    {
        LOG_I("ROMFS mount succeeded\n");

        register_mtd_device(FS_REGION_START_ADDR, FS_REGION_SIZE, "nand0");
        if (dfs_mount("nand0", "/nand", "lfs", 0, 0) == 0) // fs exists
        {
            LOG_I("NAND mount succeeded\n");
        }
        else
        {
            // Auto mkfs; remove if manual formatting is preferred
            LOG_E("NAND mount failed\n");
            if (dfs_mkfs("lfs", "nand0") == 0)
            {
                LOG_I("NAND format succeeded, remounting\n");
                if (dfs_mount("nand0", "/nand", "lfs", 0, 0) == 0)
                    LOG_I("NAND mount succeeded\n");
                else
                    LOG_E("NAND mount failed\n");
            }
            else
                LOG_E("NAND format failed\n");
        }

        uint16_t sdhci_time = 100;
        while (sdhci_time --)
        {
            rt_thread_mdelay(30);
            if (mmcsd_get_stat()) break;
        }
        rt_thread_mdelay(500);

        if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == 0) // fs exists
        {
            LOG_I("SD card mount succeeded\n");
            sd_mount_state = 1;
        }
        else
        {
            LOG_E("SD card mount failed\n");
            sd_mount_state = 0;
        }
    }
    else
    {
        LOG_E("ROMFS mount failed\n");
        return RT_ERROR;
    }
    return RT_EOK;
}

The log error is as follows:

V1 1 in block 992, V2 0 in block 994
Latest version 1
V1 1 in block 993, V2 0 in block 995
Latest version 1
v1 1 in blk 992, v2 1 in block 993
BBM MEM: ctx 200264a8, map1 20026098, map2 200262a0 
sif_bbm_init done

 \ | /
- SiFli Corporation
 / | \     build on Apr 14 2026, 2.4.0 build 8f4de59c
 2020 - 2022 Copyright by SiFli team
mount /dev success
[D/USBD] No class register on usb device
[1563] I/drv.rtc main: PSCLR=0x80000100 DivAI=128 DivAF=0 B=256
[1589] I/drv.rtc main: RTC use LXT RTC_CR=00000000
[1611] I/drv.rtc main: Init RTC, wake = 1
[1630] I/drv.sdhci main: rt_hw_sdmmc_init 1 begin
[2308] I/drv.sdhci main: host version = 2
[2326] I/drv.sdhci main: SDHCI clock 288000000
[2346] I/drv.sdhci main: Maximum Clock Supported by HOST : 288 MHz 
[2374] I/drv.sdhci main: host minclock 400000  host maxclock 288000000  
[2404] I/drv.sdhci main: SDHCI controller on sd0 using DMA
clock 0Hz busmode 1 powermode 1 cs 0 Vdd 23 width 0 
[2751] I/drv.sdhci main: Add host success
[2769] I/drv.sdhci main: rt_hw_sdmmc_init 1 done
[2791] I/drv.audprc main: init 00 ADC_PATH_CFG0 0x924
[2814] I/drv.audprc main: HAL_AUDPRC_Init res 0
[2836] I/drv.audcodec main: HAL_AUDCODEC_Init res 0
[2858] I/TOUCH main: Regist touch screen driver, probe=0x10007c75 
[2885] I/drv.rgb main: rgbled register success, supporting 1 LEDs
[I/FAL] Flash Abstraction Layer (V0.5.99) initialize success.
[I/FAL] The FAL MTD NAND device (dfu)  blk:131072 sec:2048 created successfully
Register0 dfu to mtd device with base addr 0x66200000
Register1dfu to mtd device with base addr 0x66200000
Register2 dfu to mtd device with base addr 0x66200000
[I/FAL] The FAL MTD NAND device (ble)  blk:131072 sec:2048 created successfully
Register0 ble to mtd device with base addr 0x66200000
Register1ble to mtd device with base addr 0x66204000
Register2 ble to mtd device with base addr 0x66204000
call par CFG1(35bb)
fc 9, xtal 2000, pll 2109
call par CFG1(35bb)
fc 7, xtal 2000, pll 1687
[3282] I/audio audiosvr: audio server run
[3300] I/audio bt_downv: audio_btdownlink run
[3320] I/NO_TAG main: SD card inserted
[3336] I/NO_TAG main: ROMFS mount succeeded
Register nand0 to mtd device with base addr 0x64600000
map_resume:0,0
lfs blk count:10704
[4295] I/NO_TAG main: NAND mount succeeded
clock 400000Hz busmode 1 powermode 2 cs 0 Vdd 23 width 0 
[4336] I/drv.sdhci mmcsd_de: sdhci_set_clock2 400000
[4662] I/SDIO mmcsd_de: detect SDIO begin
clock 400000Hz busmode 1 powermode 2 cs 1 Vdd 23 width 0 
clock 400000Hz busmode 1 powermode 2 cs 0 Vdd 23 width 0 
[4812] I/SDIO mmcsd_de: detect SD card BEGIN
clock 400000Hz busmode 1 powermode 2 cs 1 Vdd 23 width 0 
clock 400000Hz busmode 1 powermode 2 cs 0 Vdd 23 width 0 
clock 400000Hz busmode 1 powermode 2 cs 0 Vdd 15 width 0 
clock 400000Hz busmode 1 powermode 2 cs 1 Vdd 15 width 0 
clock 400000Hz busmode 1 powermode 2 cs 0 Vdd 15 width 0 
clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 15 width 0 
[15985] I/SDIO mmcsd_de: SD card capacity 491520 KB.
Before scr buf 0x2003cd84: scr 0x0000a502, 0x00000000
After scr 0x02a50000, 0x00000000
[16080] I/SDIO mmcsd_de: SD card version 2, bus width 5.
hs flag 0x1, card max 50000000
clock 50000000Hz busmode 2 powermode 2 cs 0 Vdd 15 width 0 
[16253] I/drv.sdhci mmcsd_de: sdhci_set_clock2 24000000
[16277] I/SDIO mmcsd_de: 4 bit mode: host 0x31, card 0x5
clock 50000000Hz busmode 2 powermode 2 cs 0 Vdd 15 width 2 
[16326] I/drv.sdhci mmcsd_de: sdhci_set_clock2 24000000
[16350] I/drv.sdhci mmcsd_de: Enable DDR mode 0
[16370] I/drv.sdhci mmcsd_de: Set to 4 line mode
[16432] I/SDIO mmcsd_de: detect SD card DONE
[33480] I/NO_TAG main: SD card mount succeeded
[33507] I/NO_TAG led_thre: rgbled device found
[33536] E/nvds mbox: nvds(0) flush failed
[33555] E/nvds mbox: nvds(0) flush failed
[33575] E/nvds mbox: nvds(0) flush failed
[33593] E/nvds mbox: nvds(1) flush failed
[82799] I/sibles main: enable BLE Core. Lib ver: bt.2.0.3d9c07bf
[82827] I/drv.lcd lvgl_thr: [NONE] -> [OPENING]
[82848] I/drv.lcd lcd_task: open
[82862] I/drv.epic lcd_task: drv_gpu opened.
[82880] I/drv.lcd lcd_task: HW open
[82900] I/drv.lcd lcd_task: Try registered LCD driver...
[99624] I/drv.lcd lcd_task: Found lcd yyh_480272 id:8000h
[99648] I/drv.lcd lcd_task: HW open done.
[99665] I/drv.lcd lcd_task: [OPENING] -> [INITIALIZED]
[99687] I/drv.lcd lcd_task: open done.
Warning: framebuffer color depth(24) mismatch! (Should match with LV_COLOR_DEPTH)
[99737] I/drv.lcd_fb lvgl_thr: drv_lcd_fb_init
[99758] I/drv.lcd_fb lvgl_thr: drv_lcd_fb_init done.
[99846] I/TOUCH lvgl_thr: Open
[99861] I/TOUCH tp_init: Find touch screen driver...
[99883] I/TOUCH tp_init: Probe 10007c75
[99900] I/drv.gt911 tp_init: probe OK
[99915] I/TOUCH tp_init: touch screen found driver  0x20025c98, gt911
[99944] I/TOUCH lvgl_thr: Opened.
[99960] I/LVGL lvgl_thr: [littlevgl2rtt] Welcome to the littlevgl2rtt lib.
[102221] I/drv.gt911 tp_init: Firmware version = 0x1060(4192)
[107324] I/drv.lcd lcd_task: Auto turn on display.
[107345] I/drv.lcd lcd_task: set brightness 50
[107365] I/drv.lcd lcd_task: backligt_set 50pwm_config ch=0,peroid=537048996,pulse=50
[107401] I/drv.lcd lcd_task: display on
[107417] I/drv.lcd lcd_task: [INITIALIZED] -> [ON]

######################################################
##                                                  ##
##           BTS2 Demo Main Menu                    ##
##   1. Generic Command                             ##
##   6. A2DP Sink                                   ##
##   8. L2CAP bqb test                              ##
##   p. AVRCP                                       ##
##   s. Show Menu                                   ##
##   q. Exit                                        ##
##                                                  ##
######################################################

[115830] E/NO_TAG mbox: read bt bonded failed!
[115856] I/ble_cm mbox: read_bond_infor_from_flash: 1
le p256 nvds get 1
[344960] I/NO_TAG main: BT/BLE stack and profile init failed
msh /> 

nand currently cannot be adapted to littlefs; you need to use fatfs.

The latest code only distinguishes between nand and non-nand. Check the main branch. For coexistence with sd, configure dhara as shown below: