[fixed] SD reader example - weirdo with Windows 10

Working libraries, libraries being ported and related hardware
madias
Posts: 30
Joined: Thu May 09, 2019 11:37 am

Re: [fixed] SD reader example - weirdo with Windows 10

Post by madias » Tue Oct 29, 2019 4:24 pm

Thank you Steve! I'm going to raise the amount of cache, sounds like a reasonable thing to try out.

madias
Posts: 30
Joined: Thu May 09, 2019 11:37 am

Re: [fixed] SD reader example - weirdo with Windows 10

Post by madias » Tue Oct 29, 2019 4:45 pm

Cache is increased for ARM by default:

Code: Select all

/**
 * Set USE_SEPARATE_FAT_CACHE nonzero to use a second 512 byte cache
 * for FAT table entries.  This improves performance for large writes
 * that are not a multiple of 512 bytes.
 */
#ifdef __arm__
#define USE_SEPARATE_FAT_CACHE 1
#else  // __arm__
#define USE_SEPARATE_FAT_CACHE 0
#endif  // __arm__

madias
Posts: 30
Joined: Thu May 09, 2019 11:37 am

Re: [fixed] SD reader example - weirdo with Windows 10

Post by madias » Tue Oct 29, 2019 5:19 pm

Ok, I'm now at 380KB/s - it's 220KB/s less than on benchmark systems (are the benchmarks done with SDIO? EDIT: Wrong! STM32F103C8/B has no hardware SDIO ), but ok and stable on my productive code with some buttons IRQ check within the loop:

Code: Select all

  while (!buttonflag) {
    MassStorage.loop();
  }

ag123
Posts: 196
Joined: Thu Mar 07, 2019 6:15 am
Location: Singapore
OS: linux
IDE: eclipse, arduino 1.8.5
Core: Roger's
Board: Maple mini, Bluepill

Re: [fixed] SD reader example - weirdo with Windows 10

Post by ag123 » Wed Oct 30, 2019 10:45 pm

if you are using gremian's sd fat, i think the 'sdio' feature i.e. sdfat ex uses some commands that allow it to do 'continuous' reads rather than read and turn around. i.e. a bigger buffer cache size is needed.
if i remember correctly, usb requests tend to fetch chunks of 64 bytes at a time, i'm not sure if i'm right about it at all. that may mean that even for 512 bytes, it would take a couple of chunks being transferred. but literally 380KB is not bad on a blue pill.
if we consider that 10mbps is about as much as usb 2.0 full speed can achieve, you have reached pretty much 50% that bandwidth, the rest could be the overheads and turn arounds

User avatar
Pito
Posts: 18
Joined: Thu Mar 07, 2019 6:48 pm
Location: Rapa Nui
OS: Win7
IDE: Arduino, Sloeber, Uecide
Core: Roger
Board: Blue_Black_MM_103xx_407xx

Re: [fixed] SD reader example - weirdo with Windows 10

Post by Pito » Fri Nov 01, 2019 6:38 pm

The below USE_SEPARATE_FAT_CACHE is for FAT table only.
In order to speed up and increase the data cache you have to increase in bench.ino

// Size of read/write.
const size_t BUF_SIZE = 512;

to something like 8192...

Also doublecheck whether you are using #define USE_MULTI_BLOCK_IO 1
Pukao Hats Cleaning Services, Ltd.

Post Reply