Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

SD Card Block Write through SPI mode with interrupt

Status
Not open for further replies.

amitjagtap

Full Member level 5
Full Member level 5
Joined
Jan 10, 2007
Messages
304
Helped
42
Reputation
84
Reaction score
36
Trophy points
1,308
Activity points
3,273
Hi all,
I want to connect SD card on SPI interface and want to write 521 bytes of block to SD card.
The Block Write process (writing to SD card) time is around 150ms-200ms max and controller will receive a 10ms interrupt every time, while writing a block. and control will go to ISR.
My question is how I can hold the block write operation at every 10ms. And once control is back from ISR will it continue write operation for remaining bytes in the block.
Kindly Help in this regard,
Amit
 

With reasonable SPI clock frequencies, writing a block will take less than a ms (e.g. about 0.5 ms at 8 MHz). Depending on the involved µP, you'll have difficulties to deliver the data as fast as it goes out of the SPI interface. What the h*** should be the purpose of an interrupt driven SPI write or read function?
 
You are right.
Earlier I referred one SD card document in which it was mentioned that SD card block write can take upto 200 ms. That why I thought of using interrupt for 10ms every time.
Now as per following calculation:
Say clock speed of 8MHz.
Total data= 512 x 3(overhead per byte)x 8 + = 12288 + command & responce bytes ~=12300 bits
So time required to write block through SPI is = 12300/8MHz= 1.537 mS....it is in ms..so not a problem.
I think its right......pls comment
Thanks FvM,
 

The factor 3 in your calculation isn't obvious to me, but it doesn't change the basic view, I think.

The main point is that the processor doesn't effectively have spare time when sending data to the SPI interface. Only a processor with DMA capabilities would give a different picture. So any interrupt solution needs the same amount of instructions cycles to move the data plus the interrupt processing overhead.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top