Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: How to configure DMA for 24 bits trasnfert
PostPosted: Sat Nov 13, 2010 1:39 pm 
Offline

Joined: Sat Nov 13, 2010 1:05 pm
Posts: 3
I am evaluatinf the SAM3U as high quality audio streamer/player.

I did several tests based on basic-ssc-i2s-wm8731-project-at91sam3u-ek to measure the ability of the SAM3U to manage parallel high bandwidth data flows by playing wave files from a SD card without using external memory for buffering.

Regarding the DMA controller documentation, only 8,16 & 32 bits transfert are possible.

I wonder if there is a mean to configure the DMA for 24 bits transfert to feed the SSC controller or if i am obliged to reformat my input buffer to pad the sample in 32bit format.

If someone could help me


Top
 Profile  
 
 Post subject: Re: How to configure DMA for 24 bits trasnfert
PostPosted: Sat Nov 13, 2010 6:35 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 784
8-bits, in multiples of three, unless their are endian or channel issues.


Top
 Profile  
 
 Post subject: Re: How to configure DMA for 24 bits trasnfert
PostPosted: Mon Nov 15, 2010 1:50 pm 
Offline

Joined: Sat Nov 13, 2010 1:05 pm
Posts: 3
Unfortunately, DMA possible configurations are 1 or 4 elements that can be either 8bits, 16 bits or 32bits (referring DMAC Channel x [x = 0..3] Control A Register page 1048 of this document :http://www.atmel.com/dyn/resources/prod_documents/doc6430.pdf )


Top
 Profile  
 
 Post subject: Re: How to configure DMA for 24 bits trasnfert
PostPosted: Mon Nov 15, 2010 6:57 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 784
I2S is a serial format multiplexing left and right channels on a word basis, not a bit basis. Two pairs of 24-bits, in your example. A multiple of 3 or 6 bytes will not fit into any generally usable binary multiple, including sector (512 byte) or cluster boundaries in files/media.

In terms of DMA, I'll assume you don't have split sources for left/right channels, I'll further assume that the DMA/memory bandwidth is several orders of magnitude faster than the audio play rate. Provided your data matches the bit flow and endian-ness of the codec then sending data a byte at a time (in perhaps groups/multiples of 24 bytes (240, 480, 2400, 6144, 48000, 49152, ...), divisible by 3, 6 and 4) is the most workable and keep the channels in sync. Doing 16 or 32-bit DMA will always be more problematic due to endian issues, and channel separation. At some level you'll likely need to deal with transcoding the data from your source format, to the output format. If not for the format itself, then for the fact that the data doesn't fit cleanly into binary bins. For example taking groups of 24-bytes of input and creating 32-bytes of output with 32-bit alignment, or taking 24-bytes and simply modify it into 24-bytes ordered suitable for the shifter/DMA. If it is just a matter of bit/byte ordering to use 16/32-bit DMA transactions you could always store the data in that format by transcoding the file once and storing the result.

You could also handle playing direct from the file system, by playing the bulk of the data within a cluster, and handling a small inter-cluster splicing area on the fly, before proceeding with the rest of the next cluster. Personally, I just use a worker thread to pull in and transcode the data, and have the DMA interrupts ping/pong between two output buffer areas.


Top
 Profile  
 
 Post subject: Re: How to configure DMA for 24 bits trasnfert
PostPosted: Tue Nov 16, 2010 1:53 pm 
Offline

Joined: Sat Nov 13, 2010 1:05 pm
Posts: 3
Thanks for your help.

I will modify my code following your recommendations.

I will post my progress regarding this point.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: