MPC5777C S32DS and SPI

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

MPC5777C S32DS and SPI

1,954 Views
robertfromcummi
Contributor II

I have S32DS and controller with MPC5777C. I try to start SPI communication with external chip and got stopped at SPI clock generation. I cannot get to any clock signal on SCKA. What do I miss? I set Primary Function, output enabled, master enabled, pushed fifo and nothing on the clk output. Could anyone help? Maybe someone has done something similar?

 

Thank you in advance. Robert

Labels (1)
6 Replies

1,409 Views
robertfromcummi
Contributor II

Martin,

I found some time today to make few experiments with SPI and it looks like clock signal is being generated. It was enough to clear the status bit TXRXS.  Now I need to find out how to make exact number of clock pulses ...but I will try to make it myself first.

Thank you for helping with it.

Robert

1,410 Views
anilghadiya
Contributor II

Hi Robert,

 Would it be possible to share the clock configuration settings. I am trying to bring up the SPI communication on MPC5777C-516DS using DSPI_A. 

Thanks in advance.

With Regards,

Anil Ghadiya 

0 Kudos

1,410 Views
robertfromcummi
Contributor II

Hi Martin,

It is 416BGA and we have designed our own controller and I connected oscilloscope probe on the pin with CLK for spi. I checked if it is connected to right pin by forcing the change of state when in GPIO mode. I was able to change state of the output from low to high and back. It is GPIO 93 ...so it is PCR93 register. Of course when checking SPI I changed back to Primary Function by setting 1 in PA field.

This must be something small in configuration that I still miss ...below there is piece of C code that use for it. Maybe the sequence is not right?

Robert


void SPI0_Init(void)

PCR[93].B.PA = 1; //SCKA - Primary Function


PCR[94].B.PA = 1; //SINA - Primary Function


PCR[95].B.PA = 1; //SOUTA - Primary Function


PCR[96].B.PA = 0; //CS GPIO - Chip Select


GPDO[96].B.PDOn = 1; //CS - OUTPUT BUFFER TO ONE


/*Configured Master mode */


//SPI_0.MCR.R = 0x80030001;


//DSPI_A.MCR.R = 0x80030001;


MCR.B.HALT = 1; //Stop transfers


MCR.B.MSTR = 1; //Enables Master Mode


MCR.B.CONT_SCKE = 1; //Continuous clock


MCR.B.DCONF = 0; //SPI


MCR.B.FRZ = 0; //Do not freeze in debug


MCR.B.MTFE = 0; //Modified Transfer Format disabled


MCR.B.DIS_TXF = 0; //TX FIFO is enabled


MCR.B.DIS_RXF = 0; //RX FIFO is enabled


MCR.B.CLR_TXF = 1; //Clear TX fifo counter


MCR.B.CLR_RXF = 1; //Clear RX fifo counter


MCR.B.MDIS = 0; //Enable module clock


MCR.B.HALT = 0; //Start transfers


/*

//SPI_0.MODE.CTAR[0].R = 0x78021004;


MODE.CTAR[0].R = 0x78021004;

MODE.CTAR[0].B.FMSZ = 15; //number of bits to be transferred (FMSZ + 1)


/*Receive FIFO Drain Request enable*/


//SPI_0.RSER.B.RFDF_RE = 1;


RSER.B.RFDF_RE = 1;

/* Exit HALT mode: go from STOPPED to RUNNING state*/


//SPI_0.MCR.B.HALT = 0x0;


MCR.B.HALT = 0x0;

0 Kudos

1,410 Views
martin_kovar
NXP Employee
NXP Employee

Hi Robert,

by default, there is no clock on the pin while you do not transmit message. At first, set CONT_SCKE to 1 and then check, if there is the clock on the pin. If not, try to send some message and measure the clock during the transmitting.

If there will not be any clock, please write me back and we can check your GPIO settings.

Regards,

Martin

1,410 Views
robertfromcummi
Contributor II

Martin,

Thank you for helping. I set up CONT_SCKE and also made few experiments with different GPIO settings. Still could not get to clk signal. Interesting thing is that I see SPI_TCNT but always with value 2. Please look below on how the registers are set. GPIO is set as primary function which should be SPI and I checked OBE with 0 and with 1 too.

I like the bit fields but maybe I should not set up it by bits but rather write all bits at once ...maybe it is just problem with setting up the module. The view is from S32DS on Eclipse.

Once again thank you for help.

Robert

pastedImage_0.png

pastedImage_1.png

0 Kudos

1,410 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

your settings seems to be OK. Just to make sure, do you use EVB or your own design? If you use EVB, which pin do you measure the signal on?

Also, please write me back if you use package 416BGA or 516BGA.

Regards,

Martin