DSPRelated.com
Forums

need help in using McBSP0 (the TEL codec)

Started by radato1 June 24, 2002
hi,

as part of my university project i have to collect samples from a telephone,
make some
signal processing and resending the samples to the telephone.

i have succeeded in doing the same thing using the microphone and the
loudspeakers, using
McBSP1, using a simple program based on the 'codec' example. I have tried to do
the same
using the TEL codec, but no interrupts have been generated from the telephone
(even though i
suplied the phone a DC of 5V and i was able to create DTMF signals, or hear my
self in it)

Does anyone know how should i initiate the telephone's codec ?
How can i generate the "off hook" needed for the telephone ?
Is it possible to collect samples from the microphone and send them to the
telephone
(synchronizing 2 different codecs) ? thanks a lot,

Rafi DaTo

THE CODE
********

hDAA_0 = codec_open(DAA_CODEC); /* Acquire handle to codec */

/*Set codec parameters */
codec_dac_mode(hDAA_0, CODEC_DAC_15BIT); /* DAC in 15-bit mode */
codec_adc_mode(hDAA_0, CODEC_ADC_15BIT); /* ADC in 15-bit mode */
codec_ain_gain(hDAA_0, CODEC_AIN_0dB); /* 6dB gain on analog
input to ADC */
codec_aout_gain(hDAA_0, CODEC_AOUT_MINUS_6dB); /* -6dB gain on analog
output from DAC
codec_sample_rate(hDAA_0,SR_8000); /* 16KHz sampling rate */ /* Initialize the interrupts registers */
asm(" ssbx intm");
asm(" NOP");
asm(" NOP");
asm(" NOP");
IMR=0x0030; /*0x0c30 = 0000110000110000b which enables the interrupts in
IMR
of BXINT0,BRINT0,BXINT1,BRINT1 */
asm(" NOP");
asm(" NOP");
asm(" NOP");
IFR=0x0000;
PMST=0x00a0;
//ST1 = 0x2b00; /*0x2b00 = 0010101101000000 in order to set FRCT to 1*/
asm(" NOP");
asm(" NOP");
asm(" NOP");
asm(" NOP");
asm(" NOP");
asm(" NOP");
asm(" rsbx intm");
asm(" NOP");
asm(" NOP");
asm(" NOP");
asm(" NOP");
asm(" NOP");

/******************************************************************/
/* INTERRUPT --> get input samples from TEL */
/******************************************************************/

interrupt void INDATA_X (){

p_interrupt_buffer_x[interrupt_counter_x] = (*(volatile
u16*)DRR1_ADDR(DAA_CODEC));
interrupt_counter_x++;
work_buffer_READY_x=0;
if (interrupt_counter_x==BLOCK_SIZE){

temp_pointer=p_interrupt_buffer_x;
p_interrupt_buffer_x=p_work_buffer_x;
p_work_buffer_x=temp_pointer;
work_counter_x=0;
work_buffer_READY_x=1; //to enable the start of FDAF on work_buffer_x
interrupt_counter_x=0;
}

}



--- In c54x@y..., "radato1" <radato1@y...> wrote:
> hi,
>
> as part of my university project i have to collect samples from a
telephone, make some
> signal processing and resending the samples to the telephone.
>
> i have succeeded in doing the same thing using the microphone and
the loudspeakers, using
> McBSP1, using a simple program based on the 'codec' example. I have
tried to do the same
> using the TEL codec, but no interrupts have been generated from the
telephone (even though i
> suplied the phone a DC of 5V and i was able to create DTMF signals,
or hear my self in it)
>
> Does anyone know how should i initiate the telephone's codec ?
> How can i generate the "off hook" needed for the telephone ?
> Is it possible to collect samples from the microphone and send them
to the telephone
> (synchronizing 2 different codecs) ? > thanks a lot,
>
> Rafi DaTo
>
> THE CODE
> ********
>
> hDAA_0 = codec_open(DAA_CODEC); /* Acquire handle
to codec */
>
> /*Set codec parameters */
> codec_dac_mode(hDAA_0, CODEC_DAC_15BIT); /* DAC in 15-
bit mode */
> codec_adc_mode(hDAA_0, CODEC_ADC_15BIT); /* ADC in 15-
bit mode */
> codec_ain_gain(hDAA_0, CODEC_AIN_0dB); /* 6dB gain
on analog input to ADC */
> codec_aout_gain(hDAA_0, CODEC_AOUT_MINUS_6dB); /* -6dB gain
on analog output from DAC
> codec_sample_rate(hDAA_0,SR_8000); /* 16KHz
sampling rate */
>
>
> /* Initialize the interrupts registers */
> asm(" ssbx intm");
> asm(" NOP");
> asm(" NOP");
> asm(" NOP");
> IMR=0x0030; /*0x0c30 = 0000110000110000b which enables the
interrupts in IMR
> of BXINT0,BRINT0,BXINT1,BRINT1 */
> asm(" NOP");
> asm(" NOP");
> asm(" NOP");
> IFR=0x0000;
> PMST=0x00a0;
> //ST1 = 0x2b00; /*0x2b00 = 0010101101000000 in order
to set FRCT to 1*/
> asm(" NOP");
> asm(" NOP");
> asm(" NOP");
> asm(" NOP");
> asm(" NOP");
> asm(" NOP");
> asm(" rsbx intm");
> asm(" NOP");
> asm(" NOP");
> asm(" NOP");
> asm(" NOP");
> asm(" NOP");
>
> /******************************************************************/
> /* INTERRUPT --> get input samples from TEL */
> /******************************************************************/
>
> interrupt void INDATA_X (){
>
> p_interrupt_buffer_x[interrupt_counter_x] = (*(volatile u16*)
DRR1_ADDR(DAA_CODEC));
> interrupt_counter_x++;
> work_buffer_READY_x=0;
> if (interrupt_counter_x==BLOCK_SIZE){
>
> temp_pointer=p_interrupt_buffer_x;
> p_interrupt_buffer_x=p_work_buffer_x;
> p_work_buffer_x=temp_pointer;
> work_counter_x=0;
> work_buffer_READY_x=1; //to enable the start of FDAF on
work_buffer_x
> interrupt_counter_x=0;
> }
>
> }
Hi,

Try using the daa_init() function in the DSK library. This should
setup the proper CPLD register to enable the McBsp0 pointing to the
DAA codec. Search for the daa.h file in the include folder of DSK.

You can also do Onhook and Offhook with the supplied API, or you can
directly set the DSP CPLD register (through IO address 0x04). Do a
search from online help in CCS for "DSP Accessible Control" should
give you details for the DSP CPLD register description.

Hope this help

Ben