XMEGA use DMA to write directly to SD card. help!

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, im trying to get the DMA to directly to write to a micro SD card.

I am using an atxmega128A1.
I am able to write using non-DMA method, but its too slow. either FATfs or raw way is fine.

Anyone have any success? Would anyone be willing to share their code with me?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Moving to Xmega forum.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you taken a look at all the great application notes for the XMega series? Specifically, look at "AVR1502: Xplain Training - Direct Memory Access Controller"

http://www.atmel.com/dyn/resources/prod_documents/doc8310.pdf

Also refer to "AVR1304: Using the XMEGA DMA Controller" and it's accompanying source code.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But note that the bottle-neck may simply be the speed that the 1 bit MMC interface can operate at. If you want high performance to SD consider the 4 bit interface (which actually goes > 10X faster). But note that you have to pay to licence the documentation that tells you how to do this.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@rjbishop, those code read/writes the data from internal memory to the xmega. this is not what i want.
I want to write data to an external memory(sd card), meaning outside of the xmega chip via DMA.

@clawson, i just want to find working code, b/c i do want to free up the main xmega cpu for other things.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Xmega DMA is "cycle stealing" and NOT 100% DMA unit. Writing 512 bytes to an SD card is blocking and the cpu is NOT freed up, but blocked itself while DMA is running. You won't gain much, I'll bet.

Do a search on THIS forum and you'll find at least 2 threads for DMA, with solutions.

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I looked into doing this but the SPI can only act as a dma trigger in slave mode not master mode. This means you can not do dma to the sd card in any simple way. Aparently the usart operating in spi master mode can be a dma triger but I never investigated this option.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I know that this thread is old, but i have to sent answer for people who will read this in future.

I think that there is problem with square wave signal. I you are using so high frequency you have to consider parasite capacitance and inductance of wires. If you use messy cables your squares look like triangles and that is the problem.