This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Question about DM365 SPI.

I have met some problems with dm365 SPI.In my case,I need to use the spi to control the chip MAX4587.There have four channel NO1,NO2,NO3 and NO4 on the chip MAX4587.And the output port is named COM.I just have to write a data of 0x02 to the MAX4587 to link the COM with NO2.The following code is what I do with the SPI.Is there any other work I should do with the SPI?

/* Reset SPI */
    SPI_SPIGCR0 = 0x00000000;
    _wait( 1000 );

    /* Release SPI */
    SPI_SPIGCR0 = 0x00000001;

    /* SPI 4-Pin Mode setup */
    SPI_SPIGCR1 = 0x00000000
        | ( 0 << 24 ) // SPIEN off (must be set to 1 after all other SPI config bits written)
        | ( 0 << 16 ) // Loopback disabled
        | ( 1 << 1 ) // Internal CLK
        | ( 1 << 0 ); // Master

    SPI_SPIPC0 = 0x00000000
        | ( 1 << 11 )   // DI
        | ( 1 << 10 )   // DO
        | ( 1 << 9 )    // CLK
        | ( 0 << 1 )    // EN1
        | ( 1 << 0 );   // EN0

    SPI_SPIFMT0 = 0x00000000
        | ( 0 << 20 )   // SHIFTDIR
        | ( 0 << 17 )   // Polarity
        | ( 0 << 16 )   // Phase
        | ( 147 << 8 )    // Prescale

        | ( 8 << 0 );   // Char Len

    spidat1 = 0x00000000
        | ( 0 << 28 )   // CSHOLD
        | ( 0 << 24 )   // Format [0]
        | ( 2 << 16 )   // CSNR   [only SCS0 enbled]
        | ( 0 << 0 );   // Data bits

    SPI_SPIDAT1 = spidat1;

    SPI_SPIDELAY = 0x00000000
        | ( 8 << 24 )   // C2TDELAY
        | ( 8 << 16 );  // T2CDELAY

    SPI_SPIDEF = 0x00000000
        | ( 1 << 1 )    // EN1 inactive high
        | ( 1 << 0 );   // EN0 inactive high

    SPI_SPIINT = 0x00000000
        | ( 0 << 16 )   //
        | ( 0 << 8 )    //
        | ( 0 << 6 )    //
        | ( 1 << 4 );   //

    SPI_SPILVL = 0x00000000
        | ( 0 << 8 )    // EN0
        | ( 0 << 6 )    // EN0
        | ( 0 << 4 );   // EN0

    /* Enable SPI */
    SPI_SPIGCR1 |= ( 1 << 24 ); // SPIEN on

    SPI_SPIDAT1 = spidat1 | 0x02;