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.

Beginner: standard commands - undefined

Other Parts Discussed in Thread: MSP430F5438A

Hi,

i am a beginner in programming the MSP430F5438A, using CCS5.
i already managed to run the first samples successfully.
now i tried to set the DCO-freq, and found some different sources with the following code:

// Set system DCO to 8MHz
BCSCTL1 = CALBC1_8MHZ;
DCOCTL = CALDCO_8MHZ;
// Set LFXT1 to the VLO @ 12kHz
BCSCTL3 |= LFXT1S_2;

but the compiler says:

identifier "BCSCTL1" is undefined
identifier "CALBC1_8MHZ" is undefined
identifier "DCOCTL" is undefined
identifier "CALDCO_8MHZ" is undefined
identifier "BCSCTL3" is undefined
identifier "LFXT1S_2" is undefined

what is the problem here?
those registers seem to be standard and used by many different persons!?
do i have to implement any special libraries?

the datasheet doesn´t help me, because i cannot find a register with the specific settings for different frequencies..
DCORSELx only specifies ranges .... very confusing :o) !?

thanks for your help!

  • Daniel Rumetshofer said:

    identifier "LFXT1S_2" is undefined

    what is the problem here?

    Perhaps you missed to include some .h file?

  • this might be the problem, but i cannot find any infos, which .h file contains this infos!?
    most people seem to use this commands without any special includes!?

    i use just the 
    #include <msp430f5438a.h>

  • If you are using CCS 5, you can access example code written for your board that I found very helpful when first starting out. You can use them to compare to the code you have written, and include any header files they have to make sure you haven't forgotten anything.

    To access them, go to Project => CSS Example Projects. Click on the family you have, then code examples, and find the chip you are using.

    Since changing the DCO speed is a frequently used tool for a number of projects, you are sure to find helpful information after only looking at a few projects. And you may just find something else that is useful to you too.

  • i had been looking for those well documented examples which i already found in former times :o)

    studying the ti-examples for my chip helped me to find the correct registers and settings! thanks aslobear.

    but that is insane - the registers and the settings are completly different from the most tutorials which are written for smaller MSP430´s! thats really bad! 
    so you have to find a beginners-tutorial for your particular chip-typ!?

  • The names vary between chips. I have only found this from checking out other example code on these forums, since I have only used the MSP4320G2553. But after the naming conventions are worked out, it all is mostly the same. Just be sure to check the family users guide/data sheets & example codes

    No problem!

  • Daniel Rumetshofer said:
    identifier "BCSCTL1" is undefined

    No wonder. BCSCTL1 is a register of the basic clock system and the basic clock system+ (BCS+). Found in 1x and 2x family. The 5438A is (as the name indicates) a member of the 5x family and has an universal clock system (UCS). It doesn't have these registers nor doe the registers of the UCS have the same meaning and usage.

    Daniel Rumetshofer said:
    identifier "CALBC1_8MHZ" is undefined

    The 5x family has a reference oscillator and an FLL mechanism for stabilizing the DCO. None of the 5x MSPs has DCO calibration constants anymore nor are they needed.

    Daniel Rumetshofer said:
    identifier "LFXT1S_2" is undefined

    This is a bitfield in the BCS+ registers and not present in the UCS registers.

    In other words: your code tries to use registers and mechanisms that are not present in the MSP you use.

    This brings me back to my complaint about the use of the MSP430.h include, which obfuscates for which MSP the code was originally designed.

    Daniel Rumetshofer said:
    DCORSELx only specifies ranges

    Because each DCO in each individual MSP responds with a different frequency output to the same software settings. This is why 2x family comes with calibration values and 4x/5x/6x family uses an FLL mechanism to adjust the DCO.

    If you read the UCS chapter of the 5x family users guide (or any other family, as the DCO itself is more or less the same in all of them), you'll learn how the DCO works and why calibration or FLL are required for a stable and known frequency output.