ch376t sd卡 spi方式 问题

我用的是ch376t芯片用spi方式操作sd卡,sd卡是t卡。

初始化都能成功,但是我想建立二层目录来写一个txt文件时,每次只是建立了一层目录,没有出现二层目录和txt文件 ,多级目录宏也打开了,不知道为什么,求大侠解惑

这是程序:

printf( "Write TXT file :" ); CH376DirCreate("/YICENG"); CH376FileClose(FALSE); CH376DirCreatePath("/YICENG/ERCENG"); CH376FileClose(FALSE); CH376FileCreate("111.TXT"); for(i = 0; i < sizeof(bmphead); i++){ CH376ByteWrite(&bmphead[i], i, NULL); } CH376FileClose( TRUE );

你的操作我这边可以测试通过。到我们网站上下载最新的FILE_SYS.C,主要是CH376SetFileName函数。 void CH376SetFileName( PUINT8 name ) /* 设置将要操作的文件的文件名 */ { /* UINT8 i;*/ UINT8 c; #ifndef DEF_IC_V43_U UINT8 s; xWriteCH376Cmd( CMD01_GET_IC_VER ); if ( xReadCH376Data( ) < 0x43 ) { if ( CH376ReadVar8( VAR_DISK_STATUS ) < DEF_DISK_READY ) { xWriteCH376Cmd( CMD10_SET_FILE_NAME ); xWriteCH376Data( 0 ); s = CH376SendCmdWaitInt( CMD0H_FILE_OPEN ); if ( s == USB_INT_SUCCESS ) { s = CH376ReadVar8( 0xCF ); if ( s ) { CH376WriteVar32( 0x4C, CH376ReadVar32( 0x4C ) + ( (UINT16)s << 8 ) ); CH376WriteVar32( 0x50, CH376ReadVar32( 0x50 ) + ( (UINT16)s << 8 ) ); CH376WriteVar32( 0x70, 0 ); } } } } #endif xWriteCH376Cmd( CMD10_SET_FILE_NAME ); /* for ( i = MAX_FILE_NAME_LEN; i != 0; -- i ) { c = *name; xWriteCH376Data( c ); if ( c == 0 ) break; name ++; }*/ c = *name; xWriteCH376Data( c ); while ( c ) { name ++; c = *name; if ( c == DEF_SEPAR_CHAR1 || c == DEF_SEPAR_CHAR2 ) c = 0; /* 强行将文件名截止 */ xWriteCH376Data( c ); }


只有登录才能回复,可以选择微信账号登录