I am porting code over to CCS5 and using the driverlib for MSP430F5436A microcontroller. While debugging and going into "privateUCSComputeCLKFrequency()" function the execution of
(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.
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.
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.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.