I want to use the SPI module of MPC5744P to communicate with another chip in the controller board.
The following are my config:
SIUL2.MSCR[PC6].B.SSS = 1; /* PC6: Source signal is DSPI_0 SOUT */
SIUL2.MSCR[PC6].B.OBE = 1;
SIUL2.MSCR[PC6].B.SRC = 3;
SIUL2.MSCR[PC5].B.SSS = 1; /* PC5: Source signal is DSPI_0 CLK */
SIUL2.MSCR[PC5].B.OBE = 1;
SIUL2.MSCR[PC5].B.SRC = 3;
SIUL2.MSCR[PC7].B.IBE = 1; /* PC7: Enable pad for input DSPI_0 SIN */
SIUL2.IMCR.B.SSS = 1;
SIUL2.MSCR[PB2].B.SSS = 2; /* PB2: Source signal is DSPI_0 CS4 */
SIUL2.MSCR[PB2].B.OBE = 1; /* PB2: OBE=1. */
SIUL2.MSCR[PB2].B.SRC = 3;
SPI_0.MCR.R = 0x80010001; /* Configure DSPI_0 as master */
SPI_0.MODE.CTAR.R = 0x7E0A0010;/*0x7EAA0010;*/ /* Configure CTAR0 */
SPI_0.MCR.B.HALT = 0x0; /* Exit HALT mode: go from STOPPED to RUNNING state*/
SPI_0.PUSHR.PUSHR.R = /*0x08013400;*/0x08013001;
When I use the oscilloscope to detect the SDO and SCK of the 5744, I detected the correct waveform,
But the output of the B pin which is used as the SPI0 PCS4 is always low, which is not what I want.
Actually I want the SPI0 PCS4 to be low when the message is conveyed and to be high when the communication
is not activated.
What should I do to get the correct output of SPI0 PCS4? Are there any mistakes in my config?
Or someone have any examples?
Thanks in advance.
as you want to use CS4 you must set different PCS bit in the MCR and PUSH register, so the CS4 will be driven.
SPI_0.MCR.R = 0x80100001; /* Configure DSPI_0 as master, PCS4 inactive high */
SPI_0.PUSHR.PUSHR.R = 0x08103400;