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.

msp430 f5529 clock configuration

Other Parts Discussed in Thread: MSP430WARE

Hi

how would i configure my DCO clock to 1MHZ in an f5529?

i need to do this from g2553 to f5529

WDTCTL = WDTPW + WDTHOLD;                      // Stop watchdog timer
DCOCTL = 0x00;                               // Set DCOCLK to 1MHz
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;

  • Juan,

    I strongly recommend you use the 430ware Driver Library functions included in CCS for DCO configuration.  You can find an example project that configures the clock system for a 12MHz DCO that can be easily changed to whatever frequency you want.  In the TI Resource Explorer, navigate to MSP430ware -> Libraries -> Driver Library -> MSP430F5xx_6xx -> Example Projects -> UCS -> ucs_ex1_DCO12MHz for this example.

    Also please note that the default configuration is approximately 1MHz (its actually just a little faster than that, but is very close).

    Mike

  • Just to add, the F5xx devices do not have calibration constants like the 2xx devices do, so clock configuration is somewhat trickier, but provides for significantly more options/configurations.

    Mike

  • hi mike and thanx for the quick response!

    i did open that example but it looks a bit complicated, i should say im new to microcontrollers.

    maybe if i tell you what i am trying to acomplished you will guide me in the right direction.

    im using this code for my g2553 that i found online:

    http://homepages.ius.edu/RWISMAN/C335/HTML/msp430SerialComm.htm

    and it works flawlessly, however when i run it with the f5529 it does not.

    i understand that i cannot just switch microcontrollers and expect it to work:

    so, i found out the pin and bits of the UART functionality of the f5529 and modified it.
     as well as some other macros that were not detected by CCS

    HOWEVER the only thing that gives me compilation errors is the initialization of the clocks

    any advice??  i need help ASAP

      

  • Juan,

    Sections of code are portable between devices as long as the peripherals used are the same between devices.  For example, the the G2553 and the F5529 you are referencing both have a USCI peripheral to do UART.  While the pins used are not the same between devices, it is fairly straightforward to port UART code.  However, the clocking systems are substantially different.  The G2553 has a BCS (Basic Clock System) peripheral to handle clocks while the F5529 uses the UCS (Unified Clock System).  These modules are different enough that code cannot be ported, and you must write new code to achieve the same outcome on the other device.

    This is where MSP430ware's driverlib comes into play.  It provides high level software abstraction to achieve basic goals like set the clocks to run MCLK (and the device) at 1MHz.  The example I pointed you to might seem complicated at first, but it is actually very simple.  Walk through the code, line by line, looking at the comments to determine what each line does.  Use the driverlib APIs (also found in the TI Resource Explorer in the driverlib section if you need more information about a function.  If you have questions about what the function is doing, reference the users guide and datasheet for the part.  For example, one of the first functions in the program has the result (according to the comment) of setting ACLK to REFO.  What is happening is pretty straightforward, but if you are not sure what ACLK or REFO is, a quick search of the users guide reveals that ACLK is the (generally lower frequency) Auxiliary Clock to the peripherals and REFO is an "internal, trimmed, low-frequency oscillator with 32768 Hz typical frequency, with the ability to be used as a clock reference into the FLL."

    If you walk through the driverlib code line by line like this, it becomes very easy to follow and then use in your project.

    Mike

  • Mike Pridgen said:
    the G2553 and the F5529 you are referencing both have a USCI peripheral to do UART

    But the 2x family USCI and the 5x family USCI have some differences. The registers for the interrupt flags and the usage of interrupt vectors are different, so code isn't easily portable even though it might compile without error.

    BTW, 1MHz is the default frequency of the 5x family, FLL-stabilized by the internal calibrated REFO. So if really only 1MHz are required, nothing is to do at all.

  • Jens-Michael Gross said:
    The registers for the interrupt flags and the usage of interrupt vectors are different

    This is true.  I was just suggesting that they are similar enough that code is fairly easily portable not that they are exactly the same (sorry if my original statement wasn't clear on that).  If interrupts are used, its just a matter of changing the interrupt vectors and the source register for the flags.  This probably explains why in this case, the UART portion of the code compiled on F5xx even though it was written for G2xx.

    Also, the default DCO is ~1.045MHz, which is close enough to 1MHz for most use cases.

    Mike

  • Mike Pridgen said:
    I strongly recommend you use the 430ware Driver Library functions included in CCS for DCO configuration.

    I strongly recommend Mike's suggestion. Setting the clocks up is much easier when using the MSP430ware DriverLib API.

    We have examples for doing this in the Getting Started with the MSP430 Workshop. Check out Chapter 4: MSP430 Clocks & Initialization. While we try to explain how clocking works on all the MSP430 devices, the lab solutions take you through setting up the clocks on the 'F5529 Launchpad. Hopefully this is just what you're looking for.

    You can find this workshop on its wiki page: http://processors.wiki.ti.com/index.php/Getting_Started_with_the_MSP430_LaunchPad_Workshop


    Scott

  • thank you guys

  • I have a quick question, can the MSP430 USB CDC Application Examples can be used with an F5529 launchpad ?

    this seems to have examples on exactly what im trying to accomplish, which is communication with my host PC and be able to send my transmit my info to be able to save it on a text file.

  • Mike Pridgen said:
      If interrupts are used, its just a matter of changing the interrupt vectors and the source register for the flags

    Problem is that both, RX and TX, are joined into one ISR on 5x family. This requires restructuring the code of the ISR (except for I2C, where most people never used the second ISR for status changed anyway)
    I'm surprised that the code did compile, as the vector name(s) are different too. Well, perhaps coincidentally :)

    Mike Pridgen said:
    the default DCO is ~1.045MHz, which is close enough to 1MHz for most use cases.

    It's 1.045MHz on 2x family. This is 4.5% off (and that's just a typical value), which is almost a the edge of the allowed RS232 baudrate tolerance for both peers (+-5%).

    It might work, and in most cases will, but if it doesn't work, nobody knows whether it is the code or the hardware. Well, adjusting the baudrate divider isn' t more complex than setting the calibration values - if there are any.

    However, in 5x family, the default is 31*(32768+-3.5%) = 1.016MHz. Or is it (31+1)*(32768+-3.5%)=1.049MHz? Which would be further off. The users guide is a little bit ambiguous here (text vs. register description).
    Well, I used this myself for serial communication on a plain vanilla breakout board with a 5438. It worked, most of the time, but this was while experimenting. I wouldn't risk using this setup for series production.

  • Juan Gomez3 said:
    can the MSP430 USB CDC Application Examples can be used with an F5529 launchpad ?

    Absolutely, the USB examples in the USB Developers Package in Driverlib can be used with the F5529 Launchpad.

    Mike

**Attention** This is a public forum