SD card benchmarking example for k60 with code warrior

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SD card benchmarking example for k60 with code warrior

2,500 Views
abdullahansari
Contributor III

Hello all

I am trying to work with SD card and want to store some results into a text file on it using tower K60N512. I am now looking for a benchmark example (with or without process expert being used) that involves reading, writting on sd card. That would help me great in learining how to write the initialization, reading and writting routines relating to SDHC peripheral on board. It would be great if some one can share or direct me to an example project.

Regards

Abdullah

Labels (1)
13 Replies

1,007 Views
bowerymarc
Contributor V

take a look here also:  SDHD and NAND flash speed benchmarks?

1,007 Views
abdullahansari
Contributor III

Hi Marc !

Yes I see nice discussions going on there. I tried Erichs project on my TWRk60N512 but despite changing the clockspeed, I wasnt able to improve the datarate in writting, in my case it was near to 8kbps, however I am trying to reach in MBs by increasing the block size and block count and internal DMA of SDHC, but i coudnt find those options in his components.

Regards

Abdullah

0 Kudos

1,007 Views
bowerymarc
Contributor V

those arent settings in the components, that's the size of file you are dealing with.  if you look at the generated code for Erich's benchmark, the file is very small.  Modify that code (and disable code generation in the component so it's not overwritten) to make a much bigger file transfer and you'll see the speed increase dramatically.  What you're seeing is basically all the overhead, the data transfer is so small that the overhead is a significant part of the transfer.

also, unlike linux, embedded file system components rarely have the smarts or big memory footprint to cache transfers to the underlying medium to improve data rates, they tend to read/write one physical block at a time.  But if you have only a little bit of SRAM to work with, that's probably a good thing.

0 Kudos

1,007 Views
abdullahansari
Contributor III


Hi Marc,

Did you experiment with the same FATfs project? if yes then what were the settings and what was the max data rate you got? and how were you able to modify the block sizes and counts.

0 Kudos

1,007 Views
bowerymarc
Contributor V

Hi Abdullah,

My entire saga is documented in the comments of this thread: FatFs with Kinetis | MCU on Eclipse

Good luck!

M

0 Kudos

1,007 Views
mjbcswitzerland
Specialist V

Hi All

I did some experiments with multiple block sector writes and have achieved 860kBytes/s (7Mb/s) file data write speed with 25MHz SDHC clock speed when transfering files via USB-MSD (full speed) with K60 at 100MHz.

It was found that if the standard single sector write could be avoided during the data transfer the write speed was about 27x faster at the SD card level (the use of pre-delete CMD23 didn't improve things with the standard speed ScanDisk card that I used but may help with certain types according to the SD card physical layer specification).

Maybe 50MHz SDHC clock would improve slightly but the full speed USB driver and MSD class layers are probably capping the max. speed in this test configuration.

There is another recent SD card speed thread that is also discussing this so I'll post the result there too.

Regards

Mark

0 Kudos

1,007 Views
abdullahansari
Contributor III

Hi Marc!

I modified the code and also modified the blockzize and blockcount which were constant in FATM1.c and also increase the nummber of writes from 10k times 10 bytes to 100k or 1000k times 10 bytes but the software is generating a low level disk error. I hope the way I am modifying the code is rite way.

I have also disabled the code generation as you said.

Talked to erich and he said he is debugging this error

But kindly confirm me the way of modifying the filesize.

Thanks

0 Kudos

1,007 Views
mjbcswitzerland
Specialist V

Hi

http://www.utasker.com/docs/uTasker/uTasker_utFAT.PDF

This supports Kinetis SDHC and can be used with web servers, FTP servers, USB-MSD, has a DOS-like interface and can be used by general applications reading and writing low level card data or working with FAT16/32.

The Kinetis, SDHC and SD cards can be simulated so that all operations can be studied and tested.

Regards

Mark

http://www.uTasker.com

1,007 Views
abdullahansari
Contributor III

HI Mark,

Thanks for your reply. Can i find a sample code of C which initializes the sdcard and then write and read files on it. It would be helpfull in learning how to write the routines for a complex device like SDHC. I have done it for ADC, DMA, PDB but for SDHC, I am finding it difficult. so if you can share an example c code, it would be great!

Regards

Abdullah

0 Kudos

1,007 Views
mjbcswitzerland
Specialist V

Abdullah

All code is available at the link.

The question is whether you want to build up your own code for learning purposes or whether you want to quickly use industrial-proven code in a project with time constraints and development budgets to be respected?

What file system do you need, or do you just want to initialise a card and read/write at the sector level?

The utFAT code alone is here in case you would like to add your own drivers for experimentation purposes :

utFAT Versions

Regards

Mark

1,007 Views
abdullahansari
Contributor III

Hi Mark,

I am actually working to store the ADC generated results into a file on SD card. I have in my project running ADC and DMA which is fetching the results into a buffer and now i want to store this buffer or pool of buffers onto a file on sdcard.

So it is like i want the filesystem say FATfs on top of SD card driver. what I am having problems in are:

1) How to initialize this SD card driver and how commands are issued for block reading and writting

2)How can I implement Filesystem on SDcard? What does "on top" means in layered programming? does it (on-top) mean I have sd card code and then I call initializing routines of my filesystem in that code with filesystem say FATfs liberaries in it or is it the inverse that I call initializing, reading and writting routines of  Sdcard in my filesystem c code

To cope with above two problems i wanted to see a running project where SD Card is initialized using SDHC and filesystem "FATfs" or any other is implemented on SDcard, where writting and reading from file is performed. I would like to first look into such an example and get know-how about the above problems and then i would like to take some routines and modify it as I have time dependencies in my work.

Regards

Abdullah

0 Kudos

1,007 Views
mjbcswitzerland
Specialist V

Hi Abdullah

If you have a file system installed and the SD card mounted you can open a file (or create it) and then write the data to it. This means your application calls a few lines of code to do what you need of it.

The document I linked gives full details about how such a solution works; how cards communicate (in SPI and SDHC modes), are formated, mounted, how the FAT operates and also example user interfaces. The Kinetis user manuals give all necessary details about the SDHC implementation in the Kinetis.

If you want to use FATfs you can get all information you need at FatFs - Generic FAT File System Module

There is example software for the SDHC interface in this thread - Very Slow SD Card Access I think that it is freescale code.

Since I don't use FATfs - I believe the utFAT is a much completer solution and it also has Kinetis support integrated in to it - I can't give much more information so you will need to try piecing parts together and building up knowledge so that you can solve any problems involved on the way.

Regards

Mark

1,007 Views
abdullahansari
Contributor III

Hi Mark

Really nice and understandable explanation of yours. Thanks for the SDHC links that helped me alot in understanding SDHC. I will try FATfs this weekend.

Regards

Abdullah

0 Kudos