Sign in

username:

password:



Not a member?

Search c6x



Search tips

Subscribe to c6x



c6x by Keywords

AD535 | BIOS | Booting | Bootloader | C621 | C6211 | C6415 | C671 | C6711 | C6711DSK | C6713 | CCS | Chassaing | COFF | DAT | DM64 | DM642 | DMA | DSK671 | DSK6711 | EDM | EDMA | EMIF | Emulator | EVM | EVM620 | FFT | FIR | GPIO | Halting | HPI | HWI | IDK | JTAG | LDB | LDH | LDW | Linker | LMS | LOG_printf | Matlab | McBSP | MEM_alloc | MIPS | PCI | PCM3003 | Pipeline | Profiling | QDM | Reset | ROM | RTDX | Sampling | SDRAM | Stack | TEB | THS1206 | TMS320C621 | TMS320C6416 | TMS320C6711 | TMS320C6713 | UART | Vector Table | XBUS | XDS560

Sponsor

Industry's highest performing at the lowest power DSPs now as low as $5.00*
Start development today!
*volume pricing for 10ku

Discussion Groups

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | TMS320C6x | Sound quality with and without MCBSP

Technical discussions about the TI C6000 DSPs (including the c62x, c64x and c67x DSPs).

  

Post a new Thread

Sound quality with and without MCBSP - asim...@yahoo.de - Jan 18 15:17:13 2012

Hi everyone,

I am a newbie in DSP programming and started to get experience with a DSK6713. I
programmed a simple code that generates a sinus tone by 
1)using the MCBSP for sending data or 2)just using the AIC23 Codec functions. I
realized that in the first case the sound quality is worse than in the second
case. I wonder why cuz in the first case the MCBSP uses the SAME codec or am I
missunderstanding something. Anyway, here is the code:

#define CHIP_6713

#include <csl.h>
#include <csl_mcbsp.h>

#include "dsk6713_aic23.h"
#include "dsk6713_dip.h"
#include "dsk6713_led.h"
#include "dsk6713.h"

#define LOOPLENGTH 8

DSK6713_AIC23_Config aic23config = DSK6713_AIC23_DEFAULTCONFIG;
MCBSP_Config mcbspConfig = { 0x00010000, // SPCR is set for transmitting
			     0x00000000,
			     0x000000A0, // 1-phase 32bit word for XCR
			     0x00000000,
			     0x00000000,
			     0x00000000,
			     0x00000000,
			     0x00000000,
};

short loopIdx, gain = 5;
int sineTable[ LOOPLENGTH ] = { 0, 707, 1000, 707, 0, -707, -1000, -707 };

void main(void) {
	
	DSK6713_init();
	DSK6713_LED_init();
	DSK6713_DIP_init();

	DSK6713_AIC23_CodecHandle hCodec;
	hCodec = DSK6713_AIC23_openCodec( 0, &aic23config );
	DSK6713_AIC23_setFreq( hCodec, DSK6713_AIC23_FREQ_8KHZ );
	extern far MCBSP_Handle DSK6713_AIC23_DATAHANDLE;
	MCBSP_config( DSK6713_AIC23_DATAHANDLE, &mcbspConfig );
	MCBSP_start( DSK6713_AIC23_DATAHANDLE, MCBSP_XMIT_START |  
                     MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC , 220 );

	while( 1 ) {

	   if ( DSK6713_DIP_get( 0 ) == 0 ) {

	     DSK6713_LED_on( 0 );

	     while( MCBSP_xrdy( DSK6713_AIC23_DATAHANDLE ) )

//	     while( !DSK6713_AIC23_write( hCodec, sineTable[ loopIdx ] ) );
	     MCBSP_write( DSK6713_AIC23_DATAHANDLE, sineTable[ loopIdx ] );

		if ( ++loopIdx == LOOPLENGTH) loopIdx = 0;

	   } else

	     DSK6713_LED_off( 0 );

	}

}

_____________________________________





(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Sound quality with and without MCBSP - Jeff Brower - Jan 23 19:47:23 2012

Asim-

It looks to me like the way you've written your C code, it will not write to Tx
if
it's not ready (good), skip the current value completely in that case and go to
the
next value (not good), and possibly write some values more than once if it takes
Tx a
bit of time to become not ready after a write (also not good).

Suggest to try this:

  while (!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE)); /* wait for Tx to be read */
  MCBSP_write(DSK6713_AIC23_DATAHANDLE, sineTable[loopIdx]);  /* write 1 sample
*/

Also, assuming the codec setting is for 16-bit words, and since you have
declared
sineTable as int, suggest to check to make sure that passing an int to
McBSP_write()
is Ok.  

-Jeff

a...@yahoo.de wrote:
> 
> Hi everyone,
> 
> I am a newbie in DSP programming and started to get experience with a
DSK6713. I programmed a simple code that generates a sinus tone by
> 1)using the MCBSP for sending data or 2)just using the AIC23 Codec
functions. I realized that in the first case the sound quality is worse than in
the second case. I wonder why cuz in the first case the MCBSP uses the SAME
codec or am I missunderstanding something. Anyway, here is the code:
> 
> #define CHIP_6713
> 
> #include <csl.h>
> #include <csl_mcbsp.h> #include "dsk6713_aic23.h"
> #include "dsk6713_dip.h"
> #include "dsk6713_led.h"
> #include "dsk6713.h"
> 
> #define LOOPLENGTH 8
> 
> DSK6713_AIC23_Config aic23config = DSK6713_AIC23_DEFAULTCONFIG;
> MCBSP_Config mcbspConfig = { 0x00010000, // SPCR is set for transmitting
>                              0x00000000,
>                              0x000000A0, // 1-phase 32bit word for XCR
>                              0x00000000,
>                              0x00000000,
>                              0x00000000,
>                              0x00000000,
>                              0x00000000,
> };
> 
> short loopIdx, gain = 5;
> int sineTable[ LOOPLENGTH ] = { 0, 707, 1000, 707, 0, -707, -1000, -707 };
> 
> void main(void) {
> 
>         DSK6713_init();
>         DSK6713_LED_init();
>         DSK6713_DIP_init();
> 
>         DSK6713_AIC23_CodecHandle hCodec;
>         hCodec = DSK6713_AIC23_openCodec( 0, &aic23config );
>         DSK6713_AIC23_setFreq( hCodec, DSK6713_AIC23_FREQ_8KHZ );
> 
>         extern far MCBSP_Handle DSK6713_AIC23_DATAHANDLE;
>         MCBSP_config( DSK6713_AIC23_DATAHANDLE, &mcbspConfig );
>         MCBSP_start( DSK6713_AIC23_DATAHANDLE, MCBSP_XMIT_START |
>                      MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC , 220 );
> 
>         while( 1 ) {
> 
>            if ( DSK6713_DIP_get( 0 ) == 0 ) {
> 
>              DSK6713_LED_on( 0 );
> 
>              while( MCBSP_xrdy( DSK6713_AIC23_DATAHANDLE ) )
> 
> //           while( !DSK6713_AIC23_write( hCodec, sineTable[ loopIdx ] )
);
>              MCBSP_write( DSK6713_AIC23_DATAHANDLE, sineTable[ loopIdx ]
);
> 
>                 if ( ++loopIdx == LOOPLENGTH) loopIdx = 0;
> 
>            } else
> 
>              DSK6713_LED_off( 0 );
> 
>         }
> 
> }

_____________________________________





(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Sound quality with and without MCBSP - asim...@yahoo.de - Jan 25 7:36:21 2012

Hi Jeff,

thank you for your answer. I clearly understand what you mean. I might have read
the function description for MCBSP_xready wrong:) cuz I wanted the MCBSP to do:
write data when you are ready but exactly the opposite was done.

Burak

Hi everyone,
>
>I am a newbie in DSP programming and started to get experience with a
DSK6713. I programmed a simple code that generates a sinus tone by 
>1)using the MCBSP for sending data or 2)just using the AIC23 Codec
functions. I realized that in the first case the sound quality is worse than in
the second case. I wonder why cuz in the first case the MCBSP uses the SAME
codec or am I missunderstanding something. Anyway, here is the code:
>
>#define CHIP_6713
>
>#include   
>#include   
>
>#include "dsk6713_aic23.h"
>#include "dsk6713_dip.h"
>#include "dsk6713_led.h"
>#include "dsk6713.h"
>
>#define LOOPLENGTH 8
>
>DSK6713_AIC23_Config aic23config = DSK6713_AIC23_DEFAULTCONFIG;
>MCBSP_Config mcbspConfig = { 0x00010000, // SPCR is set for transmitting
>			     0x00000000,
>			     0x000000A0, // 1-phase 32bit word for XCR
>			     0x00000000,
>			     0x00000000,
>			     0x00000000,
>			     0x00000000,
>			     0x00000000,
>};
>
>short loopIdx, gain = 5;
>int sineTable[ LOOPLENGTH ] = { 0, 707, 1000, 707, 0, -707, -1000, -707 };
>
>void main(void) {
>	
>	DSK6713_init();
>	DSK6713_LED_init();
>	DSK6713_DIP_init();
>
>	DSK6713_AIC23_CodecHandle hCodec;
>	hCodec = DSK6713_AIC23_openCodec( 0, &aic23config );
>	DSK6713_AIC23_setFreq( hCodec, DSK6713_AIC23_FREQ_8KHZ );
>	extern far MCBSP_Handle DSK6713_AIC23_DATAHANDLE;
>	MCBSP_config( DSK6713_AIC23_DATAHANDLE, &mcbspConfig );
>	MCBSP_start( DSK6713_AIC23_DATAHANDLE, MCBSP_XMIT_START |  
>                     MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC , 220 );
>
>	while( 1 ) {
>
>	   if ( DSK6713_DIP_get( 0 ) == 0 ) {
>
>	     DSK6713_LED_on( 0 );
>
>	     while( MCBSP_xrdy( DSK6713_AIC23_DATAHANDLE ) )
>
>//	     while( !DSK6713_AIC23_write( hCodec, sineTable[ loopIdx ] ) );
>	     MCBSP_write( DSK6713_AIC23_DATAHANDLE, sineTable[ loopIdx ] );
>
>		if ( ++loopIdx == LOOPLENGTH) loopIdx = 0;
>
>	   } else
>
>	     DSK6713_LED_off( 0 );
>
>	}
>
>}
>
>_____________________________________

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: Sound quality with and without MCBSP - Jeff Brower - Jan 25 18:44:49 2012

