DSPRelated.com
Forums

SPI problem with DSP56F826EVM

Started by ltc2400 February 18, 2003
Hello, I am a newcomer to the motorola chips. i have a DSP56F826EVM
and am trying to get the SPI port to write. My code is based on an
example (5.1) in the codewarrior documentation.

#include "port.h"
#include "io.h"
#include "fcntl.h"
#include "bsp.h"
#include "spi.h"

void main (void)
{
spi_sParams SpiParams;
int SPIMaster;
UWord16 Data = 0x1234;
int i;

SpiParams.bSetAsMaster = 1;

SPIMaster = open(BSP_DEVICE_NAME_SPI_0, 0, &SpiParams);

for(i=0;i<500;i++)
{
write(SPIMaster, &Data, sizeof(Data));
}

close(SPIMaster);
}

My problem is that whenever open() is called, it completes (it does
not return a -1) so it completes successfully. however, when it
exits, the entire program finishes, the for loop is skipped, the close
() function is skipped, it just goes to the closing bracket and stays
there. can anyone help?? thanks a lot