Reply by Jeff Brower November 21, 20082008-11-21
Zemene-

> I have followed one of the discussions on our group who had the same
> problem and I got the solution from it.
>
> i.e. I changed the Build option under Compiler->Advanced->Memory
> modules to Far(--mem_model:data).
>
> I don't know how but one of the warrnigs ("Detected a near (.bss
> section relative) data reference to the
> ") disappered and I was able to measure a 1KHz sine wave from the
> codec output.
>
> So thank you all for your help.

Ok, sounds good. Glad to hear you got the example working.

-Jeff

> --- In c..., Jeff Brower wrote:
> >
> > To Mixalis and other students-
> >
> > Like other working engineers, I'm allowed to help students only via
> the group. So,
> > first instruction: post to the group. If you should be cc'd
> directly by group
> > members who are replying to your post, that's simply a precaution
> to make sure you
> > receive the answer quickly, in case the group copy of the reply is
> moderated. It's
> > not an invite to write directly to working engineers asking for
> help.
> >
> > In this day and age, part of your learning experience is in how to
> use effectively
> > use peer groups and how to follow instructions. Mixalis, I have to
> tell you that
> > you're not off to a good start, seeing as how some other answers
> have gone by
> > recently asking students to post to the group. Please go back and
> read those
> > carefully
> >
> > Then repeat your post, and I have a feeling you will get some
> helpful comments :-)
> >
> > -Jeff
> >
> > mixalis xydeas wrote:
> >
> > > hello , I'm new too in the dsp programming...
> > > I need an example that will make my dsp run...
> > > I have read the same book with Zemene and some other books with
> matlab .... and
> > > I've the same warnings but not a simple error when I run some of
> the examples...
> > > Is it possible to programm only with jtag? or I can with just
> the usb interface ?
> > > What do I have to change in the first case?
> > > (I could not find a jtag 2 usb converter in market)
> > >
> > > I've also used a very simple example with matlab/ simulink but
> still no result .
> > > the example is in this page
> > >
> > > http://www.kxcad.net/cae_MATLAB/toolbox/tic6000/c6416dskled.html
> > >
> > > I use CCS 3.3, matlab R2008a, .NET and I have DSK C6416
> > > But still can't run something to make clear that my dsp's working
> and have a proper
> > > configuration for my system
> > >
> > > thnks for any help or comment,
> > >
> > > 2008/11/19 Jeff Brower
> > >
> > > Zemene-
> > >
> > > Andrew and Mike's suggestions are very good, suggest to
> follow. Also, see
> > > comment
> > > below about using printf() inside ISRs.
> > >
> > >
> > > > I am a student who is getting to know the C6713 DSK. I
> have started
> > > reading the Dr. Rulph Chassaing book "Digital Signal
> Processing and
> > > Application with C6713 and C6416". But I get stucked on the
> first example
> > > of the book that I didn't get the right thing I expect from
> the codec
> > > output. I bypassed Example 1.1 of the book and I tried to
> run Example 1.2
> > > I also face the same problem.
> > > > Here are the sample of the codes of exapmple 1.2 of the
> book which I
> > > copied from the CD that is enclosed with the book:
> > > >
> > > > Sourse Files: Sine8_buff.c
> > > > Vector_intr.asm
> > > > c6713dskinit.c
> > > >
> > > >
> >
> > ///////////////////////////////////////////////////////////////
> ///////////
> > >
> > > > /* sine8_buf.c Sine generation. Output buffer plotted
> within CCS */
> > > >
> >
> > ///////////////////////////////////////////////////////////////
> //////////
> > >
> > > >
> > > > #include "dsk6713_aic23.h" //support file for codec,DSK
> > > > Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
> > > > int loop = 0; //table index
> > > > short gain = 10; //gain factor
> > > > short sine_table[8]={0,707,1000,707,0,-707,-1000,-
> 707};//sine values
> > > > short out_buffer[256]; //output buffer
> > > > const short BUFFERLENGTH = 256; //size of output buffer
> > > > int i = 0; //for buffer count
> > > >
> > > > interrupt void c_int11() //interrupt service routine
> > > > {
> > > > output_sample(sine_table[loop]*gain); //output sine values
> > > > out_buffer[i] = sine_table[loop]*gain; //output to buffer
> > > > i++; //increment buffer count
> > > > if(i==BUFFERLENGTH) i=0; //if @ bottom reinit count
> > > > if (loop < 7) ++loop; //check for end of table
> > > > else loop = 0; //reinit table index
> > > > return; //return from interrupt
> > > > }
> > > >
> > > > void main()
> > > > {
> > > > comm_intr(); //init DSK, codec, McBSP
> > > > while(1); //infinite loop
> > > > }
> > > >
> > > >
> >
> > ///////////////////////////////////////////////////////////////
> ////////////
> > >
> > > > /* C6713dskinit.c Includes functions from TI in the C6713
> CSL and
> > > C6713DSK BSL */
> > > >
> >
> > ///////////////////////////////////////////////////////////////
> ////////////
> > >
> > > >
> > > > #include "C6713dskinit.h"
> > > > #define using_bios //if BIOS don't use top of vector table
> > > > extern Uint32 fs; //for sampling frequency
> > > >
> > > > void c6713_dsk_init() //dsp-peripheral initialization
> > > > {
> > > > DSK6713_init(); //call BSL to init DSK-EMIF,PLL)
> > > >
> > > > hAIC23_handle=DSK6713_AIC23_openCodec(0, &config);
> > > > DSK6713_AIC23_setFreq(hAIC23_handle, fs); //set sample rate
> > > > MCBSP_config(DSK6713_AIC23_DATAHANDLE,&AIC23CfgData);
> > > > MCBSP_start(DSK6713_AIC23_DATAHANDLE, MCBSP_XMIT_START |
> > > MCBSP_RCV_START |
> > > > MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC, 220);
> > > > }
> > > > .
> > > > .
> > > > .
> > > > void comm_intr() //for communication/init using interrupt
> > > > {
> > > > poll=0; //0 since not polling
> > > > IRQ_globalDisable(); //disable interrupts
> > > > c6713_dsk_init(); //init DSP and codec
> > > > CODECEventId=MCBSP_getXmtEventId
> (DSK6713_AIC23_codecdatahandle);
> > > >
> > > > #ifndef using_bios //do not need to point to vector table
> > > > IRQ_setVecs(vectors); //point to the IRQ vector table
> > > > #endif //since interrupt vector handles this
> > > >
> > > > IRQ_map(CODECEventId, 11); //map McBSP1 Xmit to INT11
> > > > IRQ_reset(CODECEventId); //reset codec INT 11
> > > > IRQ_globalEnable(); //globally enable interrupts
> > > > IRQ_nmiEnable(); //enable NMI interrupt
> > > > IRQ_enable(CODECEventId); //enable CODEC eventXmit INT11
> > > > output_sample(0); //start McBSP interrupt outputting a
> sample
> > > > }
> > > >
> > > > void output_sample(int out_data) //for out to Left and
> Right channels
> > > > {
> > > > short CHANNEL_data;
> > > >
> > > > AIC_data.uint=0; //clear data structure
> > > > AIC_data.uint=out_data; //32-bit data -->data structure
> > > >
> > > > /*The existing interface defaults to right channel. To
> default instead
> > > to the left channel and use output_sample(short), left and
> right channels
> > > are swapped In main source program use LEFT 0 and RIGHT 1
> (opposite of
> > > what is used here)*/
> > > >
> > > > CHANNEL_data=AIC_data.channel[RIGHT]; //swap left and
> right channels
> > > > AIC_data.channel[RIGHT]=AIC_data.channel[LEFT];
> > > > AIC_data.channel[LEFT]=CHANNEL_data;
> > > > if (poll) while(!MCBSP_xrdy
> (DSK6713_AIC23_DATAHANDLE));//if ready to
> > > transmit
> > > > MCBSP_write
> (DSK6713_AIC23_DATAHANDLE,AIC_data.uint);//write/output data
> > >
> > > > }
> > > > ...
> > > >
> > > >
> >
> > ///////////////////////////////////////////////////////////////
> ////////////
> > >
> > > > /* Vectors_intr.asm */
> > > >
> >
> > ///////////////////////////////////////////////////////////////
> ////////////
> > >
> > > >
> > > > *Vectors_intr.asm Vector file for interrupt INT11
> > > > .global _vectors ;global symbols
> > > > .global _c_int00
> > > > .global _vector1
> > > > ...
> > > > .global _vector10
> > > > .global _c_int11 ;for INT11
> > > > .global _vector12
> > > > ...
> > > >
> > > > .ref _c_int00 ;entry address
> > > >
> > > > .sect ".vecs" ;aligned IST section
> > > > .align 1024
> > > > _vectors:
> > > > _vector0: VEC_ENTRY _c_int00 ;RESET
> > > > _vector1: VEC_ENTRY _vec_dummy ;NMI
> > > > _vector2: VEC_ENTRY _vec_dummy ;RSVD
> > > > ...
> > > > _vector10: VEC_ENTRY _vec_dummy
> > > > _vector11: VEC_ENTRY _c_int11 ;ISR address
> > > > _vector12: VEC_ENTRY _vec_dummy
> > > > ...
> > > >
> > > > I build the project it doesn't have an error except these
> warrning
> > > msgs:
> > > > warning: creating output section .vecs without SECTIONS
> specification
> > > > warning: creating .stack section with default size of 400
> (hex) words.
> > > > warning: Detected a near (.bss section relative) data
> reference to the
> > > symbol
> > > >
> > > > I run the project and I tried to see the output of the
> codec with an
> > > osiloscope. But I didn't find a sine wave output rather I
> found some kind
> > > of nosie.
> > > > I also tried to view output_buff, which is in the ISR,
> with graphical
> > > display tool of the CCS but it has a value that it not
> supposed to have.
> > > like
> > > > output_buff[0] = 19064
> > > > [1] = 269
> > > > [2] = 4115
> > > > [3] = -24576
> > > > ...
> > > >
> > > > but it is supposed to have 10 times values inside the
> sine_table(0,
> > > 10*707, 10*1000, ...).
> > > >
> > > > Just to give a little hint where the problem might be, I
> don't think
> > > > the ISR c_int11 is being excuted. I tried to
> display "Hello" by
> > > > writing a line printf("hello") , including , just
> inside
> > > > the ISR but it didn't displayed anything.
> > >
> > > Using printf() inside an ISR is not a good idea. This is
> because printf()
> > > requires
> > > uses JTAG I/O to move the text data over to the PC where you
> can see it
> > > inside CCS.
> > > JTAG I/O is slow: some "other" DSP code (i.e. not yours) has
> to run, it
> > > takes a lot
> > > of DSK-PC handshaking, and for your DSK 6713 board the JTAG
> I/O rate
> > > itself is turtle
> > > slow, no more than 1 Mbyte/sec at best and probably
> considerably less. At
> > > the least
> > > you might try LOG_printf() (check my spelling)... that
> records the print
> > > text but
> > > delays the JTAG I/O until later. Or, a better approach is to
> simply set a
> > > global
> > > memory flag inside the ISR that you can check later, after
> manually
> > > stopping your
> > > program.
> > >
> > > -Jeff
> > >
> >
Reply by Jeff Brower November 19, 20082008-11-19
To Mixalis and other students-

