Poor Read/Write Performance with Zephyr SDIF Driver on LPCXpresso55S69-EVK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Poor Read/Write Performance with Zephyr SDIF Driver on LPCXpresso55S69-EVK

1,133 Views
wima88
Contributor III

When evaluating the LPC55S69-EVK, I noticed significantly slower read/write speeds with Zephyr’s USB mass storage (using the SDIF driver) compared to the MCUXpresso SDK example.

Benchmark Results

Below are the performance comparisons using CrystalDiskMark 8.0.6:

1. MCUXpresso SDK Example (lpcxpresso55s69_dev_msc_disk_freertos_cm33_core0)
[Read]
  SEQ 1MiB: 10.903 MB/s | RND 4KiB: 4.204 MB/s
[Write]
  SEQ 1MiB: 7.756 MB/s  | RND 4KiB: 3.286 MB/s

 

2. Zephyr (Legacy USB Stack)
[Read]
  SEQ 1MiB: 1.048 MB/s | RND 4KiB: 0.985 MB/s
[Write]
  SEQ 1MiB: 0.209 MB/s | RND 4KiB: 0.351 MB/s

 ~10x slower than MCUXpresso SDK.

3. Zephyr (USB Device Next Stack)
[Read]
  SEQ 1MiB: 1.676 MB/s | RND 4KiB: 1.489 MB/s
[Write]
  SEQ 1MiB: 0.628 MB/s | RND 4KiB: 0.830 MB/s

*Still ~5-6x slower than MCUXpresso SDK.*

Debugging Attempts

  • Enabled Zephyr SDHC & SD card logs – no errors detected.

  • Confirmed SD card initialization (3.3V, 50MHz clock, correct block size).

  • Logs show successful SDIF clock configuration (24MHz → 50MHz).

[00:00:00.000] <dbg> sd: sd_init_io: Host controller support 3.3V max  
[00:00:01.000] <dbg> sdif: mcux_sdif_set_io: SDIF clock set to 400000  
[00:00:01.376] <dbg> sd: sdmmc_read_csd: Card block count 124735488, block size 512  
[00:00:01.376] <dbg> sdif: mcux_sdif_set_io: SDIF clock set to 24000000  
[00:00:01.379] <dbg> sd: sdmmc_set_bus_speed: Setting bus clock to: 50000000  

 

Environment

  • Board: LPC55S69-EVK 

  • Zephyr Version:  commit :c2d52c7f4b53a3e3691a7e6fa15af83ef72446cc(4.1.99)

Are their any Kconfig option or overlay that I need to modify ?

I’d appreciate any insights or suggestions to debug this further

Thanks in advance!

Tags (3)
0 Kudos
Reply
8 Replies

1,010 Views
wima88
Contributor III

@Harry_Zhang  Any  Update on this issue? I tested the FRDM-MCXN947  (with Zephyr) which uses the imx driver instead of the lpc driver. and results are pretty much the same as above 

Thanks 

0 Kudos
Reply

887 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @wima88 

 

Could you please try adding the following optimizations 

 

CONFIG_MCUX_SDIF_DMA_BUFFER_SIZE=512
CONFIG_SPEED_OPTIMIZATIONS=y
CONFIG_SDIO_STACK=y
CONFIG_MPU=n
CONFIG_ASSERT=n
CONFIG_LOG=n
CONFIG_LOG_DEFAULT_LEVEL=0

BR

Harry

0 Kudos
Reply

864 Views
wima88
Contributor III

Hi Harry , 

Thanks for getting back to me. with suggested Konig options I was managed to get around 2.54 MB/s. 

[Read]
SEQ 1MiB (Q= 1, T= 1): 2.516 MB/s [ 2.4 IOPS] <412859.66 us>
RND 4KiB (Q= 1, T= 1): 2.033 MB/s [ 496.3 IOPS] < 2011.94 us>

I wonder, could USB stack be the bottle neck? 

 

0 Kudos
Reply

724 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @wima88 

Another USB optimizations that you could give a try. 

CONFIG_UDC_BUF_COUNT=128
CONFIG_UDC_WORKQUEUE_STACK_SIZE=2048
CONFIG_UDC_WORKQUEUE_PRIORITY=0

BR

Harry

0 Kudos
Reply

708 Views
wima88
Contributor III

Thanks for the suggestions.

Despite all the optimizations and changes, the best I could reach was 3.1 MB/s. Have you identified the root cause of the performance issue yet? Frankly, I doubt any amount of system tuning alone will get us to full performance without addressing the underlying problem.

 

Wimansha 

0 Kudos
Reply

1,002 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @wima88 

We are investigating this issue, I will inform you as soon as there is a result.

BR

Harry

0 Kudos
Reply

1,109 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @wima88 

May i ask how to tested it?

I want to test it.

BR

Harry

0 Kudos
Reply

1,104 Views
wima88
Contributor III

Hi Harry , 

Hi,

I use CrystalDiskMark as my benchmarking tool(https://crystalmark.info/en). Here’s my setup and process:

MCUXpresso SDK Setup:

  • Modified jumper P4 voltage from 1.8V to 3.3V (as per user guide Table 1, P21).

  • Downloaded the SDK example (v25.03.00) via the MCUXpresso extension in VSCode.

  • Built and flashed the lpcxpresso55s69_dev_msc_disk_freertos_cm33_core0 example.

  • After reset, the serial terminal showed the prompt: "Please insert disk."

  • Used a SanDisk Class 3 V30 SD card.

  • Connected P9 (HS-USB) and configured CrystalDiskMark (see attached screenshot).57ecc5a0-a2cc-4775-be4c-74ff59cc81ae.jpgScreenshot 2025-06-25 105150.png

  • Tested with:

    • 1MB block size

    • 1 Queue, 1 Thread

    • 9 iterations of a 32MB file

Zephyr Setup:

Used the same development environment as above.

Legacy USB Stack:

  • Example: zephyr/samples/subsys/usb/mass

  • No modifications made.

  • Build command:
west build -p -b lpcxpresso55s69/lpc55s69/cpu0
west flash

USB Next Stack:

Modified next_usb_prj.conf as follows:

CONFIG_DISK_ACCESS=y  
CONFIG_FILE_SYSTEM=y  
CONFIG_FAT_FILESYSTEM_ELM=y  
CONFIG_PRINTK=y  

CONFIG_DISK_DRIVERS=y  
CONFIG_DISK_DRIVER_SDMMC=y  

CONFIG_SDHC_LOG_LEVEL_DBG=y  
CONFIG_SD_LOG_LEVEL_DBG=y  
CONFIG_LOG_BUFFER_SIZE=2048  

CONFIG_USBD_MSC_STACK_SIZE=4096  
CONFIG_USBD_MSC_LUNS_PER_INSTANCE=5  
CONFIG_USBD_MSC_SCSI_BUFFER_SIZE=2048  

Build Command

west build -p -b lpcxpresso55s69/lpc55s69/cpu0 -- -DCONF_FILE=usbd_next_prj.conf  
west flash

 

Testing:

  • Used the same CrystalDiskMark setup for all three cases.

  • No overlay files were used in either Zephyr example.

Let me know if you need any further details!

 

Thank You

Tags (3)
0 Kudos
Reply