SPI mode in DSPI MPC5777c

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

SPI mode in DSPI MPC5777c

Jump to solution
849 Views
dineshmoka
Contributor III

Hi The following below is my initialization code for SPI mode in DSPI-MPC5777C. i was just trying to send data in DSPI_A module and receive the same data in DSPI_B module. My module clock frequency is 100MHz and i am using MPC5777c evaluation board. I connected PM6(SCKA) to PO0(SCKB), PM7(SINA) to PO2(SOUTB), PM8(SOUTA) to PM15(SINB) and PM13(PCSA0) to PM10(PCSB0). I am not receiving any data, Can you please check any initialization mistakes are there?

int D_DSPI_loopback (){
uint32_t ui32_rx_data_master,ui32_rx_data_slave;

ui32_rx_data_master = 0u;
ui32_rx_data_slave = 0u;

SIU.PCR[93].R = 0x0600; //SCKA
SIU.PCR[96].R = 0x0600; //PCSA0
SIU.PCR[95].R = 0x0600; //SOUTA
SIU.PCR[94].R = 0x0500; //SINA

SIU.PCR[103].R = 0x0500; //SINB
SIU.PCR[104].R = 0x0600; //SOUTB
SIU.PCR[102].R = 0x0500; //SCKB
SIU.PCR[105].R = 0x0500; //PCSB0

SIU.DISR.R = 0x40540000;
DSPI_A.MCR.R = 0x80010001;
DSPI_A.MODE.CTAR[0u].R = 0x7A0A7727u;
DSPI_A.MCR.B.HALT = 0x0u;
DSPI_B.MCR.R = 0x00010001u;
DSPI_B.MODE.CTAR[0u].R = 0x7A0A7727u;
DSPI_B.MCR.B.HALT = 0x0u;
DSPI_B.PUSHR.PUSHR.R = 0x00000000u|TX_DATA_SLAVE;
DSPI_A.PUSHR.PUSHR.R = 0x08010000u|TX_DATA_MASTER;
while (DSPI_A.SR.B.RFDF != 1u){}
ui32_rx_data_master = DSPI_A.POPR.R;
DSPI_A.SR.R = 0x90020000u;
while (DSPI_B.SR.B.RFDF != 1u){}
ui32_rx_data_slave = DSPI_B.POPR.R;
DSPI_B.SR.R = 0x90020000u;
}

0 Kudos
1 Solution
834 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

I did quick test on my side and it works as expected. I only changed the variables ui32_rx_data_master, ui32_rx_data_slave to global ones for better result checking. I can see that both master and slave received correct data.

Regards,

Lukas

View solution in original post

0 Kudos
2 Replies
835 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

I did quick test on my side and it works as expected. I only changed the variables ui32_rx_data_master, ui32_rx_data_slave to global ones for better result checking. I can see that both master and slave received correct data.

Regards,

Lukas

0 Kudos
832 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport
 
0 Kudos