Like other working engineers, I'm allowed to help students only via the group. So,
first instruction: post to the group. If you should be cc'd directly by group
members who are replying to your post, that's simply a precaution to make sure you
receive the answer quickly, in case the group copy of the reply is moderated. It's
not an invite to write directly to working engineers asking for help.

In this day and age, part of your learning experience is in how to use effectively
use peer groups and how to follow instructions. Mixalis, I have to tell you that
you're not off to a good start, seeing as how some other answers have gone by
recently asking students to post to the group. Please go back and read those
carefully

Then repeat your post, and I have a feeling you will get some helpful comments :-)

-Jeff

mixalis xydeas wrote:

> hello , I'm new too in the dsp programming...
> I need an example that will make my dsp run...
> I have read the same book with Zemene and some other books with matlab .... and
> I've the same warnings but not a simple error when I run some of the examples...
> Is it possible to programm only with jtag? or I can with just the usb interface ?
> What do I have to change in the first case?
> (I could not find a jtag 2 usb converter in market)
>
> I've also used a very simple example with matlab/ simulink but still no result .
> the example is in this page
>
> http://www.kxcad.net/cae_MATLAB/toolbox/tic6000/c6416dskled.html
>
> I use CCS 3.3, matlab R2008a, .NET and I have DSK C6416
> But still can't run something to make clear that my dsp's working and have a proper
> configuration for my system
>
> thnks for any help or comment,
>
> 2008/11/19 Jeff Brower Zemene-
>
> Andrew and Mike's suggestions are very good, suggest to follow. Also, see
> comment
> below about using printf() inside ISRs.
> > I am a student who is getting to know the C6713 DSK. I have started
> reading the Dr. Rulph Chassaing book "Digital Signal Processing and
> Application with C6713 and C6416". But I get stucked on the first example
> of the book that I didn't get the right thing I expect from the codec
> output. I bypassed Example 1.1 of the book and I tried to run Example 1.2
> I also face the same problem.
> > Here are the sample of the codes of exapmple 1.2 of the book which I
> copied from the CD that is enclosed with the book:
> >
> > Sourse Files: Sine8_buff.c
> > Vector_intr.asm
> > c6713dskinit.c
> >
> >
> //////////////////////////////////////////////////////////////////////////
>
> > /* sine8_buf.c Sine generation. Output buffer plotted within CCS */
> >
> /////////////////////////////////////////////////////////////////////////
>
> >
> > #include "dsk6713_aic23.h" //support file for codec,DSK
> > Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
> > int loop = 0; //table index
> > short gain = 10; //gain factor
> > short sine_table[8]={0,707,1000,707,0,-707,-1000,-707};//sine values
> > short out_buffer[256]; //output buffer
> > const short BUFFERLENGTH = 256; //size of output buffer
> > int i = 0; //for buffer count
> >
> > interrupt void c_int11() //interrupt service routine
> > {
> > output_sample(sine_table[loop]*gain); //output sine values
> > out_buffer[i] = sine_table[loop]*gain; //output to buffer
> > i++; //increment buffer count
> > if(i==BUFFERLENGTH) i=0; //if @ bottom reinit count
> > if (loop < 7) ++loop; //check for end of table
> > else loop = 0; //reinit table index
> > return; //return from interrupt
> > }
> >
> > void main()
> > {
> > comm_intr(); //init DSK, codec, McBSP
> > while(1); //infinite loop
> > }
> >
> >
> ///////////////////////////////////////////////////////////////////////////
>
> > /* C6713dskinit.c Includes functions from TI in the C6713 CSL and
> C6713DSK BSL */
> >
> ///////////////////////////////////////////////////////////////////////////
>
> >
> > #include "C6713dskinit.h"
> > #define using_bios //if BIOS don't use top of vector table
> > extern Uint32 fs; //for sampling frequency
> >
> > void c6713_dsk_init() //dsp-peripheral initialization
> > {
> > DSK6713_init(); //call BSL to init DSK-EMIF,PLL)
> >
> > hAIC23_handle=DSK6713_AIC23_openCodec(0, &config);
> > DSK6713_AIC23_setFreq(hAIC23_handle, fs); //set sample rate
> > MCBSP_config(DSK6713_AIC23_DATAHANDLE,&AIC23CfgData);
> > MCBSP_start(DSK6713_AIC23_DATAHANDLE, MCBSP_XMIT_START |
> MCBSP_RCV_START |
> > MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC, 220);
> > }
> > .
> > .
> > .
> > void comm_intr() //for communication/init using interrupt
> > {
> > poll=0; //0 since not polling
> > IRQ_globalDisable(); //disable interrupts
> > c6713_dsk_init(); //init DSP and codec
> > CODECEventId=MCBSP_getXmtEventId(DSK6713_AIC23_codecdatahandle);
> >
> > #ifndef using_bios //do not need to point to vector table
> > IRQ_setVecs(vectors); //point to the IRQ vector table
> > #endif //since interrupt vector handles this
> >
> > IRQ_map(CODECEventId, 11); //map McBSP1 Xmit to INT11
> > IRQ_reset(CODECEventId); //reset codec INT 11
> > IRQ_globalEnable(); //globally enable interrupts
> > IRQ_nmiEnable(); //enable NMI interrupt
> > IRQ_enable(CODECEventId); //enable CODEC eventXmit INT11
> > output_sample(0); //start McBSP interrupt outputting a sample
> > }
> >
> > void output_sample(int out_data) //for out to Left and Right channels
> > {
> > short CHANNEL_data;
> >
> > AIC_data.uint=0; //clear data structure
> > AIC_data.uint=out_data; //32-bit data -->data structure
> >
> > /*The existing interface defaults to right channel. To default instead
> to the left channel and use output_sample(short), left and right channels
> are swapped In main source program use LEFT 0 and RIGHT 1 (opposite of
> what is used here)*/
> >
> > CHANNEL_data=AIC_data.channel[RIGHT]; //swap left and right channels
> > AIC_data.channel[RIGHT]=AIC_data.channel[LEFT];
> > AIC_data.channel[LEFT]=CHANNEL_data;
> > if (poll) while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE));//if ready to
> transmit
> > MCBSP_write(DSK6713_AIC23_DATAHANDLE,AIC_data.uint);//write/output data
>
> > }
> > ...
> >
> >
> ///////////////////////////////////////////////////////////////////////////
>
> > /* Vectors_intr.asm */
> >
> ///////////////////////////////////////////////////////////////////////////
>
> >
> > *Vectors_intr.asm Vector file for interrupt INT11
> > .global _vectors ;global symbols
> > .global _c_int00
> > .global _vector1
> > ...
> > .global _vector10
> > .global _c_int11 ;for INT11
> > .global _vector12
> > ...
> >
> > .ref _c_int00 ;entry address
> >
> > .sect ".vecs" ;aligned IST section
> > .align 1024
> > _vectors:
> > _vector0: VEC_ENTRY _c_int00 ;RESET
> > _vector1: VEC_ENTRY _vec_dummy ;NMI
> > _vector2: VEC_ENTRY _vec_dummy ;RSVD
> > ...
> > _vector10: VEC_ENTRY _vec_dummy
> > _vector11: VEC_ENTRY _c_int11 ;ISR address
> > _vector12: VEC_ENTRY _vec_dummy
> > ...
> >
> > I build the project it doesn't have an error except these warrning
> msgs:
> > warning: creating output section .vecs without SECTIONS specification
> > warning: creating .stack section with default size of 400 (hex) words.
> > warning: Detected a near (.bss section relative) data reference to the
> symbol
> >
> > I run the project and I tried to see the output of the codec with an
> osiloscope. But I didn't find a sine wave output rather I found some kind
> of nosie.
> > I also tried to view output_buff, which is in the ISR, with graphical
> display tool of the CCS but it has a value that it not supposed to have.
> like
> > output_buff[0] = 19064
> > [1] = 269
> > [2] = 4115
> > [3] = -24576
> > ...
> >
> > but it is supposed to have 10 times values inside the sine_table(0,
> 10*707, 10*1000, ...).
> >
> > Just to give a little hint where the problem might be, I don't think
> > the ISR c_int11 is being excuted. I tried to display "Hello" by
> > writing a line printf("hello") , including , just inside
> > the ISR but it didn't displayed anything.
>
> Using printf() inside an ISR is not a good idea. This is because printf()
> requires
> uses JTAG I/O to move the text data over to the PC where you can see it
> inside CCS.
> JTAG I/O is slow: some "other" DSP code (i.e. not yours) has to run, it
> takes a lot
> of DSK-PC handshaking, and for your DSK 6713 board the JTAG I/O rate
> itself is turtle
> slow, no more than 1 Mbyte/sec at best and probably considerably less. At
> the least
> you might try LOG_printf() (check my spelling)... that records the print
> text but
> delays the JTAG I/O until later. Or, a better approach is to simply set a
> global
> memory flag inside the ISR that you can check later, after manually
> stopping your
> program.
>
> -Jeff
>
Reply by Jeff Brower November 19, 20082008-11-19
Zemene-

