Jump to content
  • 0

How to use Audio on Zybo board


Mehdim

Question

Hello guys;

Can you refer me to a quick guide about how to use Audio signal on ZYbo board?

I just want to know if there is any simple tutorial about how to get data from audio jack and have in on Arm side.

Appreciate your comments in advance.

Link to comment
Share on other sites

Recommended Posts

Weird my project seems to be playing in both earphones when I record music from my computer into the line in port and play it out. A couple things to check though.

Is your input audio stereo?

If you are using the mic input that is only mono

 

Link to comment
Share on other sites

I just posted a DMA audio demo for the zybo and the volume seems to be right. The register assignments I used to initialize the codec are below.

fnAudioWriteToReg(R15_SOFTWARE_RESET, 0b000000000);
fnAudioWriteToReg(R6_POWER_MGMT, 0b000110000);
fnAudioWriteToReg(R0_LEFT_ADC_VOL, 0b000010111);
fnAudioWriteToReg(R1_RIGHT_ADC_VOL, 0b000010111);
fnAudioWriteToReg(R2_LEFT_DAC_VOL, 0b101111001);
fnAudioWriteToReg(R3_RIGHT_DAC_VOL, 0b101111001);
fnAudioWriteToReg(R4_ANALOG_PATH, 0b000000000);
fnAudioWriteToReg(R5_DIGITAL_PATH, 0b000000000);
fnAudioWriteToReg(R7_DIGITAL_IF, 0b000001010);
fnAudioWriteToReg(R8_SAMPLE_RATE, 0b000000000);
fnAudioWriteToReg(R9_ACTIVE, 0b000000001);
fnAudioWriteToReg(R6_POWER_MGMT, 0b000100000);

Demo can be found here https://github.com/Digilent/ZYBO/tree/master/Projects/dma

It uses microblaze but may still be useful designing for HDL

-Sam

Link to comment
Share on other sites

That is a good catch! Thinking about it, this just sets both of the volume registers to the same value twice. Since I want  them at the same value, the write to reg3 is not needed. This shouldn't cause any problems with the function of the design though. Ill probably go back and change it to assign them separately in case someone in the future wants different channel volumes.

Thanks!

-Sam

Link to comment
Share on other sites

Hi Sam,

I'm trying to create your dma project. I was able to create project and build it using tcl script. I do not know how to import the software side of it. Could you please explain in brief on what I should do in sdk to replicate your project? I see that you have given all necessary source files in github but I don't know how to use them appropriately. Thanks!

 

error.PNG

Link to comment
Share on other sites

Hey Axe, I think the following flow will get your program running using the bitstream you just created

1. export your hardware by selecting File->export->export hardware make sure include bitstream is checked and press ok

2. launch SDK by selecting file launch SDK and press ok

3. Select file->new->application project name the project then click next

4. select hello world from the list and let sdk generate a hello world project

5. delete your helloworld.c file

6. copy in the .c and .h files from the guthub sdk folder (you can drag and drop)

7. program the FPGA and run your project .elf file on system debugger

However if you are fine using the hardware platform shipped with the project (it should be the same) you can just import the sdk folder from the github as a workspace into SDK and follow the steps on this guide. https://reference.digilentinc.com/learn/programmable-logic/tutorials/zybo-dma-audio-demo/start

-Sam

Link to comment
Share on other sites

Hi Mehdim, 

I'm trying to get the ZYBO Audio codec up and running using only hardware i.e. only vhdl code. I'm feeding audio input through aux cable from my mobile phone. And I want to hear the same audio out from Headphones jack. So far I'm able to hear a very feeble sound. This has something to do with the volume control registers. Can you pls tell me which register am I entering wrong?

reg 6   - 000010010 
reg 15 - 000000000
reg 0   - 000111111
reg 1 -   000111111
reg 2 -   001111111
reg 3 -   000000000
reg 4 -   000010000
reg 5 -   000000000
reg 7 -   001001010
reg 8 -  000000000
reg 9 -  000000001
reg 6 -  000000010

Thanks. 

Link to comment
Share on other sites

I'm feeding music through my iPhone using an Auxillary cable. It is definitely stereo. I shall try feeding music through computer and check! and yes I am recording through LINE IN port only and not through MIC. I will also try it out on a different Zybo board just in case! I will get back to you by tomorrow.

 

Link to comment
Share on other sites

Hi Sam, 

It seems there is some issue with the headphones jack. If I insert the earphones fully inside the jack, contrary to what is expected, music is heard only on 1 channel. If I insert the earphones halfway through the jacks, then I can hear the playback on both left and right channels of the earphones. The behaviour is same in both the Zybo boards that I checked. Thanks for all your help.  

Link to comment
Share on other sites

Can you try to find some audio that you can tell left from right? I fear that you are just contacting both channels of your headphones to only one channel of the headphone jack.

I'm betting the problem is something in the codec writes or the I2S stream. Do you go through the same writes that I did above? I also wrote the 8th bit of regs 2 and 3 to 0 when I tested it.

Link to comment
Share on other sites

Hi Sam,

In the fnAudioPlay when I enable the streaming from memory to slave interface I hear a loud click in the earphones. 

Inside a while cycle I tried to acquire 4 samples from line-in and pass those 4 samples at that function. When this click comes out at every function call it produces annoying noise and overcomes the sound.

Do you know something about that? What do you suggest me to do if I want to pass a continuous streaming data (eg. a FIFO) to the I2S interface?

Thanks a lot!!

Link to comment
Share on other sites

I'm looking for more info about data-word length used /transmitted by SSM2603 codec in record or playback mode when I setup input from MIC in which mono mode is used acccording datasheet, then saved data is only a channel data or the same data for both channels?

In my case I want to use the codec to sample at 96kHz with MIC input, what kind of data I must obtain if I setup for 16 bits in R7?

Thanks in advance.

Link to comment
Share on other sites

16 hours ago, josan said:

I'm looking for more info about data-word length used /transmitted by SSM2603 codec in record or playback mode when I setup input from MIC in which mono mode is used acccording datasheet, then saved data is only a channel data or the same data for both channels?

In my case I want to use the codec to sample at 96kHz with MIC input, what kind of data I must obtain if I setup for 16 bits in R7?

Thanks in advance.

 

15 hours ago, D@n said:

Have you looked through the SSM2603 spec yet?  The front page of the spec suggests that the core should be able to generate 24'bit audio.

Dan

Of course Mr.Dan, but the digital I/F allows select different data-word lengths by register 0x07 D3D2 field WL[1:0] (pp.25). Also monaural input from michrophone is allowed, and the specs are not clear about sampling in this case for ADC routing and results.

Link to comment
Share on other sites

I have tried this IP core in Zybo, but it seems it doesn’t work. I can try to debug the IP, but if you guys have any hint or you can refer me to a working IP core for this module, it would very appreciated.

Thanks you.

Link to comment
Share on other sites

Thanks for the reply,

i think it is for the standalone OS. I have tried to run these code, but i encountered some errors

 when i was trying to lunch SDK from Vivaoi:

and when Debugging SDK:

 

do you guys have any similar experience with this code?

 

Capture.JPG

Capture2.JPG

Link to comment
Share on other sites

Hi Mehdim,

I would say that the Instructable posted above is your best bet for getting the audio to work. There are only two parts to getting it to work: First configuring the audio codec with I2C, and then receiving the audio data through I2S. I did this all in hardware in my Nexys Video Looper Demo, but this doesn't interface with an ARM processor. It might give you a basic idea of how the communication works though.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...