• 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 » Microcontrollers » C2000™ Microcontrollers » C2000 32-bit Microcontrollers Forum » FSX control problem on McBSP as SPI master
Share
C2000™ Microcontrollers
  • Forums
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
C2000 Resources
  • Product Folder
  • C2000 Training Portal
  • C2000 Technical Training Catalog
  • C2000 Datasheets, App Notes, User Guides
  • C2000 Hardware Design Kits
  • controlSUITE for C2000 Software Library


  • InstaSPIN Resources
  • What is InstaSPIN?
  • Videos and Support


  • InstaSPIN-FOC and InstaSPIN-MOTION Resources
  • What is InstaSPIN-FOC?
  • What is InstaSPIN-MOTION?
  • Product Folder: F28069F, F28068F, F28062F, F28068M, F28069M
  • User’s Guide
  • Technical User’s Manual
  • Tools
  • FSX control problem on McBSP as SPI master

    FSX control problem on McBSP as SPI master

    This question has suggested answer(s)
    Adrien DES BOUILLONS
    Posted by Adrien DES BOUILLONS
    on Aug 09 2012 10:41 AM
    Intellectual350 points

    Hello

    I am using the McBSP in SPI master mode on my F28M35H52C1

    In my SPI communication I have to control three independants slaves.

    my CLKX and DX pins works perfectly

    but I don't understand how I can use the FSX pin to control three chips select.

    I tried to detect the end of each transmission by checking the XRDY register (in SPCR2) and "manually" change the state of my three output by controlling the GPIO, but it didn't work, the register apparently is not updated when the transmission is over.

    Could you help me ?

    Thanks in advance.

    Regards.

    Adrien

    McBSP SPI F28M35x chip select FSX
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Kris Parrent
      Posted by Kris Parrent
      on Aug 09 2012 13:17 PM
      Expert5985 points

      Adrien,

      Haven't tried this on the McBSP, but it should be somewhat similar to SPI.  I provided a few methods and an example here using the C28x SPI:

      http://e2e.ti.com/support/microcontrollers/tms320c2000_32-bit_real-time_mcus/f/171/t/171156.aspx#625809

      I think you will get the concept.. unfortunately, there is no seamless way to do it.  Could you tell us more about your application?  We have had numerous requests about this in the somewhat recent past, so we would like to understand the need.  Is this a field application, school project, etc?

      Thanks,

      Kris

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Adrien DES BOUILLONS
      Posted by Adrien DES BOUILLONS
      on Aug 09 2012 17:09 PM
      Intellectual350 points

      Kris,

      My application is a control panel for my company, it's an industrial R&D project.

      My application is quiet similar to this representation wherein the Master is my c2000 and the three slaves are three DAC. The connections between the components are identical in my project but I use the McBSP peripheral in SPI mode.

       

      I thought that with the FSX I could control by in an interruption (MXINTA) the chip selects. I configure XINTM = 2 to send XINT request to the CPU when each transmit frame-synchronization pulse is detected ; and in the interruption I control my chip select with the GPIO but I have some problems with that method.

      My real problem is how to detect when the transmission to a slave is over to switch the chip select ?

      Your application give a good way to implement my solution I will make some tests.

      I hope that my explanations are not too confusing.

      Regards

      Adrien

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Kris Parrent
      Posted by Kris Parrent
      on Aug 10 2012 15:05 PM
      Expert5985 points

      Adrien,

      Thank you for the application information.  This helps us evaluate if we need to make peripheral enhancements such as this.

      If you don't mind wasting a few GPIOs, here is another solution I didn't think of in the post I linked you to.  Tie the output of the slave select line which is controlled by the McBSP hardware to a GPIO configured as a XINT.  Set the XINT to generate an interrupt on a rising edge.  Before your transmission, set your GPIO slave select line for whichever device you are communicating to low, indicating that device is selected.  The McBSP generated slave select line will return high when the transmission is completed, generating a XINT interrupt to the CPU.  In this interrupt, just set all of your GPIO slave selects high (you can use an if statement, but probably takes as many or more cycles to figure out which is low).

      If you have the pins to spare, this is probably the easiest and least CPU intensive way.

      I'm not sure I followed your explanation.  If you could send some diagrams or waveforms or what you expect to happen that might help.  I'm not sure the frame sync signal is functional in SPI mode, but not entirely sure right off hand.  Might be misunderstanding you though.

      Kris

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Adrien DES BOUILLONS
      Posted by Adrien DES BOUILLONS
      on Aug 17 2012 10:28 AM
      Suggested Answer
      Intellectual350 points

      Kris,

      Apparently you are right, frame synchronisation is not functional in SPI mode.

      I implemented a way to control my chip select without the frame synchronisation.

      After writing into the buffer I wait until the XRDY flag toggle, then I wait an additional time to be sure that the transmission is over before switching my chipselect.

      "write in the buffer"

      while(!McbspRegs->SPCR2.bit.XRDY)

      {

               "chipSelect1 clear;"

      }

      for(waitCounter = 0 ; waitCounter < 24 ; waitCounter++) {}

      "chipSelect1 set;"

      This is not the best way to control the chipselect I guess but it works

      Regards

      Adrien.

      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