AnsweredAssumed Answered

SPI Master/Slave configuration with two MC56F8006DEMOs

Question asked by Jefferson Jackson on Mar 9, 2013
Latest reply on May 22, 2013 by xiangjun.rong

Hey everybody,

I am running CodeWarrior v10.3 and am currently trying to configure a SPI link between two MC56F6006Demo DSCs. The problem I am having is the data from the master is not showing up the when it gets to the slave board. It shows up as either the empty character or some other random 8 bit value which shows up as some strange characters such as a 'y' with two dots over it or an 'a' with a hat. I am also monitoring the SPI_DRCV register to check the data coming coming through. I am sending data from the master in a do while loop which is given in the help menu for the SynchroMaster Component typical usage section.

 

MASTER CODE:

TComData ch;

byte err;

 

void main(void)

{

  do {

  SM1_SendChar((byte) 49); // Send zero

  err = SM1_RecvChar(&ch); // Get received char

 

  /* Do until it receives char with code 13 */

  } while ( (err != ERR_OK) || (ch != 13) );

 

}

 

 

SLAVE CODE:

void SS1_OnRxChar(void)

{

  byte err;

  SS1_TComData ch;

 

  err = SS1_RecvChar(&ch);  // Get received character

  if ((err == ERR_OK) || (err == ERR_OVERRUN)) {

  (void)SS1_SendChar((SS1_TComData) ch);       // Prepare a character for transmission

  (void)AS1_SendChar((AS1_TComData) ch);

  }

}

 

 

 

I am using interrupts on the slaves end but I just can not seem to figure out what is going on. In the slaves OnRxChar Interrupt I am "receiving" the character and then sending it back to the master as well as sending it to a terminal on the computer to verify that what I am sending from the master shows up at the slave. I am conencting the boards from MOSI to MOSI, MISO to MISO, SCLK to SCLK, and the slaves SS to ground (only one slave). By adding the components and configuring them in Component Inspector I am setting up the pins as far as I am concerned. Has anybody come across a problem like this or does anyone have any advice? I would really appreciate any help or suggestions. Thanks.

Regards,

Jeff

Outcomes