DSPRelated.com
Forums

DSPLIB and ST-BUS interrupts problem

Started by m_mo...@yahoo.com March 28, 2011
Dear all
I have a problem with DSPlib for tms320VC5416 chip.
I use POWER function from dsplib library to calculate the sum of sqrs of an input array.

It was ok until I add ST-BUS support to the project.
I get input data from ulaw codecs with sampling rate of 8000 sample per second.

Because ST-BUS consists of 32 channels, it interrupts my chip 256000 times in a second.

But adding ST-BUS support makes my code a bit unreliable.

I find that using this function (POWER) has some bad effects on the registers and after that some other parts of program dont work properly.

I write all program in C language.

When I comment the POWER function other part of program work reliable and without problem.
Does anyone have the same problem?
How could I overcome it.

I think that problem may be because of push and pop instructions before and after interrupt routines of ST-BUS.

How could I add PUSH ALL REGISTERS and POP ALL REGISTERS instruction in my interrupt routines which is written in C.
Thanks in advance.
Looking to hearing from you.

Mehrdad

OMAP35x EVM jump-starts low-power apps
The modular and extensible OMAP35x Evaluation Module (EVM) enables developers to start building applications based on the OMAP35x architecture: http://www.DSPRelated.com/omap35x
Mehrdad-

> I have a problem with DSPlib for tms320VC5416 chip.
> I use POWER function from dsplib library to calculate
> the sum of sqrs of an input array.
>
> It was ok until I add ST-BUS support to the project.
> I get input data from ulaw codecs with sampling rate
> of 8000 sample per second.
>
> Because ST-BUS consists of 32 channels, it interrupts
> my chip 256000 times in a second.

You have less than 4 usec between interrupts, not a lot of time. One possibility is the power() function turns
interrupts off, for example uses a RPT instruction, for longer than 4 usec. Do you have the power() function source
code? I don't mean the "C code equivalent", I mean the actual hand-optimized asm code.

> But adding ST-BUS support makes my code a bit
> unreliable.
>
> I find that using this function (POWER) has some bad
> effects on the registers and after that some other
> parts of program dont work properly.
>
> I write all program in C language.
>
> When I comment the POWER function other part of
> program work reliable and without problem.
> Does anyone have the same problem?
> How could I overcome it.
>
> I think that problem may be because of push and pop
> instructions before and after interrupt routines of
> ST-BUS.
>
> How could I add PUSH ALL REGISTERS and POP ALL
> REGISTERS instruction in my interrupt routines
> which is written in C.

Are you using the "interrupt" keyword in the ISR function definition in your C code? If so, all registers the ISR
uses are being saved and restored for you (i.e. compiler figures this out). In that case, I doubt that's the problem.

-Jeff

OMAP35x EVM jump-starts low-power apps
The modular and extensible OMAP35x Evaluation Module (EVM) enables developers to start building applications based on the OMAP35x architecture: http://www.DSPRelated.com/omap35x
Dear all
>I have a problem with DSPlib for tms320VC5416 chip.
>I use POWER function from dsplib library to calculate the sum of sqrs of an input array.
>
>It was ok until I add ST-BUS support to the project.
>I get input data from ulaw codecs with sampling rate of 8000 sample per second.
>
>Because ST-BUS consists of 32 channels, it interrupts my chip 256000 times in a second.
>
>But adding ST-BUS support makes my code a bit unreliable.
>
>I find that using this function (POWER) has some bad effects on the registers and after that some other parts of program dont work properly.
>
>I write all program in C language.
>
>When I comment the POWER function other part of program work reliable and without problem.
>Does anyone have the same problem?
>How could I overcome it.
>
>I think that problem may be because of push and pop instructions before and after interrupt routines of ST-BUS.
>
>How could I add PUSH ALL REGISTERS and POP ALL REGISTERS instruction in my interrupt routines which is written in C.
>Thanks in advance.
>Looking to hearing from you.
>
>Mehrdad
>
>OMAP35x EVM jump-starts low-power apps
>The modular and extensible OMAP35x Evaluation Module (EVM) enables developers to start building applications based on the OMAP35x architecture: http://www.DSPRelated.com/omap35x
I finally find the problem.
I was an asynchronous problem between ST-BUS interrupts.
I set transmit interrupt to be triggered by frame-sync and receive interrupt to be triggered by receiving each sample from ST-BUS.

In transmit interrupt the value of time-slot counter is set to 31.

But in receive interrupt I have to increase the value of time-Slot counter and some times this makes a race condition.

a shared variable is changed by 2 interrupts.

By considering the problem I finally change the code in such a way that no race condition occurs.

Thanks Jeff.

OMAP35x EVM jump-starts low-power apps
The modular and extensible OMAP35x Evaluation Module (EVM) enables developers to start building applications based on the OMAP35x architecture: http://www.DSPRelated.com/omap35x