• 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 » MSP430™ Microcontrollers » MSP430 Ultra-Low Power 16-bit Microcontroller Forum » Can the SPI of MSP430F5328 run with a 25MHz clock?
Share
MSP430™ Microcontrollers
  • Forum
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
MSP430 Resources
  • MSP430 Product Folder
  • MSP-EXP430G2 - MSP430 LaunchPad Value Line Development kit
  • MSP430 Getting Started Guide
  • MSP430 Microcontroller Projects
  • More Resources >
  • Forums

    Can the SPI of MSP430F5328 run with a 25MHz clock?

    This question is not answered
    Felix76837
    Posted by Felix76837
    on Jul 23 2012 10:31 AM
    Prodigy100 points

    I use the MSP-TS430RGC64B EVM board. I want to estimate the max SPI speed of MSP430F5328.I choose the USCI_A0 as SPI Master,and USCI_A1 as SPI slave.and i use Dupont line to connect the used pins.I configure XT2 (25MHz clock) as SPI clock,and devide 1.here is my spi intialize source code.

    GPIO_setAsPeripheralModuleFunctionOutputPin(__MSP430_BASEADDRESS_PORT3_R__,
    GPIO_PORT_P3,
    GPIO_PIN3
    );
    GPIO_setAsPeripheralModuleFunctionInputPin(__MSP430_BASEADDRESS_PORT3_R__,
    GPIO_PORT_P3,
    GPIO_PIN4
    );
    GPIO_setAsPeripheralModuleFunctionOutputPin(__MSP430_BASEADDRESS_PORT2_R__,
    GPIO_PORT_P2,
    GPIO_PIN7
    );

    ret = SPI_masterInit(__MSP430_BASEADDRESS_USCI_A0__,
    SPI_CLOCKSOURCE_SMCLK,
    25000000,
    SPICLK,
    SPI_LSB_FIRST,
    SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT,
    SPI_CLOCKPOLARITY_INACTIVITY_HIGH);

    SPI_enable(__MSP430_BASEADDRESS_USCI_A0__);
    SPI_enableInterrupt(__MSP430_BASEADDRESS_USCI_A0__,SPI_RECEIVE_INTERRUPT);

    GPIO_PORT_P4,
    GPIO_PIN4
    );
    GPIO_setAsPeripheralModuleFunctionInputPin(__MSP430_BASEADDRESS_PORT4_R__,
    GPIO_PORT_P4,
    GPIO_PIN5
    );
    GPIO_setAsPeripheralModuleFunctionInputPin(__MSP430_BASEADDRESS_PORT4_R__,
    GPIO_PORT_P4,
    GPIO_PIN0
    );

    ret = SPI_slaveInit(__MSP430_BASEADDRESS_USCI_A1__,
    SPI_LSB_FIRST,
    SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT,
    SPI_CLOCKPOLARITY_INACTIVITY_HIGH
    );

    SPI_enable(__MSP430_BASEADDRESS_USCI_A1__);

    SPI_enableInterrupt(__MSP430_BASEADDRESS_USCI_A1__,
    SPI_RECEIVE_INTERRUPT
    );

    Delayus(100);

    I have set the core voltage level as 3.if  SPICLK  = 12500000 ,Master's transmitting and receiving data is correct. But if SPICLK  =  25000000 ,Master's transmitting data is correct while recieving data has a shift error. if Master transmits 0x66, slave gets 0xCC. Can MSP430F5328's spi can run with a 25Mhz clock? or what i configure is wrong?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Jason Work
      Posted by Jason Work
      on Jul 23 2012 17:11 PM
      Expert7495 points

      Felix76837

      I want to estimate the max SPI speed of MSP430F5328.

      Here's how to calculate the max. SPI speed that your applictaion is capable of:
       
      1) From the MSP430 (master) data sheet record the Tvalid,mo and Tsu,mi
       
      2) For the MSP430 (slave), record the Tsu,si and Tvalid,so
       
      3) The max bit rate is calculated as:
       
      Fmax = 1/ [2* max ( Tvalid,mo(msp430-master) + Tsu,si(msp430-slave) OR Tsu,mi(msp430-master) + Tvalid,so(msp430-slave))]
       
      Assuming both master and slave are 430s this works out to more than 7 Mbps (using MSP430F5328).
       
      For the USCI module, the max SPI bit clock is BRCLK, so you will need to use a clock source of >3MHz for the SPI clock to achieve this data rate.
       
      Also I would recommend running MCLK at a higher frequency, keeping Vcc at 3V, PMMVCORE = 3, and using DMA to move bytes into the TX Buffer (ensuring that the SPI transmit interrupt flags are not subject to interrupt priority/latency).
       
      The good news is that the USCI is capable of back-to-back SPI transfers, meaning you can load the SPI TXBUF with a byte while the previous byte is being moved onto the bus.
       
      All this being said, it is important to understand the system and how SPI is prioritized when compared to other application tasks.

      2502.spiFmax.xlsx

      Max SPI
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Jens-Michael Gross
      Posted by Jens-Michael Gross
      on Jul 24 2012 14:16 PM
      Guru140135 points

      Felix76837
      transmitting data is correct while recieving data has a shift error.

      A shift error usually has nothing to do with the baudrate. There are two things that can produce a shift error:

      first, the phase or clock polarity can be mismatched. Assuming identiucal setup on both sides (both an USCI MSP), thsi shouldn't be an issue.

      The othe rproblem is lack of synchronization.

      SPI is a bitstream. There is no strt or stop bit synchronizing the byte borders. This synchronization is done by the chip select line (do not confuse this with the STE signal). By pullign the CS pin low (this is a software controlled GPIO operation on both sides) the slave knows that the master is ready to start a transfer. The slave then has to ensure that it is ready to receive. Also, when CS goes high, the transfer ended, no matter where it stands now. THis can be mid-byte. The slave msu thten reset its SPI controller, so the next CS low starts with a fresh new byte.

      If this isn't handled properly, the slave may erraneously take the port pin initialization of the master for a clock signal and already latch-in the first bit. And all following bits are then one bit off.

      So the master pulls CS low, the slave detects this and then clears the SWRST bit of the USCI. And when CS goes high, the slave will detect this too and set SWRST.

      _____________________________________
      Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.
      If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.

      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