USB and SDCard stack fail when remove files

Hi,

in our application we use SDCard and USB stack with the following configuration:

#Peripherals
CONFIG_GPIO=y
CONFIG_SPI=y
CONFIG_I2C=y
CONFIG_ADC=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# Flash
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y

CONFIG_PRINTK=y

CONFIG_LOG=y

# Infrared timer
CONFIG_COUNTER=y
CONFIG_COUNTER_RTC0=y
# This timer is used only for read IR competitor protocol
CONFIG_NRFX_TIMER1=y
CONFIG_NRFX_TIMER2=y

# SDCard & Filesystem
CONFIG_DISK_DRIVERS=y
CONFIG_DISK_DRIVER_SDMMC=y
CONFIG_DISK_ACCESS=y
CONFIG_FILE_SYSTEM=y
CONFIG_FAT_FILESYSTEM_ELM=y

# Bootloader
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
#CONFIG_IMG_ERASE_PROGRESSIVELY=y

# Bluetooth configuration
CONFIG_BT=y
CONFIG_BT_OBSERVER=y
#CONFIG_BT_BROADCASTER=y
CONFIG_BT_HCI=y
# BT LE White list
CONFIG_BT_FILTER_ACCEPT_LIST=y

# Test filter by UUID
# CONFIG_BT_PERIPHERAL=y
# CONFIG_BT_CENTRAL=y
# CONFIG_BT_SCAN=y
# CONFIG_BT_SCAN_FILTER_ENABLE=y
# CONFIG_BT_SCAN_WITH_IDENTITY=y

# Accelerometer
# CONFIG_SENSOR=y
#CONFIG_LIS2DH=y
# +/- 2g
#CONFIG_LIS2DH_ACCEL_RANGE_2G=y
# 10Hz
#CONFIG_LIS2DH_ODR_2=y
# Low Power Mode - 8bit
#CONFIG_LIS2DH_OPER_MODE_LOW_POWER=y

# Enable Low Power
CONFIG_PM=y
CONFIG_PM_DEVICE=y
CONFIG_REBOOT=y

#USB related configs
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="SGuide V3"
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_MASS_STORAGE=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
CONFIG_USB_MASS_STORAGE_LOG_LEVEL_ERR=y
CONFIG_APP_MSC_STORAGE_SDCARD=y
#CONFIG_USB_DEVICE_PID=0x0008

# Used on AM131 Board
CONFIG_NFCT_PINS_AS_GPIOS=y
CONFIG_BOARD_ENABLE_DCDC_APP=n
CONFIG_BOARD_ENABLE_DCDC_NET=n
CONFIG_BOARD_ENABLE_DCDC_HV=n
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=n
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y

# Other 
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_IDLE_STACK_SIZE=4096

CONFIG_SIZE_OPTIMIZATIONS=n

# Reset on hard fault
CONFIG_RESET_ON_FATAL_ERROR=y

The communication with the nRF5340 is done by using a Linux Embedded systems. When the device is connected to Linux, I copy a folder inside the SDCard without any problem.

When I remove the folder and put into a new one the copy fails and the linux systems told us that the memory was corrupted.

Instead, if I remove the folder directly from the OS (by removing the SDCard from the board with the nRF5340), and after that I write the folder by using the nRF5340 it works correctly.

The device are in production and we don't know how solve this issue!! Can you help us?

Best

Marco

Parents Reply Children
No Data
Related