MPC555 QSPI init problems

"csjessid" <[email protected]> Tue, 08 May 2007 14:37:06 -0000
Newsgroups gmane.comp.hardware.motorola.microcontrollers
Message-ID <[email protected]>
Hi,
I´m trying to setup a QSPI communication with the MPC555 (master) and 
a Fujitsu microcontroller (slave), but I can´t configure the MPC 
correctly. I programm it with Matlab/Simulink based on Target 
Language Compiler files and this is the external c-code:

-------------------------------------------------------------------
UINT8 InitQSPI (void)

{

unsigned int ret = 0;

if (!qspi_config) {

QSMCM.PQSPAR.R = 3; // MOSI/MISO

QSMCM.DDRQS.R = 0x06; // MOSI, SCK Out, MISO In

QSMCM.SPCR0.R = 0x8308; // Master, 16-bit, SPBR 

QSMCM.SPCR2.R = 0x0200; // queue size of 3 words */

QSMCM.SPCR3.R = 0x0000; // normal operation */

QSMCM.COMDRAM[0].R = 0x00; /* force 8-bit */

QSMCM.COMDRAM[1].R = 0x00; /* 16-bit */

QSMCM.COMDRAM[2].R = 0x00; /* 16-bit */

QSMCM.TRANRAM[0].R = 0x00; /* 1st data word */

QSMCM.TRANRAM[1].R = 0x0000; /* 2nd data word */

QSMCM.TRANRAM[2].R = 0x0000; /* 3rd data word */

QSMCM.RECRAM[0].R = 0x0; /* clear rx data word */

QSMCM.RECRAM[1].R = 0x0; /* clear rx data word */

QSMCM.RECRAM[2].R = 0x0; /* clear rx data word */

QSMCM.SPCR1.R = 0x0101; /* SPI disabled */

qspi_config = 1;

ret = 1;


} return ret;


} /* end of InitSPI */


/* ------------ send tx ------------------ */

UINT8 SPI_tx (UINT32 data)

{

UINT16 highbyte, lowbyte;

unsigned int ret = 0;

highbyte = data >> 16; 

lowbyte = data; 

if (!transmitted) {

QSMCM.TRANRAM[0].R = data >> 16; 

QSMCM.TRANRAM[1].R = highbyte; 

QSMCM.TRANRAM[2].R = lowbyte; 

QSMCM.SPSR.B.SPIF = 0; 

QSMCM.SPCR1.B.SPE = 1;

transmitted = 1;

ret = 1;

while (QSMCM.SPSR.B.SPIF == 0); 

}

return ret;

} 
-------------------------------------------------------------------

in my simulink model, I read the return-values of the functions and 
send them via CAN to check if the routine was called successfully... 
But if I write SPCR2, SPCR3 or COMDRAM, I don´t receive anything from 
the CAN interface. As if the communication breaks down. What could be 
the problem? is the c-code correct? If yes, it has to be a problem 
with my model/sfunction/tlc in simulink.

greetings

Christian