Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
ArtemBond
PostPosted: Jul 17, 2008 - 04:32 PM
Rookie


Joined: Jan 22, 2008
Posts: 41


Writing 10mb file 1GB SD-card take 1m20s. Is this OK?
 
 View user's profile Send private message  
Reply with quote Back to top
hce
PostPosted: Jul 17, 2008 - 04:33 PM
Raving lunatic


Joined: Jan 07, 2003
Posts: 4580
Location: Oslo, Norway

Depends on your system and what it is doing at the same time.

So, short answer, sure it is fine...
 
 View user's profile Send private message  
Reply with quote Back to top
ArtemBond
PostPosted: Jul 17, 2008 - 04:54 PM
Rookie


Joined: Jan 22, 2008
Posts: 41


AVR32UC3A 48MHZ clock. FreeRTOS and FAT from Atmel SDK.
Only one task working.
 
 View user's profile Send private message  
Reply with quote Back to top
pmac128
PostPosted: Oct 08, 2008 - 11:51 AM
Wannabe


Joined: Jun 15, 2005
Posts: 91
Location: -

with PBA at 12Mhz I would expect 12 Mbit/Sec = 1,5 MByte/Sec.
So 10 MBytes should be written in 7 Seconds ...
 
 View user's profile Send private message  
Reply with quote Back to top
eaanon01
PostPosted: Oct 08, 2008 - 12:24 PM
Posting Freak


Joined: Aug 22, 2002
Posts: 1586
Location: Arendal Norway

That is a theoretical speed with no prototocoles handling the data transfer. You will never get that speed in real use.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
pmac128
PostPosted: Oct 08, 2008 - 12:33 PM
Wannabe


Joined: Jun 15, 2005
Posts: 91
Location: -

sure you're right, but the overhead seems too big. Its more than a factor of ten too slow ! I think that cannot be the overhead alone.
So what do think, how fast it should be in real world including protocol overhead ?
 
 View user's profile Send private message  
Reply with quote Back to top
darthvader
PostPosted: Mar 21, 2009 - 01:59 PM
Resident


Joined: Jul 18, 2005
Posts: 803


i tried with my UC3B design with SPI running at 24MHz to 1GB SD card, and I got about 1MB write in 3.4 seconds.
 
 View user's profile Send private message  
Reply with quote Back to top
pmac128
PostPosted: Mar 23, 2009 - 07:39 AM
Wannabe


Joined: Jun 15, 2005
Posts: 91
Location: -

with 12MHz I got 250 KB/sec.
not very fast at all ...
 
 View user's profile Send private message  
Reply with quote Back to top
darthvader
PostPosted: Mar 23, 2009 - 08:56 AM
Resident


Joined: Jul 18, 2005
Posts: 803


250KB/s with 12MHz SPI???

wow, that's faster than mine.

mine is about 300KB/s with 24MHz SPI
 
 View user's profile Send private message  
Reply with quote Back to top
darthvader
PostPosted: Mar 23, 2009 - 09:33 AM
Resident


Joined: Jul 18, 2005
Posts: 803


and i just found out that the file_write_buf() function I used to write a 1GB microSD card has a variable execution time, sometime it could take several times more to finish. This is really bad...
 
 View user's profile Send private message  
Reply with quote Back to top
eaanon01
PostPosted: Mar 23, 2009 - 11:11 AM
Posting Freak


Joined: Aug 22, 2002
Posts: 1586
Location: Arendal Norway

Well an SD card buffers incoming data and then flushes its internal memory so yes you will see great variations on timing when writing to an SD card...
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
darthvader
PostPosted: Mar 23, 2009 - 01:22 PM
Resident


Joined: Jul 18, 2005
Posts: 803


but how can I know the size of SD card's internal buffer, so that I can just have the same execution time when I use file_write_buf()

I tried to write 512 bytes every time I use file_write_buf(), but I still got variable time.

Isn't SD card internal block size 512 bytes?
 
 View user's profile Send private message  
