a doubt in TMS320C6211 DSK sampling program(by interrupt)
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
a doubt in TMS320C6211 DSK sampling program(by interrupt)

 
Post new topic   Reply to topic    CASTalk.com Forum Index -> DSP
Author Message
bhaskar
Guest





Posted: Thu Dec 30, 2004 9:46 pm    Post subject: a doubt in TMS320C6211 DSK sampling program(by interrupt) Reply with quote

hello
iam presently working on a TMS320C6211 DSK. iam new to this real time
processing field. inorder to explain my doubt please go through the
following program first. then i will explain my doubt.

#include<std.h>
#include<log.h>
#include<stdio.h>
#include "inoutcfg.h"
#include "regs.h"
#include "c6211dsk.h"
#include <csl.h>
#include <c6x.h>
#include <csl_irq.h>
#include <csl_mcbsp.h>
#include <csl_timer.h>
#include <csl_edma.h>
#include <csl_cache.h>

void InoutIsr (void);
void mcbsp0_init();
void mcbsp0_write(int out_data);
int mcbsp0_read();
extern int codec();
void start_timer1();
void interrupt_init (void );

#define FCPU 150000000 /* CPU clock frequency */
#define SRATE 8000 /* Data sample rate */
#define TPRD (FCPU/(4*2*SRATE)) /*Timer period,using the clock
mode*/
#pragma CODE_SECTION(InoutIsr, "mycode"); /* Makes the program run
from internal memory */

TIMER_Handle hTimer; /* Handle for the timer device */

void main(void)
{
mcbsp0_init();
codec(); /* Initialise the codec */
start_timer1(); /* Initialise and start the timer */
interrupt_init();

for (;;); /* Wait for an interrupt */
}

void mcbsp0_init()
{
/* Set up McBSP0 */

*(unsigned volatile int *)McBSP0_SPCR = 0;
*(unsigned volatile int *)McBSP0_PCR = 0;
*(unsigned volatile int *)McBSP0_RCR = 0x10040;
*(unsigned volatile int *)McBSP0_XCR = 0x10040;
*(unsigned volatile int *)McBSP0_DXR = 0;
*(unsigned volatile int *)McBSP0_SPCR = 0x12001;

void mcbsp0_write(int out_data)
{
int temp;

temp = *(unsigned volatile int *)McBSP0_SPCR & 0x20000;

while ( temp == 0)
{
temp = *(unsigned volatile int *)McBSP0_SPCR & 0x20000;
}

*(unsigned volatile int *)McBSP0_DXR = out_data;
}

int mcbsp0_read()
{
int temp;

temp = *(unsigned volatile int *)McBSP0_SPCR & 0x2;

while ( temp == 0)
{
temp = *(unsigned volatile int *)McBSP0_SPCR & 0x2;
}

temp = *(unsigned volatile int *)McBSP0_DRR;
return temp;
}


void start_timer1()
{

*(unsigned volatile int *)TIMER1_CTRL = 0x000;
IRQ_map(IRQ_EVT_TINT1,8);
hTimer = TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET
Setup the timer */

TIMER_configArgs(hTimer,
TIMER_CTL_OF(0x000003c1),
TIMER_PRD_OF(TPRD),
TIMER_CNT_OF(0) );

/* Enable the timer` */

TIMER_start(hTimer);
}

void interrupt_init (void )
{
/* Initialise the interrupts */

IRQ_enable(IRQ_EVT_TINT1);
IRQ_test(IRQ_EVT_TINT1);
IRQ_nmiEnable();
IRQ_enable(IRQ_EVT_TINT1); /* Enables the timer interrupt */

IRQ_globalEnable();

}

void InoutIsr (void)
{
int temp;
temp = mcbsp0_read();
temp =temp & 0xfffe;
mcbsp0_write(temp);
return;
}


the above program is meant for sampling the input signal with a
sampling frequency of 8000 Hz. for this purpose the McBSP with an
intrerrpt method is used. now concentrate on the main function in the
above program. first the McBSP, the codec, timer and the interrups are
initialized.(note:here i did not included the codec intialization
function.)after that the program entered into infinite background
loop.but after every sampling period the timer has to interrupt the CPU
and CPU has to serve the interrupt serive subroutine.so according to my
knowledge in the main function after the infinite for loop the CPU has
to serve the InoutIsr() subroutine. but after checking the program it
is not at all entering the InoutIsr() subroutine. can anybody explain
why it is not happening? if any further explanation is needed iam very
happy to expalin more clearly.
Back to top
Guest






Posted: Sat Jan 01, 2005 12:34 am    Post subject: Re: a doubt in TMS320C6211 DSK sampling program(by interrupt Reply with quote

Check to see if the interrupt flag is set in the interrupt flag
register. I cannot tell you exactly which register it is, but each
DSP will usually have a register that indicates an interrupt is
"pending". If you do not see this flag set, the CPU is not aware that
an interrupt should be occuring. If that flag is not ever being set,
the McBSP is probably not generating an interrupt when it should, and
then you should review your McBSP settings more.

If that interrupt flag is being set, but the interrupt does not occur
.... it is maybe because that specific interrupt is not enabled ... or
the global interrupt enable is not set properly.

Regards,

Robert

"bhaskar" <bhaskarbudiredla@gmail.com> wrote:

Quote:
hello
iam presently working on a TMS320C6211 DSK. iam new to this real time
processing field. inorder to explain my doubt please go through the
following program first. then i will explain my doubt.



( modify address for return mail )

www.numbersusa.com
www.americanpatrol.com
Back to top
Guest






Posted: Sat Jan 01, 2005 5:49 pm    Post subject: Re: a doubt in TMS320C6211 DSK sampling program(by interrupt Reply with quote

Bhaskar,

Have you put the address of the interrupt service routine at the
appropriate place in the exception vector table?

Donald
Back to top
bhaskar
Guest





Posted: Sat Jan 01, 2005 9:18 pm    Post subject: Re: a doubt in TMS320C6211 DSK sampling program(by interrupt Reply with quote

hello donald
i don't know to how to place the address of the interrupt service
routine in the exception vector table. can u please expalin clearly how
to do that.
Back to top
Guest






Posted: Sun Jan 02, 2005 2:20 pm    Post subject: Re: a doubt in TMS320C6211 DSK sampling program(by interrupt Reply with quote

bhaskar wrote:
Quote:
hello donald
i don't know to how to place the address of the interrupt service
routine in the exception vector table. can u please expalin clearly
how
to do that.


One way is to write an assembly language source file that contains
the instruction to branch to your interrupt subroutine at the
memory location for the interrupt vector corresponding to
whichever interrupt you are using.
I think that you could get away with something along the lines
(in pseudo assembler) of

org 0xiiii

b your_isr

Where iiii is the address of the interrupt vector. You might consider
writing a section of assembler that fills the entire interrupt
vector table - putting NOPs in most locations.

However, within a CCS project you probably need to use a .cmd
linker command file in order to specify a memory section
and use an assembler directive .sect to place your code there (in
the interrupt vector table) in addition to the above.

There are probably examples of this on the CD ROM that came with
the DSK and/or on the TI website. I know
that you can find an example of this in Rulph Chassaing's book
"DSP Applications Using C and the TMS320C6x DSK", Wiley
Hope this helps,

Donald
Back to top
Guest






Posted: Sun Jan 02, 2005 3:06 pm    Post subject: Re: a doubt in TMS320C6211 DSK sampling program(by interrupt Reply with quote

bhaskar wrote:
Quote:
hello donald
i don't know to how to place the address of the interrupt service
routine in the exception vector table. can u please expalin clearly
how
to do that.


One way is to write an assembly language source file that contains
the instruction to branch to your interrupt subroutine at the
memory location for the interrupt vector corresponding to
whichever interrupt you are using.
I think that you could get away with something along the lines
(in pseudo assembler) of

org 0xiiii

b your_isr

Where iiii is the address of the interrupt vector. You might consider
writing a section of assembler that fills the entire interrupt
vector table - putting NOPs in most locations.

However, within a CCS project you probably need to use a .cmd
linker command file in order to specify a memory section
and use an assembler directive .sect to place your code there (in
the interrupt vector table) in addition to the above.

There are probably examples of this on the CD ROM that came with
the DSK and/or on the TI website. I know
that you can find an example of this in Rulph Chassaing's book
"DSP Applications Using C and the TMS320C6x DSK", Wiley
Hope this helps,

Donald
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> DSP All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB