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.

SPI , SPIEN (SPIx_CSx) Assert Problem

Other Parts Discussed in Thread: AM3359

i have BeagleBone Board(AM3359), (Add SPI FLash (W25Q64CV))

I tries to operate as spi multi-channel mode (SPI0->CS0,CS1)

this code is setting sequence..

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#define MCSPI_IN_CLK            48000000

#define MCSPI_OUT_CLK           24000000

#define SPI_CHAN                0x0

#define SPI_CHAN1               0x1

#define SPI_BASE                SOC_SPI_0_REGS

#define SPI_BASE1               SOC_SPI_1_REGS

 

void SPI_Initialize(void)

{

    unsigned int retVal = 0;

    unsigned int regVal;

 

    /* Enable clock for SPI */

     regVal = (HWREG(SOC_CM_PER_REGS + CM_PER_SPI0_CLKCTRL) &     

          ~(CM_PER_SPI0_CLKCTRL_MODULEMODE));

    regVal |= CM_PER_SPI0_CLKCTRL_MODULEMODE_ENABLE;

    HWREG(SOC_CM_PER_REGS + CM_PER_SPI0_CLKCTRL) = regVal;

 

     McSPIReset(SPI_BASE);

 

    /* Enable chip select pin.*/

    McSPICSEnable(SPI_BASE);          //CS use

 

    /* Enable master mode of operation.*/    

   McSPIMasterModeEnable(SPI_BASE);  //Master Mode

 

    /* Perform the necessary configuration for master mode.*/

    retVal = McSPIMasterModeConfig(SPI_BASE, MCSPI_MULTI_CH, MCSPI_TX_RX_MODE,\     

                  MCSPI_DATA_LINE_COMM_MODE_1, SPI_CHAN);     

 

     McSPIClkConfig(SPI_BASE, MCSPI_IN_CLK, MCSPI_OUT_CLK,SPI_CHAN, MCSPI_CLK_MODE_0);

 

    /* Configure the word length.*/

    McSPIWordLengthSet(SPI_BASE, MCSPI_WORD_LENGTH(8), SPI_CHAN);

 

    /* Set polarity of SPIEN to low.*/    

   McSPICSPolarityConfig(SPI_BASE, MCSPI_CS_POL_LOW, SPI_CHAN);

 

    /* Enable the transmitter FIFO of McSPI peripheral.*/

     McSPITxFIFOConfig(SPI_BASE, MCSPI_TX_FIFO_ENABLE, SPI_CHAN);

 

    /* Enable the receiver FIFO of McSPI peripheral.*/   

    McSPIRxFIFOConfig(SPI_BASE, MCSPI_RX_FIFO_ENABLE, SPI_CHAN);

}     

 

unsigned char McSPI_TxRx(unsigned char tx)

{

       while(MCSPI_INT_TX_EMPTY(SPI_CHAN) != (McSPIIntStatusGet(SPI_BASE) & MCSPI_INT_TX_EMPTY(SPI_CHAN)));    

       McSPITransmitData(SPI_BASE, tx, SPI_CHAN);

     

       while(MCSPI_INT_RX_FULL(SPI_CHAN) != (McSPIIntStatusGet(SPI_BASE) & MCSPI_INT_RX_FULL(SPI_CHAN)));    

       return McSPIReceiveData(SPI_BASE, SPI_CHAN);

}

 

unsigned int SPI_Read(unsigned int addr)

{

     unsigned int ret=0;

     //McSPICSAssert(SPI_BASE, SPI_CHAN);    

     McSPIChannelEnable(SPI_BASE, SPI_CHAN);

 

    McSPI_TxRx(0x03);

    McSPI_TxRx((addr & 0x00FF0000)>> 16);  

    McSPI_TxRx((addr & 0x0000FF00)>> 8);

    McSPI_TxRx(addr & 0x000000FF);

 

    ret = McSPI_TxRx(0x00);

    ret |= McSPI_TxRx(0x00) << 8;  

   ret |= McSPI_TxRx(0x00) << 16;  

   ret |= McSPI_TxRx(0x00) << 24;

 

   // McSPICSDeAssert(SPI_BASE, SPI_CHAN);

    McSPIChannelDisable(SPI_BASE, SPI_CHAN);

 

    return ret;

 }

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

But When Code Execute, Has not been asserted to Low SPI_CS0 when using multi channel mode,

How to implement SPIEN(SPI0_CS0,SPI0_CS1) in the Multi-Channel Mode ??