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.

driverlib issue

Other Parts Discussed in Thread: MSP430F5436A

I am porting code over to CCS5 and using the driverlib for MSP430F5436A microcontroller. While debugging and going into "privateUCSComputeCLKFrequency()" function the execution of

"----------------------------------------

case SELM__XT2CLK:

CLKFrequency =

(XT2ClockFrequency / CLKSourceFrequencyDivider);

"----------------------------------------

gives a truncated result. The "XT2ClockFrequency" is 3686000 and "CLKSourceFrequencyDivider" is 1. So the result in "CLKFrequency" should be 3686000, but I am getting 15984. Is there any any setting in the CCS5 that I am missing?

  • 3686000 is 0x383e70. 15984 is 0x3e70. Seems like CLKFrequency is a 16 bit variable only.

    Maybe its purpose is using it in a 16 bit register later (e.g. a counter). So any result that exceeds 65535 is too much anyway.

    But it's also possible that just the debugger shows a wrong value, interpreting CLKFrequency as 16 bit variable where it indeed is 32 bit.

    That's why I try to not use libraries wher eit is not really necessary. They are usually introducing unnecessary overhead, are slower than optimized code, and even if the documentation is really good (and it often isn't), there's still some doubt whether it really does what one thinks it should.

  • I did check the variable sizes as that was my first doubt.

    CLKFrequency is defined as "unsigned long CLKFrequency;" in function "privateUCSComputeCLKFrequency()".

    I feel like there are some optimization setting need to be changed in the driverlib project and recompiled to resolve the issue.

    I agree the driverlib for 5xx/6xx seem to be not stable at this point. 

**Attention** This is a public forum