Hi,
I have been struggling with this issue for some time now and I thought I had found the solution, but I upgraded to CCS V5 from CCS V4 and the problem is back.
The problem is that when I run the project at 16MHz the project loops in a timer_delay function. If I revert back to 8 or 12 MHz the issue is no longer a problem. In CCS V4 I found the problem to be related to the optimization level of the compiler, the default was set as 0 and I selected the blank option. This solved my problem. Now though in CCS V5 I have performed the same optimization procedure and I am having no success getting the project to run past the timer delay function.
I read the device errata and implemented the work around for the dead DCO problem, but this had no affect. Any ideas?
Thanks
These are the two function that the code is hanging in (which by the way work fine under slower frequencies):
USHORT Timer_GetTime(void)
{
USHORT usTime;
// read a stable value from timer A register
do
{
usTime = TIMER_A_TAR;
}
while (usTime != TIMER_A_TAR);
return (usTime); // return the current time
}
void Timer_DelayTime(unsigned long usTimein10us)
{
USHORT usTime;
while (usTimein10us) // wait for given time
{
usTime = Timer_GetTime();
while(Timer_GetTime() - usTime < DELAY_10us);
usTimein10us--;
}