SDIO port to STM32F4x
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: SDIO port to STM32F4x
I think resistors are just needed to keep the card inputs from floating while the MCU is being configured after reset.
Giovanni
Giovanni
Re: SDIO port to STM32F4x
Hi Giovanni,
I have finished low level tests - driver works fine. But it would be nice to have FS-based tests to be sure in stability. Is there any FATFS test suit for MCU?
How to merge improvements in diskio.c file to chibios project?
I have finished low level tests - driver works fine. But it would be nice to have FS-based tests to be sure in stability. Is there any FATFS test suit for MCU?
How to merge improvements in diskio.c file to chibios project?
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: SDIO port to STM32F4x
I have no test suite for FatFS, my current plan is to create a FS abstraction layer and then test the FS implementation using the abstraction, the chfiles.h header was a first part of this but it is currently on hold.
Giovanni
Giovanni
Re: SDIO port to STM32F4x
what's done in rev. 4031:
- testhal finished (passes successfully on my F4x)
- rtc support added in FatFS driver
IMO driver ready use.
- testhal finished (passes successfully on my F4x)
- rtc support added in FatFS driver
IMO driver ready use.
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: SDIO port to STM32F4x
Grabbed /branches/sdc_dev2 from subversion and tried to compile. Got an error:
The function rtcGetTimeFat() (note the last two words are reversed) in os/varios/chrtclib.c. Not sure which is desired.
Eric
Code: Select all
Compiling ../../../ext/fatfs/src/diskio.c
../../../ext/fatfs/src/diskio.c: In function 'get_fattime':
../../../ext/fatfs/src/diskio.c:236:5: warning: implicit declaration of function 'rtcGetFatTime' [-Wimplicit-function-declaration]
The function rtcGetTimeFat() (note the last two words are reversed) in os/varios/chrtclib.c. Not sure which is desired.
Eric
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: SDIO port to STM32F4x
Hi,
Probably it is not complete, you can make make that function return zero instead of time. I will review the status of that branch when I have some time.
Giovanni
Probably it is not complete, you can make make that function return zero instead of time. I will review the status of that branch when I have some time.
Giovanni
Re: SDIO port to STM32F4x
hi Eric
You must use function from os/varios/chrtclib.c. Also diskio.c needs some modification but it distributed in fatfs archive and can not be easily modified in svn repo. Giovanni have some plans to reorganize source tree in accordance to not mix licenses in code. For a moment I can attach modified diskio.c. to my message.
You must use function from os/varios/chrtclib.c. Also diskio.c needs some modification but it distributed in fatfs archive and can not be easily modified in svn repo. Giovanni have some plans to reorganize source tree in accordance to not mix licenses in code. For a moment I can attach modified diskio.c. to my message.
- Attachments
-
- diskio.zip
- (1.48 KiB) Downloaded 554 times
Re: SDIO port to STM32F4x
Hi All,
I was able to successfully read/write to an SD card using the sdc_dev2 branch and the SDC HAL test. I am using a custom board based on the STM32F4. I did have a couple of problems which are noted below.
First, I wanted to clarify my previous post. diskio.c within fatfs-0.8b-patched.zip in the branch references 'rtcGetFatTime()'. The function in chrtclib.c is 'rtcGetTimeFat()'. Note that the last two words are reversed. The diskio.c attached previously in this thread corrects this issue.
Second, I had to disable 'V2.0 cards detection' to get the test to pass. Within os/hal/src/sdc.c, I commented out lines 230 through 257 and manually set sdcp->cardmode to SDC_MODE_CARDTYPE_SDV11. If I leave the 'V2.0 cards detection' code enabled, SDC_CMD_AP_CMD on line 271 fails. The command itself succeeds, but the response contains 0x400120 and is flagged as a response error; SDC_R1_ERROR(resp[0]) returns true. The high bit (0x400000) is causing the problem. I believe it indicates an 'Illegal Command' and is being returned by the card as it is not in the correct state to handle the command. Not sure if it is a timing issue or something else. Would be happy to help debug if anyone has any ideas. For the record, I'm using a 1GB Transcend uSD card.
I'll be testing this further in the near future and will post if I encounter any other problems.
Great job guys, hopefully this makes it into the released version soon!
Eric
I was able to successfully read/write to an SD card using the sdc_dev2 branch and the SDC HAL test. I am using a custom board based on the STM32F4. I did have a couple of problems which are noted below.
Code: Select all
ch> sdiotest
Trying to connect SDIO... OK
Single aligned read... OK
Single unaligned read... OK
Multiple aligned reads... OK
Multiple unaligned reads... OK
Register working area for filesystem... OK
Mount filesystem... OK
FS: 61287 free clusters, 32 sectors per cluster, 1004126208 bytes free
Create file "chtest.txt"... OK
Write some data in it... OK
Close file "chtest.txt"... OK
Umount filesystem... OK
Disconnecting from SDIO... OK
------------------------------------------------------
All tests passed successfully.
First, I wanted to clarify my previous post. diskio.c within fatfs-0.8b-patched.zip in the branch references 'rtcGetFatTime()'. The function in chrtclib.c is 'rtcGetTimeFat()'. Note that the last two words are reversed. The diskio.c attached previously in this thread corrects this issue.
Second, I had to disable 'V2.0 cards detection' to get the test to pass. Within os/hal/src/sdc.c, I commented out lines 230 through 257 and manually set sdcp->cardmode to SDC_MODE_CARDTYPE_SDV11. If I leave the 'V2.0 cards detection' code enabled, SDC_CMD_AP_CMD on line 271 fails. The command itself succeeds, but the response contains 0x400120 and is flagged as a response error; SDC_R1_ERROR(resp[0]) returns true. The high bit (0x400000) is causing the problem. I believe it indicates an 'Illegal Command' and is being returned by the card as it is not in the correct state to handle the command. Not sure if it is a timing issue or something else. Would be happy to help debug if anyone has any ideas. For the record, I'm using a 1GB Transcend uSD card.
I'll be testing this further in the near future and will post if I encounter any other problems.
Great job guys, hopefully this makes it into the released version soon!
Eric
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: SDIO port to STM32F4x
Hi,
the improved SDC driver will be released in 2.5.0 and backported to 2.4.1 too, in this moment I am busy with USB for F2/F4, the driver will be merged after this task. In the meanwhile please continue testing it, any feedback is welcome.
Giovanni
the improved SDC driver will be released in 2.5.0 and backported to 2.4.1 too, in this moment I am busy with USB for F2/F4, the driver will be merged after this task. In the meanwhile please continue testing it, any feedback is welcome.
Giovanni