SPI Master/Slave configuration with two MC56F8006DEMOs

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPI Master/Slave configuration with two MC56F8006DEMOs

1,130 Views
jeffersonjackso
Contributor II

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

Labels (1)
Tags (2)
0 Kudos
1 Reply

381 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,Jeff,

Regarding the two MC56F8006 communication vis SPI, one is master, another is slave, I have following advices:

1)I suggest you connect a GPIO pin of master 56F8006 to /SS pin of SPI of slave 56F8006, from software, pls clear CPHA bit for master and slave SPI module.

2)the master 56F8006 has to clear/set GPIO so that the slave SPI can be enabled during the transfer process. If CPHA bit in SPI control register is cleared, the falling edge of /SS signal will trigger the MSB of MISO to be appear on the pad.

3)I suggest youn use SPI receiver full interrupt, in the ISR of SPI receiver Full interrupt, send/receive data for both master and slave SPI.

4)If you use SPI bean in PE, I suggest you set the "Input buffer size" and "output buffer size' to be zero.

If you still need my help, pls update the ticket.

0 Kudos