• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » StarterWare » StarterWare forum » SPI 0 with BeagleBone
Share
StarterWare
  • Forum
Options
  • Subscribe via RSS

SPI 0 with BeagleBone

SPI 0 with BeagleBone

This question is answered
Bogi Magnussen
Posted by Bogi Magnussen
on Jun 21 2012 06:53 AM
Prodigy230 points
spi_init.c

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);

}

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Jeethan Castelino
    Posted by Jeethan Castelino
    on Jun 21 2012 08:11 AM
    Verified Answer
    Verified by Bogi Magnussen
    Prodigy630 points

    Hi Bogi

    The functions McSPI0ModuleClkConfig(), McSPIPinMuxSetup() and McSPI0CSPinMuxSetup() can be found in the platform folder of StarterWare package.

    However McSPI is not demonstrated(via sample example application) on beaglebone since SPI-Flash is not present on the beaglebone. However you could enable clocks and perform pin-mux by using the above mentioned functions used for EVM(Evaluation module which has SPI-Flash on it).

    You could find the McSPI platform file at this location "AM335X_StarterWare_02_00_00_06\platform\evmAM335x\mcspi.c"

    Regards

    Jeethan

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Bogi Magnussen
    Posted by Bogi Magnussen
    on Jul 13 2012 07:35 AM
    Prodigy230 points

    Hello Jeethan

    Thank you very much for you help. I found the functions in the library for the evmAM335x and i am now getting data from my TI ADS1274.

    Do you know why the SPI module forces very long pauses between each read? Looking at the oscilloscope it seems as if the MOSI line slowly "charges" up to the high level when done transmitting the last bit.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jeethan Castelino
    Posted by Jeethan Castelino
    on Jul 19 2012 10:41 AM
    Prodigy630 points

    Hi Bogi

    Can you post a new thread with your query? Because this thread/post is already marked "Answered" and hence it may not get the right attention!

    Also being from the software team we are not quite aware of the behaviour you are seeing. Hence we request you to post your query in the "AM335x Cortex A8 Microprocessors forum"

    Link for the above forum: http://e2e.ti.com/support/dsp/sitara_arm174_microprocessors/f/791.aspx

     

    Regards,

    Jeethan

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use