Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
871 Views

Read audio from flash- wm8731 codec

Hello,  

I am trying to make a system that stores some audio samples (~11secs) to the flash of the DE1 Board and then playback them. 

Right now, i only would like to play correctly the audio sample I previously stored in my board.  

I know that there are lots of similar design around, also de1_sound etc provide useful code. 

The matter is, every examle makes use of the CODEC in slave mode, so with a couple of counters and ONE pll they provide the right clocks to the system. 

I want to use CODEC in master mode.  

Codec is configured via NIOS and opencores I2C, while the read/write operation from/to flash should be only "hardware".  

Using the sources for the flash controller in university program, i made a system where I can erase data from flash and write sequential data to the flash - and with the DE1 control panel I downloaded flash content, opened with an hex editor and I can confirm there were the right data I wrote.  

Now, the problem is: 

the data out form the flash is being stored into a dual clock fifo, both flash and write clock to fifo are clocked @50MHZ, while the read signal is locked to the aud_BCLK.  

A fsm should check if fifo is full in order to control the write operation from flash to fifo and refill the fifo when a bit in rduswd bus bit goes high.  

 

Now, sometimes I can get the right sound - only left channel, I am working on a single channel right now - sometimes only "white noise", sometimes there isn't any kind of reading from the flash. 

I don't know if and where is my error.  

Any hint would be appreciated.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor I
12 Views

Ok, since i was running out of time, I changed approach and used an only-hardware based solution. 

It is based on starterkit provided by Altera, so I don't need to provide in-out fifos or to detect conditions or configure the CODEC. 

Furthermore, I am still using the altera university program flash controller to access the flash.  

Now, I am able to store 2^21 bits of data in the first half of the flash memory and 2^21 bits of (different) data in the upper half of the flash. 

And I am able to correctly play them to the speakers.  

Now introducing the nios processor should take less than a quarter of hour, but I am a little bit sad that I had to use someone else audio decoder. 

Well, I suppose that in complex systems is natural - and way much faster, and obvious - use third part software/hardware. But for a simple project, I would be pleased to do it on my own. 

Anyway, since it is a (minor) project for an univeristy course, I won't publish it here until the exam will take place.  

But if someone is interested, feel free to contact me.  

Best regards,  

P.
Altera_Forum
Honored Contributor I
12 Views

Hello 

 

Can you give the source code for the same as a zip file
Reply