• Not Answered

driverlib issue

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?

2 Replies

  • 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.

    _____________________________________

    Time to say goodbye - I don't have the time anymore to read and answer forum posts. After falling behind by two months (900 threads), there's no point in continuing. See my bio for details.

    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.

  • In reply to Jens-Michael Gross:

    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.