G120 Slow SD card

I have over 100 G120 boards and a lot of them takes ages to write to SD card.

I have tried to swap SD card between devices that run OK and slow but the slow one still run slow. So the problem isn’t the cards.

All modules run the latest SDK.

What could be the problem?

same cad run slow on one board but fast on another?!

@ Honken - Just curious, what class / mem size of the SD card?

Yes

Kingston 4Gb, class 4 microsd

I do not have an explanation! Can you check the power right on the SD?

@ Honken - Thanks for sharing… I am using the same in production. Will do some investigation… I found it slow too sometimes but did not pay much attention to it. I swapped the card for a class 6 card and found it almost 2 times as fast…

I have checked power and it’s stable and fine.

Now to the weird thing…

The delay in writes to the file stream is always 310ms.

I have measured the time it takes to write data to cards.

If I set a delay for 1000ms after MountFileSystem call, the “slow” problem occurs every second time I make a reboot of the G120 in VS.

And when the G120 is in “slow” mode the COM2 becomes slow to!?!?

It sends the bytes at correct bitrate but the output flow is like syrup.

It feels like the problem affects the streams…

@ Honken - A question. “Reboot in VS”, do you give your board a hard reset or do you run in VS in debug mode and do a restart?

@ RobvanSchelven - A restart in debug mode

The way you’re going to delve deeper is to show us minimal repro code and process to do this. That way someone else can also attempt the repro and validate.

The only thing I have with SD card’s that’s is slow is the time needed to mount it to the USB client, sometimes just pop’s in, sometimes takes 30-60sec.
Writing speed is alway’s good, also in debug mode.

I’m experiencing similar issue as well. I was testing 32GB SD card (Sandisk Ultra) with 4KB writes on G120 and most writes take 30-40ms but there are few writes which take 300ms+ (worst was 435ms!!). If I increase writes to eg. 16KB they can take up to a second to write.

EDIT: Just did additional tests with writing exactly 16KB. Highest speed was 90ms, worst speed was 1.1175s.

@ Honken - Have you been able to improve the speed or discovered the issue?

@ GHI i have about 5KByte / Second write speed on a class 4 SD card. Any idea what we might expect from the G120

No I havent.

When the delay kicks in its as you say about 300 ms.
Mine is always 310ms.

Realy weard. Wonder if it could be something with the flush or GC?

I have reached over 2 MB/s read and 1.5 MB/s write speeds using RLP and the long delays are gone too.

@ Hyperlisk - Thanks for sharing… Did you implement your own file system which interface directly to the micro controller?

It uses FatFS to access FAT file system.

I get it. Thanks for sharing !

i have to discus and without any promises yet but are you willing to sell some of your work so that we don’t have to re-invent the wheel if we want to implement FatFS too?