Reply with quote Back to top
Heihopp
PostPosted: Mar 23, 2009 - 08:21 PM
Hangaround


Joined: Jun 04, 2007
Posts: 490
Location: Norway

SD cards may have "sectors" of 4kB, and when you write 512 byte, worst case (every time?) would be the card must read 4kB, modify 512 byte and then write back 4 kB. I don't know if the UC3 framework supports writing multiple sectors, but if you do that there might be a much less difference between theoretical and practical writing speed.
 
 View user's profile Send private message  
Reply with quote Back to top
darthvader
PostPosted: Mar 24, 2009 - 04:11 PM
Resident


Joined: Jul 18, 2005
Posts: 803


i just tried writing with 4KB everytime, and i sometimes still get about twice the normal execution time.
 
 View user's profile Send private message  
Reply with quote Back to top
Heihopp
PostPosted: Mar 24, 2009 - 07:13 PM
Hangaround


Joined: Jun 04, 2007
Posts: 490
Location: Norway

What reading speed do you get?

Here is more about the block sizes and sectors, maybe it helps to format the card using a specific software or OS that supports the internal structure in the card.

http://thunk.org/tytso/blog/2009/02/20/ ... lock-size/
 
 View user's profile Send private message  
Reply with quote Back to top
darthvader
PostPosted: Mar 24, 2009 - 09:40 PM
Resident


Joined: Jul 18, 2005
Posts: 803


at the moment I don't need to check for reading speed, but just want to have a good writing speed. I could check this in future.
 
 View user's profile Send private message  
Reply with quote Back to top
eaanon01
PostPosted: Mar 25, 2009 - 07:02 AM
Posting Freak


Joined: Aug 22, 2002
Posts: 1586
Location: Arendal Norway

Code:
Performance
     Timing                 Typical   Maximum
Block Read Access      Time 0.5 ms to 100 ms
Block Write Access     Time 0.5 ms to 240 ms
CMD1 to Ready after Power-up 50 ms to 500 ms
Sleep to Ready                1 ms to 2 ms


The SD card has an internal controller that accesses the nand flash.

MCI/SPI interface -> Signel chip controller -> NAND media

Read - The read access time is defined as the sum of the two times given by the CSD
parameters TAAC and NSAC. These card parameters define the typical delay
between the end bit of the read command and the start bit of the data block.

Write - The R2W_FACTOR field in the CSD is used to calculate the typical block
program time obtained by multiplying the read access time by this factor. It
applies to all write/erase commands (e.g., SET(CLEAR)_WRITE_PROTECT,
PROGRAM_CSD(CID) and the block write commands).
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
uC-Harry
PostPosted: Mar 26, 2009 - 08:13 AM
Resident


Joined: Dec 31, 2008
Posts: 521
Location: Langgoens, Germany

Hi,

yesterday we got 1MB/s on a 2GB SD-Card on an EVK1101. The UC3B is running 48MHz, the SPI-SClk 24MHz but block write is done by µC, still without PDCA.
 
 View user's profile Send private message  
Reply with quote Back to top
darthvader
PostPosted: Mar 26, 2009 - 09:02 PM
Resident


Joined: Jul 18, 2005
Posts: 803


1MB/s????!!!!

What buffer size did you use in your file_write_buf()?

or did you use file_write()?
 
 View user's profile Send private message  
Reply with quote Back to top
uC-Harry
PostPosted: Mar 28, 2009 - 03:35 PM
Resident


Joined: Dec 31, 2008
Posts: 521
Location: Langgoens, Germany

Hi,

we didn't use any of these given functions of the framework. We did it ourselves but it's not very universal and not optimized. What we have done is reading the documentation of the S-D-card as for as we got it, made a lot of different tries and got a final fine working solution.

The main reason for the speed should be the write multi blocks command and we write blocks of 512 bytes each 500µs. To write one of the blocks takes 180µs only but to you have to wait until the block is excepted before you start with the next one.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits