Sign in

username:

password:



Not a member?

Search c54x



Search tips

Subscribe to c54x



c54x by Keywords

5409 | 5416 | AD5 | ADC | BIOS | Boot | Booting | Bootloader | C540 | C5402 | C5409 | C5416 | CCS | Codec | DMA | Dmad | DSK | DSKPlus | Dsplib | EVM | FFT | FIR | Flash | GPIO | HPI | Initialization | Interrupt | JTAG | LOG_printf | MCBSP | RFFT | RTDX | Sampling | STLM | UART | VC540

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 | TMS320C54x | Fixed Point and addressing

Technical discussions about the TI C54x DSPs (including the c5401, c5402, c5402a, c5404, c5407, c5409, c5409a, c5410, c5410a, c5416, c5420, c5421, c5441, c549, c5470 and c5471).

  

Post a new Thread

Fixed Point and addressing - Jose Luis Hurtado - Oct 6 21:50:00 2003

I am working on difgital filtering. This is my first experience with the TMS320C542 DSP. Could you please help me?
 
How can I do the scaling FIR coefficients using integer fixed point?
Do you have any article about that?
 
I have an FIR filter with 30 coefficients and I need to make the convolution with 59 input samples. How can skip one sample between each sample? I have been trying with de mac instruction and the index addressing, but I have not had luck. Is there a relationship between mac instruction, repeat instruction and the input samples?.
 
Thanks
 
Jose Luis
 





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



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

Implementing SPI with MCBSP - Miguel Fuentes - Oct 7 23:49:00 2003

Hi all,

Has anybody successfully implemented SPI using MCBSP? I've read the
documentation and I think I am close, but how do you initialize a
transfer? I don't mind using polling, interrupts, or DMA as long as I
can get it to work. I know that I can program the MCBSP on my board
because I've set up I/O and toggled the pins, and I've basically copied
code for the port setup for the SPI from application notes, but I don't
know how to perform the actual transfer.

In previous projects to transmit all I've had to do is load the Tx data
register and wait for the transmission to complete and to read I just
transmit a read command and then null and read the Rx register. I've
tried this and it doesn't work.

Would anybody be able to help me? Does anyone have any sample code?

Cheers,

Miguel



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



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

Re: Implementing SPI with MCBSP - Lucy Jordan - Oct 9 15:53:00 2003

here is some sample code:

//spi.c

int first = 1;

void spi_Init ()
{

first = 1;
MCBSP_FSET(SPCR10, RRST, 0);
MCBSP_FSET(SPCR20, XRST, 0);
MCBSP_FSET(SPCR20, FRST, 0);
MCBSP_FSET(SPCR20, GRST, 0);

MCBSP_RSET (SPCR10,0x1030);
MCBSP_RSET (SPCR20,0x130);
MCBSP_RSET (RCR10,0);
MCBSP_RSET (RCR20,0x5);
MCBSP_RSET (XCR10,0);
MCBSP_RSET (XCR20,0x5);
MCBSP_RSET (SRGR10,0x8C7);
MCBSP_RSET (SRGR20,0x2009);
MCBSP_RSET (MCR10,0);
MCBSP_RSET (MCR20,0);
MCBSP_RSET (PCR0,0x0f0f);
MCBSP_RSET (RCERA0,0);
MCBSP_RSET (RCERB0,0);
MCBSP_RSET (XCERA0,0);
MCBSP_RSET (XCERB0,0);

MCBSP_wait();

MCBSP_FSET(SPCR10, RRST, 1);
MCBSP_FSET(SPCR20, XRST, 1);
MCBSP_wait();

}

void spi_Open ()
{
}

void spi_Close ()
{

}
void byteToSpi (unsigned char data)
{
volatile int i;

if (!first) {
//check xrdy (only if not first write)
while (MCBSP_FGET(SPCR20,XRDY)== 0);
}
i=MCBSP_RGET (DRR10);
i=MCBSP_RGET (DRR10);

MCBSP_RSET (DXR20,0);
MCBSP_RSET (DXR10,data); //write output data to dxr

if (first){

MCBSP_FSET(SPCR20, FRST, 1);
MCBSP_FSET(SPCR20, GRST, 1);
MCBSP_wait(); //wait for Sample rate generator to settle
first = 0; //start sclk, /cs generator for first write
}
while (MCBSP_FGET (SPCR10,RRDY) == 0);//wait for completion
i=MCBSP_RGET (DRR10);//clear buffer

}
unsigned char spiToByte ()
{
unsigned char read1;
volatile int i;
while (MCBSP_FGET(SPCR20,XRDY)== 0); //wait for xrdy
i=MCBSP_RGET (DRR10);
i=MCBSP_RGET (DRR10);
i=MCBSP_RGET (DRR10);
//MCBSP_RSET (DXR20,0);
MCBSP_RSET (DXR10,0xAA); //dummy xmit to start clock and /cs, data is
don't care
while (MCBSP_FGET (SPCR10,RRDY) == 0); //wait for data
read1 = MCBSP_RGET (DRR10); //read result
return read1;
}

--- In , "Miguel Fuentes" <miguel.fuentes@c...>
wrote:
> Hi all,
>
> Has anybody successfully implemented SPI using MCBSP? I've read the
> documentation and I think I am close, but how do you initialize a
> transfer? I don't mind using polling, interrupts, or DMA as long as
I
> can get it to work. I know that I can program the MCBSP on my board
> because I've set up I/O and toggled the pins, and I've basically
copied
> code for the port setup for the SPI from application notes, but I
don't
> know how to perform the actual transfer.
>
> In previous projects to transmit all I've had to do is load the Tx
data
> register and wait for the transmission to complete and to read I
just
> transmit a read command and then null and read the Rx register. I've
> tried this and it doesn't work.
>
> Would anybody be able to help me? Does anyone have any sample code?
>
> Cheers,
>
> Miguel






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

Re: Implementing SPI with MCBSP - Raynald Lim You Ghee - Oct 13 4:43:00 2003

To use McBSP as SPI, you would need to set it to clock-stop mode. Note that in clock stop mode only single phase transfer is allowed. C5416 does not assert the FSYNC pin autonomously unlike C55x family, hence you'll need to assign an I/O pin for each programmable IC chip select (CS). To pack data ala dedicated SPI in Motorola core, set the register to ignore frame synchronization events. The maximum element per frame should be 128 bytes in length.

To use DMA, set up one of the DMA channel to wait for McBSP transmit event (XEVNT). If you are using C55x, make sure you read back the interrupt status register to reenable the interrupt. Configure post-indexing accordingly for your source register (destination register should remain constant and should point to one of the DXR0 register of your designated SPI/McBSP port).

Use the Chip Support Library to simplify things. Hope this helps.

Raynald Lim
>From: "Miguel Fuentes"
>To:
>Subject: [c54x] Implementing SPI with MCBSP
>Date: Wed, 8 Oct 2003 09:49:57 +1000
>
>Hi all,
>
>Has anybody successfully implemented SPI using MCBSP? I've read the
>documentation and I think I am close, but how do you initialize a
>transfer? I don't mind using polling, interrupts, or DMA as long as I
>can get it to work. I know that I can program the MCBSP on my board
>because I've set up I/O and toggled the pins, and I've basically copied
>code for the port setup for the SPI from application notes, but I don't
>know how to perform the actual transfer.
>
>In previous projects to transmit all I've had to do is load the Tx data
>register and wait for the transmission to complete and to read I just
>transmit a read command and then null and read the Rx register. I've
>tried this and it doesn't work.
>
>Would anybody be able to help me? Does anyone have any sample code?
>
>Cheers,
>
>Miguel
>
>
>_____________________________________
>
>
>
>
>
>


MSN 8 with e-mail virus protection service: 2 months FREE*

______________________________
Start your Android Ice Cream Sandwich development on TI's AM35x Sitara ARM Cortex-A8 processor today.



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

Re: Implementing SPI with MCBSP - Jeff Brower - Oct 14 4:21:00 2003

Raynald Lim-

> To use McBSP as SPI, you would need to set it to clock-stop mode. Note that in
> clock stop mode only single phase transfer is allowed. C5416 does not assert
the
> FSYNC pin autonomously unlike C55x family, hence you'll need to assign an I/O
pin
> for each programmable IC chip select (CS). To pack data ala dedicated SPI in
> Motorola core, set the register to ignore frame synchronization events. The
maximum
> element per frame should be 128 bytes in length.
>
> To use DMA, set up one of the DMA channel to wait for McBSP transmit event
(XEVNT).
> If you are using C55x, make sure you read back the interrupt status register
to
> reenable the interrupt. Configure post-indexing accordingly for your source
> register (destination register should remain constant and should point to one
of
> the DXR0 register of your designated SPI/McBSP port).
>
> Use the Chip Support Library to simplify things. Hope this helps.

Wow that's expert. You must have done this before and it does not sound like it
was
easy. That's got to be days worth of bugs condensed into one short mail.

-Jeff

> Raynald Lim
> >From: "Miguel Fuentes"
> >To:
> >Subject: [c54x] Implementing SPI with MCBSP
> >Date: Wed, 8 Oct 2003 09:49:57 +1000
> >
> >Hi all,
> >
> >Has anybody successfully implemented SPI using MCBSP? I've read the
> >documentation and I think I am close, but how do you initialize a
> >transfer? I don't mind using polling, interrupts, or DMA as long as I
> >can get it to work. I know that I can program the MCBSP on my board
> >because I've set up I/O and toggled the pins, and I've basically copied
> >code for the port setup for the SPI from application notes, but I don't
> >know how to perform the actual transfer.
> >
> >In previous projects to transmit all I've had to do is load the Tx data
> >register and wait for the transmission to complete and to read I just
> >transmit a read command and then null and read the Rx register. I've
> >tried this and it doesn't work.
> >
> >Would anybody be able to help me? Does anyone have any sample code?
> >
> >Cheers,
> >
> >Miguel
> >
> >
> >_____________________________________
> >
> >
> >
> >
> >
> -------------------------------------------------------------------------------- \
---
> MSN 8 with e-mail virus protection service: 2 months FREE*
> _____________________________________ > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.







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

Re: Implementing SPI with MCBSP - Raynald Lim You Ghee - Oct 16 12:07:00 2003

When configured properly, the throughput should ironically exceed that of the DMA driven dedicated SPI on OMAP1610 core. Good luck.Raynald Lim

>From: Jeff Brower
>To: Raynald Lim You Ghee
>CC: m...@cmr.uq.edu.au, c...@yahoogroups.com
>Subject: Re: [c54x] Implementing SPI with MCBSP
>Date: Mon, 13 Oct 2003 23:21:48 -0500
>
>Raynald Lim-
>
> > To use McBSP as SPI, you would need to set it to clock-stop mode. Note that in
> > clock stop mode only single phase transfer is allowed. C5416 does not assert the
> > FSYNC pin autonomously unlike C55x family, hence you'll need to assign an I/O pin
> > for each programmable IC chip select (CS). To pack data ala dedicated SPI in
> > Motorola core, set the register to ignore frame synchronization events. The maximum
> > element per frame should be 128 bytes in length.
> >
> > To use DMA, set up one of the DMA channel to wait for McBSP transmit event (XEVNT).
> > If you are using C55x, make sure you read back the interrupt status register to
> > reenable the interrupt. Configure post-indexing accordingly for your source
> > register (destination register should remain constant and should point to one of
> > the DXR0 register of your designated SPI/McBSP port).
> >
> > Use the Chip Support Library to simplify things. Hope this helps.
>
>Wow that's expert. You must have done this before and it does not sound like it was
>easy. That's got to be days worth of bugs condensed into one short mail.
>
>-Jeff
>
> > Raynald Lim
> > >From: "Miguel Fuentes"
> > >To:
> > >Subject: [c54x] Implementing SPI with MCBSP
> > >Date: Wed, 8 Oct 2003 09:49:57 +1000
> > >
> > >Hi all,
> > >
> > >Has anybody successfully implemented SPI using MCBSP? I've read the
> > >documentation and I think I am close, but how do you initialize a
> > >transfer? I don't mind using polling, interrupts, or DMA as long as I
> > >can get it to work. I know that I can program the MCBSP on my board
> > >because I've set up I/O and toggled the pins, and I've basically copied
> > >code for the port setup for the SPI from application notes, but I don't
> > >know how to perform the actual transfer.
> > >
> > >In previous projects to transmit all I've had to do is load the Tx data
> > >register and wait for the transmission to complete and to read I just
> > >transmit a read command and then null and read the Rx register. I've
> > >tried this and it doesn't work.
> > >
> > >Would anybody be able to help me? Does anyone have any sample code?
> > >
> > >Cheers,
> > >
> > >Miguel
> > >
> > >
> > >_____________________________________
> > >
> > >
> > >
> > >
> > >
> > >
> >
> > -------------------------------------------------------------------------------- ---
> > MSN 8 with e-mail virus protection service: 2 months FREE*
> > _____________________________________
> >
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


The new MSN 8: smart spam protection and 2 months FREE*

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



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