Andrew and Mike's suggestions are very good, suggest to follow. Also, see comment
below about using printf() inside ISRs.

> I am a student who is getting to know the C6713 DSK. I have started reading the Dr. Rulph Chassaing book "Digital Signal Processing and Application with C6713 and C6416". But I get stucked on the first example of the book that I didn't get the right thing I expect from the codec output. I bypassed Example 1.1 of the book and I tried to run Example 1.2 I also face the same problem.
> Here are the sample of the codes of exapmple 1.2 of the book which I copied from the CD that is enclosed with the book:
>
> Sourse Files: Sine8_buff.c
> Vector_intr.asm
> c6713dskinit.c
>
> //////////////////////////////////////////////////////////////////////////
> /* sine8_buf.c Sine generation. Output buffer plotted within CCS */
> /////////////////////////////////////////////////////////////////////////
>
> #include "dsk6713_aic23.h" //support file for codec,DSK
> Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
> int loop = 0; //table index
> short gain = 10; //gain factor
> short sine_table[8]={0,707,1000,707,0,-707,-1000,-707};//sine values
> short out_buffer[256]; //output buffer
> const short BUFFERLENGTH = 256; //size of output buffer
> int i = 0; //for buffer count
>
> interrupt void c_int11() //interrupt service routine
> {
> output_sample(sine_table[loop]*gain); //output sine values
> out_buffer[i] = sine_table[loop]*gain; //output to buffer
> i++; //increment buffer count
> if(i==BUFFERLENGTH) i=0; //if @ bottom reinit count
> if (loop < 7) ++loop; //check for end of table
> else loop = 0; //reinit table index
> return; //return from interrupt
> }
>
> void main()
> {
> comm_intr(); //init DSK, codec, McBSP
> while(1); //infinite loop
> }
>
> ///////////////////////////////////////////////////////////////////////////
> /* C6713dskinit.c Includes functions from TI in the C6713 CSL and C6713DSK BSL */
> ///////////////////////////////////////////////////////////////////////////
>
> #include "C6713dskinit.h"
> #define using_bios //if BIOS don't use top of vector table
> extern Uint32 fs; //for sampling frequency
>
> void c6713_dsk_init() //dsp-peripheral initialization
> {
> DSK6713_init(); //call BSL to init DSK-EMIF,PLL)
>
> hAIC23_handle=DSK6713_AIC23_openCodec(0, &config);
> DSK6713_AIC23_setFreq(hAIC23_handle, fs); //set sample rate
> MCBSP_config(DSK6713_AIC23_DATAHANDLE,&AIC23CfgData);
> MCBSP_start(DSK6713_AIC23_DATAHANDLE, MCBSP_XMIT_START | MCBSP_RCV_START |
> MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC, 220);
> }
> .
> .
> .
> void comm_intr() //for communication/init using interrupt
> {
> poll=0; //0 since not polling
> IRQ_globalDisable(); //disable interrupts
> c6713_dsk_init(); //init DSP and codec
> CODECEventId=MCBSP_getXmtEventId(DSK6713_AIC23_codecdatahandle);
>
> #ifndef using_bios //do not need to point to vector table
> IRQ_setVecs(vectors); //point to the IRQ vector table
> #endif //since interrupt vector handles this
>
> IRQ_map(CODECEventId, 11); //map McBSP1 Xmit to INT11
> IRQ_reset(CODECEventId); //reset codec INT 11
> IRQ_globalEnable(); //globally enable interrupts
> IRQ_nmiEnable(); //enable NMI interrupt
> IRQ_enable(CODECEventId); //enable CODEC eventXmit INT11
> output_sample(0); //start McBSP interrupt outputting a sample
> }
>
> void output_sample(int out_data) //for out to Left and Right channels
> {
> short CHANNEL_data;
>
> AIC_data.uint=0; //clear data structure
> AIC_data.uint=out_data; //32-bit data -->data structure
>
> /*The existing interface defaults to right channel. To default instead to the left channel and use output_sample(short), left and right channels are swapped In main source program use LEFT 0 and RIGHT 1 (opposite of what is used here)*/
>
> CHANNEL_data=AIC_data.channel[RIGHT]; //swap left and right channels
> AIC_data.channel[RIGHT]=AIC_data.channel[LEFT];
> AIC_data.channel[LEFT]=CHANNEL_data;
> if (poll) while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE));//if ready to transmit
> MCBSP_write(DSK6713_AIC23_DATAHANDLE,AIC_data.uint);//write/output data
> }
> ...
>
> ///////////////////////////////////////////////////////////////////////////
> /* Vectors_intr.asm */
> ///////////////////////////////////////////////////////////////////////////
>
> *Vectors_intr.asm Vector file for interrupt INT11
> .global _vectors ;global symbols
> .global _c_int00
> .global _vector1
> ...
> .global _vector10
> .global _c_int11 ;for INT11
> .global _vector12
> ...
>
> .ref _c_int00 ;entry address
>
> .sect ".vecs" ;aligned IST section
> .align 1024
> _vectors:
> _vector0: VEC_ENTRY _c_int00 ;RESET
> _vector1: VEC_ENTRY _vec_dummy ;NMI
> _vector2: VEC_ENTRY _vec_dummy ;RSVD
> ...
> _vector10: VEC_ENTRY _vec_dummy
> _vector11: VEC_ENTRY _c_int11 ;ISR address
> _vector12: VEC_ENTRY _vec_dummy
> ...
>
> I build the project it doesn't have an error except these warrning msgs:
> warning: creating output section .vecs without SECTIONS specification
> warning: creating .stack section with default size of 400 (hex) words.
> warning: Detected a near (.bss section relative) data reference to the symbol
>
> I run the project and I tried to see the output of the codec with an osiloscope. But I didn't find a sine wave output rather I found some kind of nosie.
> I also tried to view output_buff, which is in the ISR, with graphical display tool of the CCS but it has a value that it not supposed to have. like
> output_buff[0] = 19064
> [1] = 269
> [2] = 4115
> [3] = -24576
> ...
>
> but it is supposed to have 10 times values inside the sine_table(0, 10*707, 10*1000, ...).
>
> Just to give a little hint where the problem might be, I don't think
> the ISR c_int11 is being excuted. I tried to display "Hello" by
> writing a line printf("hello") , including , just inside
> the ISR but it didn't displayed anything.

Using printf() inside an ISR is not a good idea. This is because printf() requires
uses JTAG I/O to move the text data over to the PC where you can see it inside CCS.
JTAG I/O is slow: some "other" DSP code (i.e. not yours) has to run, it takes a lot
of DSK-PC handshaking, and for your DSK 6713 board the JTAG I/O rate itself is turtle
slow, no more than 1 Mbyte/sec at best and probably considerably less. At the least
you might try LOG_printf() (check my spelling)... that records the print text but
delays the JTAG I/O until later. Or, a better approach is to simply set a global
memory flag inside the ISR that you can check later, after manually stopping your
program.

-Jeff
Reply by Michael Dunn November 19, 20082008-11-19
Zemene,

On Wed, Nov 19, 2008 at 7:31 AM, wrote:
> Hello Everyone,
>
> I am a student who is getting to know the C6713 DSK. I have started reading
> the Dr. Rulph Chassaing book "Digital Signal Processing and Application with
> C6713 and C6416". But I get stucked on the first example of the book that I
> didn't get the right thing I expect from the codec output. I bypassed
> Example 1.1 of the book and I tried to run Example 1.2 I also face the same
> problem.
> Here are the sample of the codes of exapmple 1.2 of the book which I copied
> from the CD that is enclosed with the book:
>
> Sourse Files: Sine8_buff.c
> Vector_intr.asm
> c6713dskinit.c
>
> //////////////////////////////////////////////////////////////////////////
> /* sine8_buf.c Sine generation. Output buffer plotted within CCS */
> /////////////////////////////////////////////////////////////////////////
>
> #include "dsk6713_aic23.h" //support file for codec,DSK
> Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
> int loop = 0; //table index
> short gain = 10; //gain factor
> short sine_table[8]={0,707,1000,707,0,-707,-1000,-707};//sine values
> short out_buffer[256]; //output buffer
> const short BUFFERLENGTH = 256; //size of output buffer
> int i = 0; //for buffer count
>
> interrupt void c_int11() //interrupt service routine
> {
> output_sample(sine_table[loop]*gain); //output sine values
> out_buffer[i] = sine_table[loop]*gain; //output to buffer
> i++; //increment buffer count
> if(i==BUFFERLENGTH) i=0; //if @ bottom reinit count
> if (loop < 7) ++loop; //check for end of table
> else loop = 0; //reinit table index
> return; //return from interrupt
> }
>
> void main()
> {
> comm_intr(); //init DSK, codec, McBSP
> while(1); //infinite loop
> }
>
> ///////////////////////////////////////////////////////////////////////////
> /* C6713dskinit.c Includes functions from TI in the C6713 CSL and C6713DSK
> BSL */
> ///////////////////////////////////////////////////////////////////////////
>
> #include "C6713dskinit.h"
> #define using_bios //if BIOS don't use top of vector table
> extern Uint32 fs; //for sampling frequency
>
> void c6713_dsk_init() //dsp-peripheral initialization
> {
> DSK6713_init(); //call BSL to init DSK-EMIF,PLL)
>
> hAIC23_handle=DSK6713_AIC23_openCodec(0, &config);
> DSK6713_AIC23_setFreq(hAIC23_handle, fs); //set sample rate
> MCBSP_config(DSK6713_AIC23_DATAHANDLE,&AIC23CfgData);
> MCBSP_start(DSK6713_AIC23_DATAHANDLE, MCBSP_XMIT_START | MCBSP_RCV_START |
> MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC, 220);
> }
> .
> .
> .
> void comm_intr() //for communication/init using interrupt
> {
> poll=0; //0 since not polling
> IRQ_globalDisable(); //disable interrupts
> c6713_dsk_init(); //init DSP and codec
> CODECEventId=MCBSP_getXmtEventId(DSK6713_AIC23_codecdatahandle);
>
> #ifndef using_bios //do not need to point to vector table
> IRQ_setVecs(vectors); //point to the IRQ vector table
> #endif //since interrupt vector handles this
>
> IRQ_map(CODECEventId, 11); //map McBSP1 Xmit to INT11
> IRQ_reset(CODECEventId); //reset codec INT 11
> IRQ_globalEnable(); //globally enable interrupts
> IRQ_nmiEnable(); //enable NMI interrupt
> IRQ_enable(CODECEventId); //enable CODEC eventXmit INT11
> output_sample(0); //start McBSP interrupt outputting a sample
> }
>
> void output_sample(int out_data) //for out to Left and Right channels
> {
> short CHANNEL_data;
>
> AIC_data.uint=0; //clear data structure
> AIC_data.uint=out_data; //32-bit data -->data structure
>
> /*The existing interface defaults to right channel. To default instead to
> the left channel and use output_sample(short), left and right channels are
> swapped In main source program use LEFT 0 and RIGHT 1 (opposite of what is
> used here)*/
>
> CHANNEL_data=AIC_data.channel[RIGHT]; //swap left and right channels
> AIC_data.channel[RIGHT]=AIC_data.channel[LEFT];
> AIC_data.channel[LEFT]=CHANNEL_data;
> if (poll) while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE));//if ready to
> transmit
> MCBSP_write(DSK6713_AIC23_DATAHANDLE,AIC_data.uint);//write/output data
> }
> ...
>
> ///////////////////////////////////////////////////////////////////////////
> /* Vectors_intr.asm */
> ///////////////////////////////////////////////////////////////////////////
>
> *Vectors_intr.asm Vector file for interrupt INT11
> .global _vectors ;global symbols
> .global _c_int00
> .global _vector1
> ...
> .global _vector10
> .global _c_int11 ;for INT11
> .global _vector12
> ...
>
> .ref _c_int00 ;entry address
>
> .sect ".vecs" ;aligned IST section
> .align 1024
> _vectors:
> _vector0: VEC_ENTRY _c_int00 ;RESET
> _vector1: VEC_ENTRY _vec_dummy ;NMI
> _vector2: VEC_ENTRY _vec_dummy ;RSVD
> ...
> _vector10: VEC_ENTRY _vec_dummy
> _vector11: VEC_ENTRY _c_int11 ;ISR address
> _vector12: VEC_ENTRY _vec_dummy
> ...
>
> I build the project it doesn't have an error except these warrning msgs:
> warning: creating output section .vecs without SECTIONS specification

-----------
This is likely your problem and your assessment is probably correct.
The '.vecs' section is for the interrupt vector table which is
necessary to properly locate the ISRs.
This should be defined in a linker command file [LCF] that is either
missing or incorrect. LCFs are identified by the extension '.cmd' - I
suspect that there is one somewhere to be included in your project. It
could be located in a separate directory and shared by multiple
projects. Look for references in the book and search your files for
'*.cmd'.

!!!!!!!!--NOTE--!!!!!!!!!
It is very common for novices and some professionals to ignore
warnings. Do NOT fall into that trap. Always eliminate the warnings
or understand 100% why you are getting them [It took me a long time to
learn this].
It will save you in the long run.

mikedunn
> warning: creating .stack section with default size of 400 (hex) words.
> warning: Detected a near (.bss section relative) data reference to the
> symbol
>
> I run the project and I tried to see the output of the codec with an
> osiloscope. But I didn't find a sine wave output rather I found some kind of
> nosie.
> I also tried to view output_buff, which is in the ISR, with graphical
> display tool of the CCS but it has a value that it not supposed to have.
> like
> output_buff[0] = 19064
> [1] = 269
> [2] = 4115
> [3] = -24576
> ...
>
> but it is supposed to have 10 times values inside the sine_table(0, 10*707,
> 10*1000, ...).
>
> Just to give a little hint where the problem might be, I don't think the ISR
> c_int11 is being excuted. I tried to display "Hello" by writing a line
> printf("hello") , including , just inside the ISR but it didn't
> displayed anything.
>
> can anyone tell me where the problem might be?
> Thank you.
> Zemene.
>
> P.S. I am using CCS version 3.1

--
www.dsprelated.com/blogs-1/nf/Mike_Dunn.php
Reply by Andrew Elder November 19, 20082008-11-19
Zemene,

Looks like you are on the right track with the debugging.
Here are the steps I take when something like this isn't working:
1) check the clocks to the McBSP are running as expected. Look at the schematic and figure out where to probe the DSK to look at the clocks.
2) turn off interrupt handling for the moment and look up the C6713 peripherals guide and figure out how to view the Xmit Rdy flag and make sure that it is being set. You can view it from CCS.
3) turn interrupt handling on in the setup steps but keep GIE turned off. Check that the expected interrupt enable flag is set and that interrupt is being triggered. Again, this can be viewed from CCS.
4) turn on GIE and put a breakpoint in the ISR using CCS.

Although I have done this sort of thing many times, I don't carry all the details in my head. I have to go and reread documentation every time figure out what registers and flags to inspect. This is a great learning opportunity !

Good luck,
Andrew

________________________________
From: "z...@yahoo.com"
To: c...
Sent: Wednesday, November 19, 2008 8:31:14 AM
Subject: [c6x] Problem with Dr. Rulph Chassaing books Example 1.2
Hello Everyone,

I am a student who is getting to know the C6713 DSK. I have started reading the Dr. Rulph Chassaing book "Digital Signal Processing and Application with C6713 and C6416". But I get stucked on the first example of the book that I didn't get the right thing I expect from the codec output. I bypassed Example 1.1 of the book and I tried to run Example 1.2 I also face the same problem.
Here are the sample of the codes of exapmple 1.2 of the book which I copied from the CD that is enclosed with the book:

