Hi,
We tried configuring DSPI port 2 and 1 as master and slave respectively. CS and clocks are generating. MOSI is also generating. We have verified with Oscilloscope. RFDF interrupt also generated. But the slave Rx data register always read as zero. And we tried looping back of MOSI to MISO of master itself. Master Rx data register too read as zero.
Please go thru our code. Is there any mistake in SPI Input direction pin assignment?
Thanks & regards,
Chidambaram.V
Original Attachment has been moved to: spicode.txt.zip
Hi Chidambaram,
1. The TX FIFO in the PUSHR register is of 2 bytes long, so must be transmitting the 64 bytes data splitting each of 2bytes.
2. You could use CLR_TXF control field in MCR control register to flush out the transmit buffer before transmitting new data.
Regards
Sandeep Nagarajan
HI to all,
While transmitting 64 bytes of data from slave,last byte was missing.On next transmission i can get the last byte of the previous transmission.So that while starting transmission first byte is zero.is there any settings for clearing the shift register in SPI while initializing the module.
Hi Mr. Chidhabaram, We are also facing same problem and we are also writing spi driver code for mpc 5777m , but for us we are not at all gettting clock, cs and mosi on oscilloscope and my code looks not working . we got your code , but there is no definition for HW_INIT function . Can you please share your complete driver code with All function definition Or at least the HW_INIT function.chidambaramvelusamy
I had attached my code with the previous post. Please refer that one. our device was working fine in master mode. but not Slave Mode. We have some issues while transmitting from slave.
@chidambaram velusamy : With your code for spi master, Once the SPI_2 master init completes with halt = 0x0, the sck pin has to generate the oscillations, which is not happening in my board. i used same gpio inits and as per the IO signal table, the SSS values matches with your configurations, could you please share any tips over the issue.
I think you have used wrong values for SSS fields. I the lines below I have commented out what you have wrong replacing it with values to be in accordance to MPC5777M_cut2_IO_Definition_v1_41_17Feb2015.xlsx:
/*SPI02 DIN-PL[13]*/
//SIUL2.MSCR_MUX[374].B.SSS=0x8;
SIUL2.MSCR_MUX[374].B.SSS=0x2;
/*SPI01 DIN-pf[4]*/
//SIUL2.MSCR_MUX[371].B.SSS=0x3;
SIUL2.MSCR_MUX[371].B.SSS=0x2;
/*SPI01 CLK-pf[5]*/
//SIUL2.MSCR_MUX[372].B.SSS=0x2;
SIUL2.MSCR_MUX[372].B.SSS=0x1;
/* SPI01 CS-ph[14]*/
//SIUL2.MSCR_MUX[373].B.SSS=0x3;
SIUL2.MSCR_MUX[373].B.SSS=0x2;
Hi, I have been noticed my comment here is wrong. Please ignore it.
Original configuration is correct. I am sorry for confusing you.