2014-03-27 06:55 AM
Hi!
Does someone use the SDIO module on STM32, especially in 4 bits mode, through DMA? Standard 1 bit SPI was good for small project and tiny UC but is quite slow compared to the latest STM32F42x performances. #sdio-sd-fatfs2014-03-27 07:21 AM
I do. I have SDIO 4b + DMA running with FatFs.
For sure it helps in performance. However I observed that the sector write can be slower than the transfer itself (well it certainly depends the SDcard itself). In such a case the gain of 4b vs 1b is not high.2014-03-27 08:00 PM
Yes, and it's very rapid.
I've got SDHC cards reading at 10.6 MBps using nominal clocks, and 15.8 MBps with aggressive clocks. Sandisk Extreme MicroSD Card, 32 MB read as 32 KB blocks. STM32F4-Discovery + STM32F4-DIS-BB2015-05-07 06:40 AM
Hey Gonzalez
I have a working code which writes about 300 bytes of data at 50 Hz to SD card. This uses SDIO interface without the DMA. But the problem with this code is that it causes the code to slow down at times. So, I have two questions:1. Will it increase the speed if I use DMA with SDIO interface. 2. What is the Max data I can write at 50 Hz, without slowing the code down. I have stm32f103 series mcu. Thanks2015-05-07 11:15 AM
Appears to be somewhat off topic.
Sounds like you need to buffer the data more effectively, and have the writing code in it's own thread so it doesn't block your other activity.Writing 300 bytes is perhaps one of the worst sizes, it doesn't even fill a single 512 byte sectors, let alone a cluster or two.I don't have any F1 parts/boards supporting SDIO to hand, but I'd suspect 1-2 MBps sustain writes, what's that 20KB at 50Hz2015-05-08 12:30 AM
How much data should I buffer so that the rate at which my other code is running is not affected?
I have not implemented RTOS right now. So, the whole code is running on a single thread, which gets affected by this logging.Is there anything else I can do in terms of implementation. I can only use SDIO interface right now for writing to SD card. Should I consider buying a new board which has SPI interface for interfacing the SD card.2015-05-08 04:59 AM
You don't need to use an RTOS to effectively use interrupts and buffering. You need to get out of your serial execution with blocking mindset.
SPI will be significantly slower than SDIO I'd try to write as blocks of 16KB or 32KB, something that's an integer number of sectors, on a sector boundary.2015-05-11 10:41 PM
But the amount of data buffering I can do before writing to SD card is limited by the RAM size.
I think implementing DMA with a queue data structure for holding data would solve the problem. Is it possible to implement queue such that as soon as queue is full, an interrupt is generated which initiates the DMA transfer.2015-05-12 06:03 AM
Ok, so benchmark what's workable in your system.
I'd probably do the 50 Hz stuff under interrupt. There are lots of ways to solve this, use your experience/training to pick one that works for you.