Spark Logic

[libmaple] SDIO

stevestrong Sun Jun 18, 2017 5:20 pm

Hi all,

I finally managed to bring the SDIO files in an acceptable form to be published.

It works with 24MHz clock and 4bits wide bus, and tested only for the generic F407VET6 board.

I have committed 2 files to libmaple core directory, and 2 files to a new SDIO lib under STM32F4/libraries.

Usage:
– get the master branch from my repo
– get the SdFat lib from https://github.com/greiman/SdFat
– insert into line 164 of SdFatConfig:
#elif defined(__STM32F4__)
#define ENABLE_SDIO_CLASS 1

Replies

zmemw16 Sun Jul 02, 2017 9:55 am

i know i’m going regret this, ss-Arduino_STM32 is a ‘ln -s’
i think it shouldn’t make any difference.
i changed it anyway, it’s now a directory.

~/sketchbook/hardware/ss-Arduino_STM32/STM32F4/cores/maple/libmaple$ ll sdi*
-rw-r--r-- 1 stephen stephen 5384 Jun 20 20:03 sdio.c
-rw-r--r-- 1 stephen stephen 13451 Jun 20 20:03 sdio.h

stevestrong Sun Jul 02, 2017 10:17 am

Hm, you’re on linux, and I cannot help you there (I am working exclusively on Win machines).

Since the path “/cores/maple” is included to the compile/build process, it should theoretically be able to include any file from the subdirectory “/libmaple/” when having an absolute reference thereto…

Is it maybe a “/” vs. “\” issue?

zmemw16 Sun Jul 02, 2017 10:52 am

while (1) {find_wall; bash_head;} :shock:

the other one i ‘m having fun with is I2CScanner, (but it has worked) Wire.h not found
just tried with yours as the only Arduino_STM directory, still the same
fresh copy coming up

curiously only the SDIO files have the backslash, the other libraries are forward slashes.
30min later, there are a lot of usb associated files full of the little bleeps

###########################################################
went slightly mad with a recursive find/replace on *.cpp, *.c, *.h, *.html, Makefile, Doxyfile
only really saw your SDIO dir changed.

anyone, i found myself setting in chrismicro repo, board as Black F407VE with SDIODirListWriteRead.ino

it works :D :D

stephen

Pito Sun Jul 02, 2017 11:16 am

sdio.cpp ?

zmemw16 Sun Jul 02, 2017 1:02 pm

yes, these
libmaple/sdio.h
libmaple/dma.h

i think i was surprised i think in the cores libmaple directory, nothing

finally it compiles and links, that’s my blink_millis sketch
I2CScanner still can’t find Wire.h

srp

stevestrong Sun Jul 02, 2017 1:14 pm

I am not sure if the Wire lib is implemented at all for F4, at least in my generic F4 branch I cannot find it.
You could copy/paste from F1 lib directory and test, maybe it works out of the box :shock:
If it does not work, please open a separates thread for that.

zmemw16 Sun Jul 02, 2017 1:21 pm

i may well be thinking of a different box (HAL), cm’s is most likely

not implemented would certainly be an explanation. :(
stephen

zmemw16 Sun Jul 02, 2017 2:13 pm

would a diff -r be of use to you ? attached
ss-Arduino_STM32 is my backslash edited version.

stephen

stevestrong Sun Jul 02, 2017 2:59 pm

Stephen, thanks, I can view all backslashes with NP++.
Did the backslash replacement in “SDIOF4.cpp” solve your problem?
Makes sense to replace all other include path backslashes in the repo?

zmemw16 Sun Jul 02, 2017 3:20 pm

partially, it then fell over on just about every usb associated include
that diff should be enough to give all the ones i changed; there may well be more.
in the libmaple dir, i think sdio.[cpp|h] was it.

whether or not it makes sense is really down to how windows behaves with forward slashes.
as most of the grep’d ‘#include’ lines showed forward slashes, it may be much more tolerant of them than linux !
not often there’s such a positive for windows.

stephen

stevestrong Tue Jul 04, 2017 8:34 am

I’ll replace all remaining backslashes when I have time.

stevestrong Tue Jul 04, 2017 5:34 pm

I committed a fix where all backslashes are replaced by slashes. I think it should compile now on linux.
Please take the master branch, the generic one does not exists anymore.

I know now why I included backslashes: because Github for windows also uses it:

github_backslashes.jpg
github_backslashes.jpg (115.64 KiB) Viewed 280 times

zmemw16 Tue Jul 04, 2017 8:08 pm

Please take the master branch, the generic one does not exists anymore.
yep, noticed that :D
pulling it now

i’m using a Black F407VE and declaring generic_f407v as the board type.

all the sketches that i’ve tried (SdioDemo is one) are reporting SdFat.h not found.
i mention this as it’s the only one having SdioF4 explicitly declared
//#include <SdFat.h>
#include <SdioF4.h>

stevestrong Tue Jul 04, 2017 9:08 pm

The very first post contains all the details, please check it again.

I dont know under linux how Arduino ide handles the paths, the /libraries folder should be included there, so that SdFat.h is found.

An example sketch is at the end of page 2.

zmemw16 Tue Jul 04, 2017 11:27 pm

NB the the fine manual for SdFat-beta, specifically where to copy the SdFat directory.

now compiles, i edited to use a SERIALDEV from a define, easier to change just one
running a mite different, i tried with Serial, Serial1, but only with SerialUSB i got any output.
evidently it also doesn’t like my Kingston SDC4/4GB sdcard
size,write,read
bytes,KB/sec,KB/sec
512,145.39,680.11
1024,227.14,839.41
2048,344.94,1623.80
4096,file.write returned: 4294967295
error: write failed
SD errorCode: 0X60,0X0

stevestrong Wed Jul 05, 2017 9:03 am

Each run finishes with the same error message each time at the same buffer size?
If so, then it can be a card issue, maybe it does not support the amount of data to be transferred at once.

Pito Wed Jul 05, 2017 9:11 am

Try 12MHz SDIO clock with the CL4 card..
PLL_Q set to 14. You would need Serial1 as the USB will stop working.

stevestrong Wed Jul 05, 2017 9:26 am

[Pito – Wed Jul 05, 2017 9:11 am] –
Try 12MHz SDIO clock with the CL4 card..
PLL_Q set to 14. You would need Serial1 as the USB will stop working.

Before doing this I have to be sure that it is really the frequency which causes the problem, and not any other card-intern related issue.
If 2kB buffer works OK at 24MHz, why shouldn’t 4kB buffer work as well?

Pito Wed Jul 05, 2017 9:32 am

If 2kB buffer works OK at 24MHz, why shouldn’t 4kB buffer work as well?
Who does say that?
Also do not use SdFat-beta but the latest SdFat master https://github.com/greiman/SdFat
There is maybe a fix (see my post) already implemented as the SdFat got problem with file.write() with buffer sizes above 128kB.

Sign in to reply