AnsweredAssumed Answered

External SPI EEPROM at MPC5554

Question asked by Flo Haase on Dec 19, 2013
Latest reply on Jan 24, 2014 by Petr Stancik

Hello,

 

I'm trying to connect an external EEPROM via SPI to a MPC5554. At the document "Qorivva Simple Cookbook “Hello World” Programs to Exercise Common Features on MPC5500 & MPC5600 Microcontrollers" I found an example code to perform a single transfer from DSPI_C to DSPI_D. This programm works very fine. But now I want to replace the DSPI_D on the MPC5554 with an external EEPROM.

 

Here is the code from the example with my ideas:

 

// no changes, because the master on the MPC5554 still sets the system clock

void initSysclk (void) {

    FMPLL.SYNCR.R = 0x16080000;

    while (FMPLL.SYNSR.B.LOCK != 1) {};

    FMPLL.SYNCR.R = 0x16000000;

}

// also no changes, because DSPI_C is the master

void initDSPI_C(void) {

    DSPI_C.MCR.R = 0x80010001; /* Configure DSPI_C as master */

    DSPI_C.CTAR[0].R = 0x780A7727; /* Configure CTAR0 */

    DSPI_C.MCR.B.HALT = 0x0; /* Exit HALT mode: go from STOPPED to RUNNING state*/

    SIU.PCR[107].R = 0x0A00; /* MPC555x: Config pad as DSPI_C SOUT output */

    SIU.PCR[108].R = 0x0900; /* MPC555x: Config pad as DSPI_C SIN input */

    SIU.PCR[109].R = 0x0A00; /* MPC555x: Config pad as DSPI_C SCK output */

    SIU.PCR[110].R = 0x0A00; /* MPC555x: Config pad as DSPI_C PCS0 output */

}

 

void initDSPI_D(void) {

    // delete this funktion, because the external EEPROM just need hardwire signals SOUT, SIN, SCK and PCS0 from master

}

void ReadDataDSPI_D(void) {

   // no ideas how to read from the slave

}

void ReadDataDSPI_C(void) {

   // no ideas how to read from the slave

}

int main(void) {

    initSysclk();

    initDSPI_C();

    initDSPI_D();

    DSPI_D.PUSHR.R = 0x00001234;

    DSPI_C.PUSHR.R = 0x08015678;

    ReadDataDSPI_D(); /* Read data on slave DSPI */

    ReadDataDSPI_C(); /* Read data on master DSPI */

    while (1) {i++; } /* Wait forever */

}

 

It would be nice, if someone could help me.

 

Thanks and best regards

Flo

Outcomes