This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

fopen write error sdmmc

I am driving a 32 GB SD card with Keil MDK5 Flash File System v6.14.1 with core LFN debug mode.
Init, Mounting, and also read operations from SD card works properly. But creating or deleting a file and then open it in write mode doesn't work at all.

device: stm32H750vbt6 with ARM CORTEX-M7

core clock (frequency): 480e6

SDMMC1 configured clock (frequency): 100e6

RTOS type is  CMSIS-RTOS2 Keil RTX version 5 (RTX5)

Number of open files that configured in FS_Config.c file: 5 

Heap Size = 0x2000 > 5 * (608) 

Stack Size: 0x400

Card Detect Input pin and Write Protect Input pin: not available

initialization code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//file fsys_init.c
#include "fsys_init.h"
SD_HandleTypeDef hsd1;
//fsys_init called in app_main thraed
void fsys_init(void){
static volatile fsStatus error_tp;
error_tp = finit ("M:");
if (error_tp != fsOK)
fsys_error_handler(fsys_finit_error, error_tp);
osDelay(10);
// Mount the M: drive.
error_tp = fsOK + 1;
while(error_tp != fsOK ){
error_tp = fmount ("M:");
}
//HAL_SD_MspInit(&hsd1);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

After debugging the following events occurred when I tried to open and create "M:\filesys\Dump_file.logo" in write mode:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Event, Time (sec), Component, Event Property, Value
0, 0.00039830, EvCtrl, EventRecorderInitialize, Restart Count = 1
1, 0.00040655, EvCtrl, EventRecorderStart,
2, 0.00236864, EvCtrl, EventRecorderInitialize, Restart Count = 2
3, 0.00237939, EvCtrl, EventRecorderStart,
4, 0.00262214, FsCore, finit, drive=0x0800AFBC
5, 0.23689052, FsCore, fmount, drive=0x0800AFBC
6, 6.21071641, FsCore, sys_open, name=0x080048C8 openmode=0x00000004
7, 6.34828006, FsFAT, FileIsNonExistent, drive=M0
8, 6.47961456, FsMcMCI, TransferError, instance=0 events=0x00000084
9, 6.52405997, FsMcMCI, TransferError, instance=0 events=0x00000084
10, 6.56378528, FsMcMCI, TransferError, instance=0 events=0x00000084
11, 6.60354884, FsMcMCI, TransferError, instance=0 events=0x00000084
12, 6.64327516, FsMcMCI, TransferError, instance=0 events=0x00000084
13, 6.68302375, FsMcMCI, TransferError, instance=0 events=0x00000084
14, 6.72276447, FsMcMCI, TransferError, instance=0 events=0x00000084
15, 6.76250128, FsMcMCI, TransferError, instance=0 events=0x00000084
16, 6.80345253, FsFAT, SectorWriteFailed, drive=M0 sector=32640 count=1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

The event TransferError is generated when data transfer is active and data block CRC check fails or Memory Card Control Layer does not receive ARM_MCI_EVENT_TRANSFER_COMPLETE event from the MCI driver.

Clever engineers, please help me to solve these bad events!!

 

0