2015-04-07 03:52 AM
In example:
if(f_open(&MyFile, ''STM32.TXT'', FA_CREATE_ALWAYS | FA_WRITE) != FR_OK) Keil output: error: &sharp167: argument of type ''char *'' is incompatible with parameter of type ''const TCHAR *'' if(f_open(&MyFile, ''STM32.TXT'', FA_CREATE_ALWAYS | FA_WRITE) != FR_OK) #whiskey-tango-foxtrot2015-04-07 09:21 AM
Which STM32CubeF4 package & µVision versions are you using?
-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2015-04-07 11:14 PM
STM32CubeMX Software V4.7.0 / 20 March 2015
STM32CubeF4 Firmware Package V1.5.0 /13-March-2015
µVision V5.0.0 Tool Version Numbers: Toolchain: MDK-ARM Standard Version: 5.0.0 C Compiler: Armcc.exe V5.05 update 1 (build 106) Assembler: Armasm.exe V5.05 update 1 (build 106) Linker/Locator: ArmLink.exe V5.05 update 1 (build 106) Library Manager: ArmAr.exe V5.05 update 1 (build 106) Hex Converter: FromElf.exe V5.05 update 1 (build 106) CPU DLL: SARMCM3.DLL V5.0.0 Dialog DLL: DCM.DLL V1.1.0 Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll V2.0.0_KEIL Dialog DLL: TCM.DLL V1.4.0 And some fun thnigs - autogenerated code for SDIO mode ''SD 1 bit'' have HardFault, then i try to use f_open My example:FATFS FileSystem;
uint8_t DiskPath[4];
FIL LogFile;
if(retSD==0)
{
printf(''Link MicroSD Driver:\t[OK]
'');
if(f_mount(&FileSystem, (TCHAR const*)DiskPath, 0) != FR_OK)
{
printf(''Mount file system:\t[FAIL]
'');
}
else
{
printf(''Mount file system:\t[OK]
'');
if(f_open(&LogFile,(TCHAR *) ''log.txt'',FA_CREATE_ALWAYS | FA_WRITE) != FR_OK)
{
printf(''Opening file:\t[FAIL]
'');
}
else
{
printf(''Opening file:\t\t[OK]
'');
uint32_t byteswritten;
if(f_write(&LogFile,''Hello world'',sizeof(''Hello world''),(void *)&byteswritten) != FR_OK)
{
printf(''Writing:\t\t[FAIL]'');
}
else
{
printf(''Writing:\t\t[OK]'');
printf(''Writed %d bytes
'',byteswritten);
if(f_close(&LogFile) != FR_OK)
{
printf(''Close file:\t\t[FAIL]'');
}
else
{
printf(''Close file:\t\t[OK]'');
}
}
}
}
}
else
{
printf(''Link MicroSD Driver:\t[FAIL]
'');
}
As i know - in file ff.c (f_open function) at string №2446
res = find_volume(&dj.fs, &path, (BYTE)(mode & ~FA_READ));
after thet string pointer to hsd->Instance will be modifed (hsd->Instance must bee 0x12C00, but after this function it have value 0xA)
Tested at STM32F4Dicrovery with DM-STF4BB extation board (microSD holder and etc.)
2015-04-08 01:41 AM
LOL, wtf
this code change hsd->Instance 0x080037F0 E92D4FF7 PUSH {r0-r2,r4-r11,lr}how?2015-04-08 08:59 AM
Make sure you have an adequate stack allocation.
2015-04-08 10:39 PM