AnsweredAssumed Answered

MSP5746C SPI CS not working

Question asked by Christopher Holland on Feb 21, 2018
Latest reply on Mar 5, 2018 by Christopher Holland

I give up. No matter what I try to do, I just can't seem to drive chip select low.

I can see the SPI_CLK and SPI_SOUT signals and they look perfect.

I know the pin is working. I used it as a gpio.

(The SPI is configured as a master. There are no reply messages, just an LCD screen)

(The development board is the EVB Board https://www.nxp.com/docs/en/user-guide/MPC5748GEVBUG.pdf )

 

void DSPI3_pin_init(void)

{

SIUL2.MSCR[PG3].R = 0;       /* Pad PG3: Clear Register */
SIUL2.MSCR[PG3].B.SSS = 0x2; /* Pad PG3: Source signal is DSPI_3 CS0 */
SIUL2.MSCR[PG3].B.OBE = 0x1; /* Pad PG3: Output Buffer Enable */

}

 

#define DSPI_MCR_PCSSSE 0x00000000

#define DSPI_MCR_PCSSSE 0x02000000
#define DSPI_MCR_PCSIS0 0x00010000
#define DSPI_MCR_PCSIS1 0x00020000
#define DSPI_MCR_PCSIS2 0x00040000
#define DSPI_MCR_PCSIS3 0x00080000
#define DSPI_MCR_PCSIS4 0x00100000
#define DSPI_MCR_PCSIS5 0x00200000
#define DSPI_MCR_HALT 0x00000001
#define DSPI_MCR_MSTR 0x80000000


void DSPI3_init(void)
{
DSPI_3.MCR.R = DSPI_MCR_MSTR | DSPI_MCR_PCSSSE | DSPI_MCR_PCSIS0 | DSPI_MCR_PCSIS1 | DSPI_MCR_PCSIS2 | DSPI_MCR_PCSIS3 | DSPI_MCR_PCSIS4 | DSPI_MCR_PCSIS5 | DSPI_MCR_HALT; 
DSPI_3.MODE.CTAR[0].R = 0x48021004; /* Configure CTAR0 */
DSPI_3.MCR.B.HALT = 0x0; /* Exit HALT mode: go from STOPPED to RUNNING state*/
DSPI_3.SR.R = 0xFCFE0000; /* Clear ALL status flags by writing 1 to them */

}

 

#define PUSHR_EOQ 0x08000000ul

#define PUSHR_PCS0 0x00010000ul
#define PUSHR_PCS1 0x00020000ul
#define PUSHR_PCS2 0x00040000ul
#define PUSHR_PCS3 0x00080000ul
#define PUSHR_PCS4 0x00100000ul
#define PUSHR_PCS5 0x00200000ul
#define PUSHR_CONT 0x00000000ul

 

void SomeWriteFunction(void)

{

DSPI_3.SR.R = 0xBEFF0000; /* Clear ALL status flags by writing 1 to them */

/* Try to set every CS line, but none of them are going low */

DSPI_3.PUSHR.PUSHR.B.TXDATA = FUNCTION_SET | FUNCTION_SET_DL | PUSHR_EOQ | PUSHR_PCS0 | PUSHR_PCS1 | PUSHR_PCS2 | PUSHR_PCS3 | PUSHR_PCS4 | PUSHR_PCS5;
}

 

 

 

Thank you,

Outcomes