SPDIF recorder

Thread Starter

aavikolla

Joined Dec 6, 2010
9
Hi,

I'm interested in making a digital audio recorder. The idea would be to record incoming SPDIF signal onto an SD card. The signal would be 24-bit resolution with 96kHz sampling rate. I don't have much experience with microcontrollers except for playing around with an arduino, so I was hoping I could get some advice from more experienced people.

To work with I2S reliably, I expect the MCU has to have at least some level of hardware I2S support. On the other hand, writing to the SD card while receiving real-time data means that there has to be a substantial amount of memory available and a DMA controller would probably save me a lot of trouble.

Can you guys point me towards good MCU candidates for a job like this? It would be especially great if there was a development platform which integrates the SD card reader, MCU and a programming interface. I fully expect that I need to integrate the high resolution SPDIF codec though.

Thanks
 

retched

Joined Dec 5, 2009
5,207
I own the EasyPIC6.

Greatest things since pickled pigs feet.

If you dont mind the expense (I think its a savings) get it.

It will save you hours of wiring so you can get to code.
 

Thread Starter

aavikolla

Joined Dec 6, 2010
9
I have no doubts that it's a great board and I fully realize that a ready-made multipurpose dev board will be a lot cheaper than any custom production for a one-off need. The question is really about physical size. A spdif recorder doesn't need that many components. I was wondering if there is a dev board with less features and as such which has a smaller footprint. Something more more towards the size of an arduino.
 

Thread Starter

aavikolla

Joined Dec 6, 2010
9
I just found this "dev board".

http://www.mikroe.com/eng/products/view/586/mikrommb-for-dspic33-board/

Can you guys think of any reason why this wouldn't suit my needs? There's an mp3 decoder that's extra but i don't mind if it doesn't get in the way. The touchscreen is a nice bonus.

One thing which bothers me a bit is that mikroelektronika doesn't advertise whether their programmer works with Linux. I don't have access to a windows box and I'd anyway rather do development on Linux. Will a PIC be a PITA to develop for?
 

Thread Starter

aavikolla

Joined Dec 6, 2010
9
Audio data is surprisingly low data rate. 24/96 is only 750kb/s. Also, there are big write rate differences between cards (card classes to be exact). Or are you afraid that the PIC is unable to keep up the necessary throughput? .. even with dma?
 

thatoneguy

Joined Feb 19, 2009
6,359
Audio data is surprisingly low data rate. 24/96 is only 750kb/s. Also, there are big write rate differences between cards (card classes to be exact). Or are you afraid that the PIC is unable to keep up the necessary throughput? .. even with dma?
Doesn't seem right. 750 is about the bitrate of a single channel of CD audio (1.411 Mbit/s) Unless your kb is kB/s, as S/PDIF can carry 7.2 audio channels (7 full bandwidth, 2 LFE only). Or is the .2 actually .1 fed to both LFE, and the 7 a DSP mix of 5.1?
 

Thread Starter

aavikolla

Joined Dec 6, 2010
9
96kHz, two channels, four bytes per frame. That comes to 96000*2*4 = 750kB/s. Yes, I meant kilobytes. Also, I'm not interested in the surround formats.

But ADAT would be interesting and require more bandwidth. But I'm going to settle for SPIDIF for now.
 

Papabravo

Joined Feb 24, 2006
21,225
Isn't it
Rich (BB code):
96,000 samples/second * 2 channels * 32 bits/sample/channel 
= 6,144,000 bits/second 
= 768,000 Bytes/Second
If it takes 10 milliseconds to write, not transfer the data, each 512 Byte sector to the SD card, how large a buffer will you need for three minute track?

I calculate that writing that amount of data will take 45 minutes for a 3 minute track
Rich (BB code):
768,000 bytes/second * 60 seconds/minute * 3 minutes = 138.24 Megabytes
138.24 Megabytes / 512 bytes/sector = 270,000 sectors
270,00 sectors * 0.010 seconds/sector = 2700 seconds = 45 minutes
Good luck finding a buffer that large on your dsPIC.
 

Thread Starter

aavikolla

Joined Dec 6, 2010
9
Correct: 768000 bytes/second = 750kB/s (kB = 1024 bytes)

How did you come up with 10 milliseconds to write 512 bytes? If you check http://en.wikipedia.org/wiki/SD_card#Speed_Class_Rating it's clear that even Class 2 cards are supposed to be able to store at that data rate. Is the transfer limited that much by the dsPIC?

If you think the dsPIC can't handle it, do you have any other suggestions?
 

Papabravo

Joined Feb 24, 2006
21,225
Correct: 768000 bytes/second = 750kB/s (kB = 1024 bytes)

How did you come up with 10 milliseconds to write 512 bytes? If you check http://en.wikipedia.org/wiki/SD_card#Speed_Class_Rating it's clear that even Class 2 cards are supposed to be able to store at that data rate. Is the transfer limited that much by the dsPIC?

If you think the dsPIC can't handle it, do you have any other suggestions?
The dsPIC is limited by the amount of memory available to it. Under the conditions of a long write time for each sector you need a large buffer to hold the data while you are waiting for the sector writes to complete.

10 milliseconds is a typical write time for a flash block. I'll look at the link and get back to you.

Edit: I would cast a jaundiced eye at the following line from the link you provided:
"...class speed ratings are quoted by the manufacturers and not verified by any independent evaluation process."
Don't know about you but I wouldn't want to bet the farm on such a part until I had verified it. Good luck with that process.

BTW the correct nomenclature is 750 KiB -- see the following article
http://en.wikipedia.org/wiki/Kilobyte
 
Last edited:

Thread Starter

aavikolla

Joined Dec 6, 2010
9
I have the necessary software skills. This project was to get experience with MCUs. But yeah, I just happened to bump into the microtrack II also, so maybe i'll get one and think of another project to learn about MCUs.

As the microtrack shows, there is no bottleneck with SD cards. I have one SD card here which is capable of write speeds of multiple megabytes per second. I would however be interested in knowing if there are inherent throughput problems with (certain?) MCUs. The reason I originally was asking for native I2S support and DMA is to have as much hardware support for streaming the audio data from SPDIF to the SD card.
 

Papabravo

Joined Feb 24, 2006
21,225
I have the necessary software skills. This project was to get experience with MCUs. But yeah, I just happened to bump into the microtrack II also, so maybe i'll get one and think of another project to learn about MCUs.

As the microtrack shows, there is no bottleneck with SD cards. I have one SD card here which is capable of write speeds of multiple megabytes per second. I would however be interested in knowing if there are inherent throughput problems with (certain?) MCUs. The reason I originally was asking for native I2S support and DMA is to have as much hardware support for streaming the audio data from SPDIF to the SD card.
I myself am kind of curious as to how the flash speeds have been reduced so dramatically. The original reason for long FLASH write times relative to read times was the time it took to charge the capacitance of a floating gate. If that is no longer a limitation then I suspect the use of a different technology.
 
Top