Asim-

> thank you for your answer. I clearly understand what
> you mean. I might have read the function description for
> MCBSP_xready wrong:) cuz I wanted the MCBSP to do: write
> data when you are ready but exactly the opposite was done.

Ok sounds good.  One comment...  please answer each post in sequence; don't go
back and forward the original post.  It
makes it easier for people to follow, especially when searching through the
forum some time from now.

-Jeff

> Hi everyone,
>>
>>I am a newbie in DSP programming and started to get experience with a
DSK6713. I programmed a simple code that
>> generates a sinus tone by
>>1)using the MCBSP for sending data or 2)just using the AIC23 Codec
functions. I realized that in the first case the
>> sound quality is worse than in the second case. I wonder why cuz in the
first case the MCBSP uses the SAME codec or
>> am I missunderstanding something. Anyway, here is the code:
>>
>>#define CHIP_6713
>>
>>#include
>>#include
>>
>>#include "dsk6713_aic23.h"
>>#include "dsk6713_dip.h"
>>#include "dsk6713_led.h"
>>#include "dsk6713.h"
>>
>>#define LOOPLENGTH 8
>>
>>DSK6713_AIC23_Config aic23config = DSK6713_AIC23_DEFAULTCONFIG;
>>MCBSP_Config mcbspConfig = { 0x00010000, // SPCR is set for
transmitting
>>			     0x00000000,
>>			     0x000000A0, // 1-phase 32bit word for XCR
>>			     0x00000000,
>>			     0x00000000,
>>			     0x00000000,
>>			     0x00000000,
>>			     0x00000000,
>>};
>>
>>short loopIdx, gain = 5;
>>int sineTable[ LOOPLENGTH ] = { 0, 707, 1000, 707, 0, -707, -1000, -707
};
>>
>>void main(void) {
>>
>>	DSK6713_init();
>>	DSK6713_LED_init();
>>	DSK6713_DIP_init();
>>
>>	DSK6713_AIC23_CodecHandle hCodec;
>>	hCodec = DSK6713_AIC23_openCodec( 0, &aic23config );
>>	DSK6713_AIC23_setFreq( hCodec, DSK6713_AIC23_FREQ_8KHZ );
>>	extern far MCBSP_Handle DSK6713_AIC23_DATAHANDLE;
>>	MCBSP_config( DSK6713_AIC23_DATAHANDLE, &mcbspConfig );
>>	MCBSP_start( DSK6713_AIC23_DATAHANDLE, MCBSP_XMIT_START |
>>                     MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC , 220 );
>>
>>	while( 1 ) {
>>
>>	   if ( DSK6713_DIP_get( 0 ) == 0 ) {
>>
>>	     DSK6713_LED_on( 0 );
>>
>>	     while( MCBSP_xrdy( DSK6713_AIC23_DATAHANDLE ) )
>>
>>//	     while( !DSK6713_AIC23_write( hCodec, sineTable[ loopIdx ] ) );
>>	     MCBSP_write( DSK6713_AIC23_DATAHANDLE, sineTable[ loopIdx ] );
>>
>>		if ( ++loopIdx == LOOPLENGTH) loopIdx = 0;
>>
>>	   } else
>>
>>	     DSK6713_LED_off( 0 );
>>
>>	}
>>
>>}

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )