SPI Driver for MPC5777M

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI Driver for MPC5777M

822 Views
Contributor V

Hi All,

I am going to communicate to off chip modules using the MPC5777M  EVB Using SPI Protocol.We are porting the Micrium RTOS along with the Application code onto the MPC 5777M EVB.Can any one help me how to write the driver for SPI to communicate the off chip peripherals.

Labels (1)
5 Replies

12 Views
Contributor III

martinkovar

Hi Martin,

            As in view to achieve the SPI multi master mode for MPC5777M, 

       (1) I assigned two SS lines for two masters.

      (2) SCK, SOUT and SIN are kept in common between two masters.

       (3) The first combination of Master and slave set working good.

         (4).As i assign two SS pin configuration for slave, only the latest SS pin configuration is considered, therefore i couldnt establish the second master - slave combination by selecting the second Chip select line.

        

               It would be helpful if i get any tips over SPI multi master mode for MPC5777M.

    Regards

Sandeep Nagarajan

0 Kudos

12 Views
Contributor III

martinkovar

Hi Martin,

        1. As the code has been done for interrupt way of operation, but the xcptn_xmpl() function under HW_INIT() does not have configurations for MPC5777M.

        2. As we are trying to just test only the DSPI basic working mechanism on our MPC5777M evaluation board, So we are trying a simple polling way of code,

Code is like:

int spi_main(void)
{
    int counter = 0;

    HW_Init();   //excluded xcptn_xmpl() function initialization.
    SPI0_Init();     //configured as master
    SPI1_Init();    //configured as slave

  unsigned int cnt = 0;   //Just to have count.
  unsigned int buf = 0x0004;   //16 bit value to be loaded to DSPI_0 transmit buffer.
  unsigned int reached = 0;   
  for(cnt=0;cnt<5;cnt++)
  {
      DSPI_0.PUSHR.PUSHR.B.TXDATA = buf;     //data is written to the register.
      while(DSPI_1.SR.B.RFDF != 1);                      //  checking for the DSPI_1 receive buffer full flag.
      reached = 5; 
      RecDataMaster = DSPI_2.POPR.B.RXDATA;     // Reading from the receive buffer.
      buf++;            
      cnt++;
  }
 return 0;
}

3.As you have used CS0_0 and CS0_2, so no need to use SS_0 and SS_2?

4. As in the code, the master starts the operation while in initialization stage itself making HALT = 0x00; but is that enough or do we have to declare SS_0 pin low to start a data transfer? where it is not mentioned in the code.

5.could you please share any link or POLLING example code for SPI for MPC5777M or MPC5775k pls.

0 Kudos

12 Views
NXP Employee
NXP Employee

Hi,

I attached simple DSPI project for MPC5775K to this post, which uses polling method instead of interrupts. There is also the whole GPIO pins description and correct EVB connection. 

If you have any other questions, please feel free to write me back.

Regards,

Martin

12 Views
NXP Employee
NXP Employee

Hi,

please look at the following example. It is created for MPC5775K, but I think it is usable also for MPC5777M. Maybe GPIO will be different, but it is pretty easy to port it for MPC5777M. It is not too complex example, but it could be used as a basic concept of your development.

https://community.nxp.com/docs/DOC-332744 

If you have any other questions, please feel free to write me back.

Regards,

Martin

12 Views
Contributor V

Hi Martin Kovar Thank you for reply.I will check it.

0 Kudos