SDIO speed with STM32F439

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
formica
Posts: 8
Joined: Thu Mar 30, 2017 10:47 pm

SDIO speed with STM32F439

Post by formica » Sat Sep 30, 2017 1:54 pm

Hi guys,
I'm using a custom board with an SDcard connected to a STM32F439 through SDIO port.
The SDcard is automatically recognized as mass device and everything seems to be ok but I'm noticing that writing on the SD is really slow: I have measured 10KB/sec in average on a CLASS 10 SD card.

I'm using this testing code:

Code: Select all

import utime
class sdcard_write_test:
        def __init__(self):
                self.t1 = 0
                self.t2 = 0
                self.wtime = 0
                self.char = 0x5555

        def test(self,fd):
                self.t1 = utime.ticks_ms()
                for i in range(0,50000):
                        fd.write('{:X} '.format(self.char))
                self.t2 = utime.ticks_ms()
                self.wtime = utime.ticks_diff(self.t2,self.t1)
Any idea to speedup?

Regards

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: SDIO speed with STM32F439

Post by pythoncoder » Mon Oct 02, 2017 4:57 pm

Probably a minor issue but I'd take the string formatting out of the loop:

Code: Select all

def test(self,fd):
    str = '{:X} '.format(self.char)
    self.t1 = utime.ticks_ms()
    for i in range(50000):
        fd.write(str)
    self.t2 = utime.ticks_ms()
    self.wtime = utime.ticks_diff(self.t2,self.t1)
As a general point it's probably faster to write a large buffer rather than repeatedly writing a small one, but that depends on what you're aiming to measure.
Peter Hinch
Index to my micropython libraries.

Post Reply