Sourse Files: Sine8_buff.c
Vector_intr. asm
c6713dskinit. c

//////////// ///////// ///////// ///////// ///////// ///////// ///////// ////////
/* sine8_buf.c Sine generation. Output buffer plotted within CCS */
//////////// ///////// ///////// ///////// ///////// ///////// ///////// ///////

#include "dsk6713_aic23. h" //support file for codec,DSK
Uint32 fs=DSK6713_AIC23_ FREQ_8KHZ; //set sampling rate
int loop = 0; //table index
short gain = 10; //gain factor
short sine_table[8] ={0,707,1000, 707,0,-707, -1000,-707} ;//sine values
short out_buffer[256] ; //output buffer
const short BUFFERLENGTH = 256; //size of output buffer
int i = 0; //for buffer count

interrupt void c_int11() //interrupt service routine
{
output_sample( sine_table[ loop]*gain) ; //output sine values
out_buffer[i] = sine_table[loop] *gain; //output to buffer
i++; //increment buffer count
if(i==BUFFERLENGTH) i=0; //if @ bottom reinit count
if (loop < 7) ++loop; //check for end of table
else loop = 0; //reinit table index
return; //return from interrupt
}

void main()
{
comm_intr(); //init DSK, codec, McBSP
while(1); //infinite loop
}

//////////// ///////// ///////// ///////// ///////// ///////// ///////// /////////
/* C6713dskinit. c Includes functions from TI in the C6713 CSL and C6713DSK BSL */
//////////// ///////// ///////// ///////// ///////// ///////// ///////// /////////

#include "C6713dskinit. h"
#define using_bios //if BIOS don't use top of vector table
extern Uint32 fs; //for sampling frequency

void c6713_dsk_init( ) //dsp-peripheral initialization
{
DSK6713_init( ); //call BSL to init DSK-EMIF,PLL)

hAIC23_handle= DSK6713_AIC23_ openCodec( 0, &config);
DSK6713_AIC23_ setFreq(hAIC23_ handle, fs); //set sample rate
MCBSP_config( DSK6713_AIC23_ DATAHANDLE, &AIC23CfgData) ;
MCBSP_start( DSK6713_AIC23_ DATAHANDLE, MCBSP_XMIT_START | MCBSP_RCV_START |
MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYN C, 220);
}
.
.
.
void comm_intr() //for communication/ init using interrupt
{
poll=0; //0 since not polling
IRQ_globalDisable( ); //disable interrupts
c6713_dsk_init( ); //init DSP and codec
CODECEventId= MCBSP_getXmtEven tId(DSK6713_ AIC23_codecdatah andle);

#ifndef using_bios //do not need to point to vector table
IRQ_setVecs( vectors); //point to the IRQ vector table
#endif //since interrupt vector handles this

IRQ_map(CODECEventI d, 11); //map McBSP1 Xmit to INT11
IRQ_reset(CODECEven tId); //reset codec INT 11
IRQ_globalEnable( ); //globally enable interrupts
IRQ_nmiEnable( ); //enable NMI interrupt
IRQ_enable(CODECEve ntId); //enable CODEC eventXmit INT11
output_sample( 0); //start McBSP interrupt outputting a sample
}

void output_sample( int out_data) //for out to Left and Right channels
{
short CHANNEL_data;

AIC_data.uint= 0; //clear data structure
AIC_data.uint= out_data; //32-bit data -->data structure

/*The existing interface defaults to right channel. To default instead to the left channel and use output_sample( short), left and right channels are swapped In main source program use LEFT 0 and RIGHT 1 (opposite of what is used here)*/

CHANNEL_data= AIC_data. channel[RIGHT] ; //swap left and right channels
AIC_data.channel[ RIGHT]=AIC_ data.channel[ LEFT];
AIC_data.channel[ LEFT]=CHANNEL_ data;
if (poll) while(!MCBSP_ xrdy(DSK6713_ AIC23_DATAHANDLE ));//if ready to transmit
MCBSP_write( DSK6713_AIC23_ DATAHANDLE, AIC_data. uint);//write/ output data
}
...

//////////// ///////// ///////// ///////// ///////// ///////// ///////// /////////
/* Vectors_intr. asm */
//////////// ///////// ///////// ///////// ///////// ///////// ///////// /////////

*Vectors_intr. asm Vector file for interrupt INT11
.global _vectors ;global symbols
.global _c_int00
.global _vector1
...
.global _vector10
.global _c_int11 ;for INT11
.global _vector12
...

.ref _c_int00 ;entry address

.sect ".vecs" ;aligned IST section
.align 1024
_vectors:
_vector0: VEC_ENTRY _c_int00 ;RESET
_vector1: VEC_ENTRY _vec_dummy ;NMI
_vector2: VEC_ENTRY _vec_dummy ;RSVD
...
_vector10: VEC_ENTRY _vec_dummy
_vector11: VEC_ENTRY _c_int11 ;ISR address
_vector12: VEC_ENTRY _vec_dummy
...

I build the project it doesn't have an error except these warrning msgs:
warning: creating output section .vecs without SECTIONS specification
warning: creating .stack section with default size of 400 (hex) words.
warning: Detected a near (.bss section relative) data reference to the symbol

I run the project and I tried to see the output of the codec with an osiloscope. But I didn't find a sine wave output rather I found some kind of nosie.
I also tried to view output_buff, which is in the ISR, with graphical display tool of the CCS but it has a value that it not supposed to have. like
output_buff[ 0] = 19064
[1] = 269
[2] = 4115
[3] = -24576
...

but it is supposed to have 10 times values inside the sine_table(0, 10*707, 10*1000, ...).

Just to give a little hint where the problem might be, I don't think the ISR c_int11 is being excuted. I tried to display "Hello" by writing a line printf("hello" ) , including , just inside the ISR but it didn't displayed anything.

can anyone tell me where the problem might be?
Thank you.
Zemene.

