Page 1 of 1

[Libmaple] SDIO driver for F1 series.

Posted: Sun Sep 10, 2017 3:09 pm
by victor_pv
Based on the driver from Steve for F4 (viewtopic.php?f=39&t=2215&hilit=sdio+libmaple&start=80 thanks Steve!), I have adapted it for the F1.
The problem I have is that I didn't have any board with an SDIO slot in the PCB. I am having to use for testing one of the typical SPI-SDCard adapters, connected with dupont cables.
So I can't use 4 bit mode (D2 and D3 are not broken out to the connector), and I am having to run it at no more than 1Mhz, and still I get problems every once in a while.

Does anyone have an F1 board with an onboard sdcard slot connected to the SDIO?
If so, I would need your help with testing.
Warning, not all boards have the slot connected to the SDIO pins. I have one here that has it connected to SPI1 :(

This is the bench test with a class 2 card at 1Mhz 1 bit mode:

Code: Select all

Manufacturer ID: 0X1B
OEM ID: SM
Product: 00000
Version: 1.0
Serial number: 0XFEF37216
Manufacturing date: 4/2011

File size 5 MB
Buffer size 2048 bytes
Starting write test, please wait.

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
85.71,164623,17109,23881
85.67,165073,20813,23892

Starting read test, please wait.
 
read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
109.75,25514,17432,18659
109.76,19639,17432,18656

Done
Type any character to start
This is at 2Mhz, I can write, but not read :(

Code: Select all

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
132.29,156462,8627,15471
132.13,158481,12374,15489

Starting read test, please wait.

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
error: read failed
SD errorCode: 0X60,0X0
UPDATE:
For anyone willing to test, this is the first release of the code:
https://github.com/rogerclarkmelbourne/ ... 2/pull/339

Re: [Libmaple] SDIO driver for F1 series.

Posted: Sun Sep 10, 2017 9:12 pm
by RogerClark
i have a VET and ZET board, both of which have SD adaptors on them.

I think they are connected to SDIO, but i would need to see if I can find a schematic.

Or I could just run your code and see if it works ;-)

Re: [Libmaple] SDIO driver for F1 series.

Posted: Mon Sep 11, 2017 1:04 am
by victor_pv
I'll send you a PR with the corresponding files.
Don't merge it yet, or merge to a separate branch for anyone willing to test.

I'm still trying to find if there is something wrong witht he DMA setup, but I don't think it's that, since the write is also with DMA and seems to work, and so far has not corrupted the cards, so it seems to read the FAT correctly to find the free space for the test file.

I have one board with an RCT6 mcu, has a potentiometer, a 2x4 header not sure what for, and 2 usb ports, one directly to the MCU and another to a serial-usb chip. That one has the sdcard connected to the SPI1. I tried to find it in aliexpress or ebay and couldn't, if I find it I'll post a photo since that will not work for SDIO. I had to use a multimeter to find where the SDIO pins were connected to since I couldn't find an schematic either.
Sadly it's the only F1 board with SD slot that I have. :(

Re: [Libmaple] SDIO driver for F1 series.

Posted: Mon Sep 11, 2017 1:20 am
by RogerClark
Victor

I found a F103ZET board which has a micro SD

https://www.aliexpress.com/item/Mini-ve ... 89455.html

Image

I may have a VET which has it, but I guess the ZET will do

Re: [Libmaple] SDIO driver for F1 series.

Posted: Mon Sep 11, 2017 2:46 am
by zmemw16
from recent posts about it, i now have both models of the blue cz style vet boards.
another pair of 2017 en route :)
re-configuring my setup for one original now, ok might be a zet though.
stephen

Re: [Libmaple] SDIO driver for F1 series.

Posted: Tue Sep 12, 2017 2:39 am
by victor_pv
Guys i have just sent a PR to Roger with the required files.
I only sent the changes to one of the board.h files, but you need the same changes for any board that uses them. Optionally we could place those defines somewhere in the core, perhaps the stm32.h file or another, since the pins are always the same for any MCU that supports SDIO, no matter the count of pins, and can not be remapped.