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 0 with BeagleBone

Other Parts Discussed in Thread: ADS1274, AM3359

I have been trying to get SPI0 up and running with my beaglebone. I have tried to follow the list in the StarterWare userguide (02_00_00_06 page 121-122). However i can't complete the first three steps, as these functions are not described in the API help. Do you know any workaround, or are these functions not a part of the API?

The first three steps (where i am failing) according to the StarterWare userguide.

  • Clocks for McSPI peripheral are enabled using the function McSPI0ModuleClkConfig()
  • Pin muxing for SPI_CLK, SPI_D0, SPI_D1 pins can be done by calling the function McSPIPinMuxSetup()
  • Pin muxing for chip select(CS) is done by using the function McSPI0CSPinMuxSetup()

Below is my SPI 0 init code so far:


void SPIinit()
{
    /*
    * Clocks for McSPI peripheral are enabled using the function McSPI0ModuleClkConfig()
    */
              // Not ready
    /*
    * Pin muxing for SPI_CLK, SPI_D0, SPI_D1 pins can be done by calling the function McSPIPinMuxSetup()
    */

       // Not ready
    /*
    * Pin muxing for chip select(CS) is done by using the function McSPI0CSPinMuxSetup()
    */
              // Not ready
    /*
    * McSPI is placed in local reset state by using McSPIReset() API
    */
    McSPIReset(SOC_SPI_0_REGS);

    /*
    *McSPI can be configured in 4-pin mode(CLK, D0, D1, CS) by using McSPICSEnable() API
    */
    McSPICSEnable(SOC_SPI_0_REGS);

    /*
    * McSPI is enabled in Master mode of operation using the McSPIMasterModeEnable() API
    */
    McSPIMasterModeEnable(SOC_SPI_0_REGS);

    /*
     *  To configure Single/Multi channel mode, transmit/receive modes and settings for IS, DPE0, DPE1 can be done by
     *    using the McSPIMasterModeConfig() API. The settings for IS, DPE0 and DPE1 will configure the direction for
     *    SPID0 and SPID1 pins as input or output. Please refer to the schematics to verify the SPI data pin connections
     *    and do the setting accordingly. This API will return “FALSE” if an invalid configuration is done for IS,DPE0 and
     *    DPE1 pins which the McSPI controller cannot process.
     */
    McSPIMasterModeConfig(SOC_SPI_0_REGS,MCSPI_MULTI_CH,
                          MCSPI_TX_RX_MODE,
                          MCSPI_DATA_LINE_COMM_MODE_0,
                          MCSPI_CHANNEL_0
                          );

    /*
    McSPI clock configuration is done using the McSPIClkConfig() API. Granularity settings of 1 clock cycle or 2^n
    clock cycles can be done in this API. Also phase and polarity of McSPI clock can be configured here.
    */
    McSPIClkConfig(SOC_SPI_0_REGS,
                   48000000,
                   6000000,
                   MCSPI_CHANNEL_0,
                   MCSPI_CLK_MODE_0
                   );
    /*
    *McSPI word length is configured using the McSPIWordLengthSet() API
    */
    McSPIWordLengthSet(SOC_SPI_0_REGS,MCSPI_WORD_LENGTH(8),MCSPI_CHANNEL_0);

     /*
     * Enable the required McSPI channel by using the McSPIChannelEnable() API. Once this API is called McSPI can
     * generate interrupts depending on the setting.
     */
    McSPIChannelEnable(SOC_SPI_0_REGS,MCSPI_CHANNEL_0);

}