P.S. I am using CCS version 3.1
Reply by zeme...@yahoo.com November 19, 20082008-11-19
Hello Everyone,

I am a student who is getting to know the C6713 DSK. I have started reading the Dr. Rulph Chassaing book "Digital Signal Processing and Application with C6713 and C6416". But I get stucked on the first example of the book that I didn't get the right thing I expect from the codec output. I bypassed Example 1.1 of the book and I tried to run Example 1.2 I also face the same problem.
Here are the sample of the codes of exapmple 1.2 of the book which I copied from the CD that is enclosed with the book:

Sourse Files: Sine8_buff.c
Vector_intr.asm
c6713dskinit.c

//////////////////////////////////////////////////////////////////////////
/* sine8_buf.c Sine generation. Output buffer plotted within CCS */
/////////////////////////////////////////////////////////////////////////

#include "dsk6713_aic23.h" //support file for codec,DSK
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
int loop = 0; //table index
short gain = 10; //gain factor
short sine_table[8]={0,707,1000,707,0,-707,-1000,-707};//sine values
short out_buffer[256]; //output buffer
const short BUFFERLENGTH = 256; //size of output buffer
int i = 0; //for buffer count

interrupt void c_int11() //interrupt service routine
{
output_sample(sine_table[loop]*gain); //output sine values
out_buffer[i] = sine_table[loop]*gain; //output to buffer
i++; //increment buffer count
if(i==BUFFERLENGTH) i=0; //if @ bottom reinit count
if (loop < 7) ++loop; //check for end of table
else loop = 0; //reinit table index
return; //return from interrupt
}

void main()
{
comm_intr(); //init DSK, codec, McBSP
while(1); //infinite loop
}

///////////////////////////////////////////////////////////////////////////
/* C6713dskinit.c Includes functions from TI in the C6713 CSL and C6713DSK BSL */
///////////////////////////////////////////////////////////////////////////

#include "C6713dskinit.h"
#define using_bios //if BIOS don't use top of vector table
extern Uint32 fs; //for sampling frequency

void c6713_dsk_init() //dsp-peripheral initialization
{
DSK6713_init(); //call BSL to init DSK-EMIF,PLL)

hAIC23_handle=DSK6713_AIC23_openCodec(0, &config);
DSK6713_AIC23_setFreq(hAIC23_handle, fs); //set sample rate
MCBSP_config(DSK6713_AIC23_DATAHANDLE,&AIC23CfgData);
MCBSP_start(DSK6713_AIC23_DATAHANDLE, MCBSP_XMIT_START | MCBSP_RCV_START |
MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC, 220);
}
.
.
.
void comm_intr() //for communication/init using interrupt
{
poll=0; //0 since not polling
IRQ_globalDisable(); //disable interrupts
c6713_dsk_init(); //init DSP and codec
CODECEventId=MCBSP_getXmtEventId(DSK6713_AIC23_codecdatahandle);

#ifndef using_bios //do not need to point to vector table
IRQ_setVecs(vectors); //point to the IRQ vector table
#endif //since interrupt vector handles this

IRQ_map(CODECEventId, 11); //map McBSP1 Xmit to INT11
IRQ_reset(CODECEventId); //reset codec INT 11
IRQ_globalEnable(); //globally enable interrupts
IRQ_nmiEnable(); //enable NMI interrupt
IRQ_enable(CODECEventId); //enable CODEC eventXmit INT11
output_sample(0); //start McBSP interrupt outputting a sample
}

void output_sample(int out_data) //for out to Left and Right channels
{
short CHANNEL_data;

AIC_data.uint=0; //clear data structure
AIC_data.uint=out_data; //32-bit data -->data structure

/*The existing interface defaults to right channel. To default instead to the left channel and use output_sample(short), left and right channels are swapped In main source program use LEFT 0 and RIGHT 1 (opposite of what is used here)*/

CHANNEL_data=AIC_data.channel[RIGHT]; //swap left and right channels
AIC_data.channel[RIGHT]=AIC_data.channel[LEFT];
AIC_data.channel[LEFT]=CHANNEL_data;
if (poll) while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE));//if ready to transmit
MCBSP_write(DSK6713_AIC23_DATAHANDLE,AIC_data.uint);//write/output data
}
...

///////////////////////////////////////////////////////////////////////////
/* Vectors_intr.asm */
///////////////////////////////////////////////////////////////////////////

*Vectors_intr.asm Vector file for interrupt INT11
.global _vectors ;global symbols
.global _c_int00
.global _vector1
...
.global _vector10
.global _c_int11 ;for INT11
.global _vector12
...

.ref _c_int00 ;entry address

.sect ".vecs" ;aligned IST section
.align 1024
_vectors:
_vector0: VEC_ENTRY _c_int00 ;RESET
_vector1: VEC_ENTRY _vec_dummy ;NMI
_vector2: VEC_ENTRY _vec_dummy ;RSVD
...
_vector10: VEC_ENTRY _vec_dummy
_vector11: VEC_ENTRY _c_int11 ;ISR address
_vector12: VEC_ENTRY _vec_dummy
...

I build the project it doesn't have an error except these warrning msgs:
warning: creating output section .vecs without SECTIONS specification
warning: creating .stack section with default size of 400 (hex) words.
warning: Detected a near (.bss section relative) data reference to the symbol

I run the project and I tried to see the output of the codec with an osiloscope. But I didn't find a sine wave output rather I found some kind of nosie.
I also tried to view output_buff, which is in the ISR, with graphical display tool of the CCS but it has a value that it not supposed to have. like
output_buff[0] = 19064
[1] = 269
[2] = 4115
[3] = -24576
...

but it is supposed to have 10 times values inside the sine_table(0, 10*707, 10*1000, ...).

Just to give a little hint where the problem might be, I don't think the ISR c_int11 is being excuted. I tried to display "Hello" by writing a line printf("hello") , including , just inside the ISR but it didn't displayed anything.

can anyone tell me where the problem might be?
Thank you.
Zemene.

P.S. I am using CCS version 3.1