This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Audio recording and analyzing with TMS320VC5505

Other Parts Discussed in Thread: TMS320VC5505

I just got my TMS320VC5505 eZsdp USB stick and afer a lot of searching i can't find a way to start audio recording with it.

My project requires me to record spoken word and translate them into MFCC coefficients but right now i can't seem to get the first thing going.

i have the whole code working in MATLAB but now i have to translate it so i can run my task on this MCU board.

 

Can someone please tell me how can i start recording and maybe tell me where i can find an example for something similar?   I saw on the specifications page that there should be an example for audio recording for this series but i can't find it anywhere.

 

thank you in advance.

  • Hi, Dubravko,

    Sorry, we don't support C5505 in this forum.

    I am going to move your thread to the C5505 forum, and hopefully someone there can help you.

    -d2

  • It's quite important to know if version of your usb stick allow to read signal from microphone. Some older versions couldn't do that (without hardware modifications). If you CAN use mic, then solution is quit simple: configure I2C to communicate with codec, configure I2S to read and send data to codec, read 2 samples (right and left channel) in I2S receive interrupt and put them in buffer, when buffer is full apply your algorithm. If this is not enough sufficient, use ping-pong buffer. If you can;t use mic, do the same with line-in. 

    One thing: if you are asking for help, tell us some more details. Now I can only guess what exactly your problem is - you don't know how to read  audio stream, configure codec, implement algorithm, your results are wrong or you know nothing about dsp.

    regards

    MS

  • I have the same problem. I use the TMS320VC5505 eZdsp USB stick. And the problem is that i pretty much don't know anything about DPS. I've never programmed a MCU. It would be great if someone could show me how to record sound from the microphone/line in into a matrix. I would then process the data in the matrix. Then if someone could show me how to transfer the data to the PC via USB.

    And there is another thing, I noticed that the test program BLINKING LED that comes with CCS 4, only works while CCS is running. The second i close CCS, the LED stops bilnking. Can the DSP work even without CCS running in the background?

  • Hi Mymoon, don't worry, everyone must get through beginnings. I will try to give you some tips, but still - you must learn much by your own (there is no way to skip that step). I'll start from the end:

    Led should blink, especially without CSS. Primary function of usb is providing voltage supply to ezdsp. Secondary function is jtag interface but that happens only when you are debugging in CCS. 

    You wont use USB with ezdsp. usb connector is only for power/debugging, for communication you would have to use usb slave controller which is one of C5505 peripherals. The problem is that in case of ezdsp 5505, pins related with that controller are not available via expansion connector.

    On CD provided with ezdsp you should find BSL package and there "aic3204" project. It's good example to see how you should use audio codec. Generally using codec is quite handy, because it allows you to not care about ADC, filters etc., you just read data byte by byte. In file aic3204_loop_linein.c you will find section titled as "Play Tone". There is nested loop which read audio sample and send it back to codec. this is loop-back. Alle 3 loops gives you 48000x5 iterations what is equal to 5 seconds of loop-back, because sampling frequency is 48k. That mean codec sends 48000 samples (1 sample = 2 channels: right and left) per 1 second. I guess by "process data in the matrix" you thought rather about array. After reading R and L sample to data3 and data4 you can copy these values to some array, and do with them whatever you want.

    I'm sure my post wont be enough to start real dsp coding, but you can learn much from examples and that's what you should do first.

     

    regards

    MS

  • Thank you very much for your fast response Michal Szymanski, you have been very helpful, but i dont understand one thing. You said that all 3 loops give me 48000x5 iterations what is equal to 5 seconds of loop-back, but i looked at the code

    /* Play Tone */
        for ( i = 0 ; i < 400 ; i++ )
        {
            for ( j = 0 ; j < 1000 ; j++ )
            {
                for ( sample = 0 ; sample < 48 ; sample++ )
                {
                    /* Read Digital audio input */
                    data3 = I2S0_W0_MSW_R;
                      data1 = I2S0_W0_LSW_R;
                      while((RcvR & I2S0_IR) == RcvR)
                      data4 = I2S0_W1_MSW_R;
                      data2 = I2S0_W1_LSW_R;
                   
                    /* Write Digital audio input */
                    I2S0_W0_MSW_W = data3;
                      I2S0_W0_LSW_W = 0;
                      //while((XmitR & I2S0_IR) == XmitR)
                      I2S0_W1_MSW_W = data4;
                      I2S0_W1_LSW_W = 0;
                   
                }
            }
        }

    and shouldn't this give me 48000x400 interations? And when i run the DSP, the loop-back last for about 10 seconds, why?

    When the loop gets to, for example; data3 = I2S0_W0_MSW_R; does the codec wait 1/48000 seconds to give data3 its value or can data3 get the same value from codec if there are more iterations in 1/48000 seconds?

    I Understand that W0 and W1 in the functions I2S0_W0_MSW_R and I2S0_W1_MSW_R; stand for the left and right speaker, and R and W for READ and WRITE, but what do the MSW and LSW stand for?

    And there is still the problem that CCS has to run in the background. Every test program i tried stopped working when i closed CCS. Why? Only if I connect the DSP to USB after it has been disconnected, it makes two different sounds (one higher and one lower)
     but it stops after I "Connect Target" in CCS.

    I know it are a lot of questions but I really don't know where else to look.

  • Yeah, you are right - in your case there are 48000x400 iterations. We have different versions of code. You say that loopback lasts for 10 sec what is strange, because for me it looks like it should be 400 sec long, but I will leave for now. Download latest version of examples from http://support.spectrumdigital.com/boards/usbstk5505/revb/. Code should looks like:

     for ( sample = 0 ; sample < 48 ; sample++ )
                {
                    /* Read Digital audio input */
                      while((RcvR & I2S0_IR) == 0);  // Wait for receive interrupt to be pending
                    data3 = I2S0_W0_MSW_R;  // 16 bit left channel received audio data
                      data4 = I2S0_W1_MSW_R;  // 16 bit right channel received audio data

                    /* Write Digital audio input */
                    while((XmitR & I2S0_IR) == 0); // Wait for transmit interrupt to be pending
                    I2S0_W0_MSW_W = data3;  // 16 bit left channel transmit audio data
                      I2S0_W1_MSW_W = data4;  // 16 bit right channel transmit audio data

                }

    Line  while((RcvR & I2S0_IR) == 0); lets program g through when new data is received and that happens only once per 1/48000 s  - thats answer for your question why we are sue that each sample is read only once. By analogy  while((XmitR & I2S0_IR) == 0); waits until data sending is complete, and that information that you can send next sample to codec. This method of  synchronization is called "polling". I2S0_W0 and I2S0_W1 are registers, you just have to study what register mean in digital circuits. I2S0 registers ended with "R" are to read data from them, and "W" is to wright. MSW mean most significant word. Coded can produce 32bit long samples, but registers are 16 bit long, so half of bits are stored in MSW registers and second half in LSW registers. If you are interested only in 16bit words, you should consider only most significant word and that happens in code - you don't read LSWs and don't write them, so their values are 0 by default. Registers with "W0" are for left channel, and "W1" for right (or otherwise, check codec datasheet).

    Is interesting why you need to start CCS to power ezdsp, maybe that is OS dependent. What is your OS? When you connect to target, DSP is being halted and that why you can't hear sound anymore (until you start program).

    regards

    MS         

     

  • hi there,

    i need your help , i have a TSM320VC5505 eZdsp USB stick and i run the example aic3204, i gave some sounds the input so data1 and data2 equals zero and data2,data3 equlas around -108, i didnt give a sound input and result is the same why? 

    what are these datas ? i mean data1 ,data2,data3, data4,  what does program find with them, i have to find frequency of a sound and i dont know what is these datas,

    can you explain please?