anonymous wrote on Friday, February 12, 2010:
I am going to add a bit more background:
I am using the barebones experimenter board - MSP-TS430PZ5x100
There is a single LED on the board hooked up to pin P1.0 (which is also the ACLK out if set to CLK out)
I am using the port John from westmorelandengineering.com put up on his site. I had to cut a lot of the extra stuff out as his port was for a slightly different board (same chip!). Mainly just cut out code for an LCD and such stuff.
I scoped P1.0 and played with some of the various settings
- the led flash rate
and some other, but I soon found a very specific behaviour
If I remove the vTaskDelayUntil call, the led blinks at a fixed rate no matter what I set the RTOS tick rate to. It blinks at 400Khz
If I keep it in, the led blink rate is only affected by the xFlashRate…not the RTOS Tick rate.
So I set xFlashRate to 10, 20 , 30 , 40 (I removed the xFlashRate = ledFLASH_RATE_BASE; xFlashRate /= portTICK_RATE_MS; ).
ie, the actual rate the RTOS ticks is not being set by the configTICK_RATE_HZ.
So I am thinking its a configuration of either the Timer, or my ACLK……
I hope this is clear!
Here is the timer and clock setup snippets.
static void InitClockSystem(void)
WDTCTL = WDTPW+WDTHOLD; // Stop WDT
P7SEL |= 0x03; //Set the XT1 port to Xtal functions
UCSCTL6 = XT2OFF + XCAP_2 + XT1DRIVE_3; //Set Startup mode for the Xtal
UCSCTL1 = DISMOD; // See errata UCS4
UCSCTL0 = 0x00; // Set lowest possible DCOx, MODx
UCSCTL1 = DCORSEL_6; // Select range for 8MHz operation
UCSCTL2 = 486; // Set DCO Multiplier for 8MHz
// (N + 1) * FLLRef = Fdco
// (243 + 1) * 32768 = 8MHz
UCSCTL3 = SELREF_0; // Set DCO FLL reference = XT1CLK
UCSCTL4 = SELA_0 + SELS_3 + SELM_3; // Set ACLK = XT1CLK, SMCLK & MCLK = DCOCLK
// Loop until XT1 & DCO stabilizes
while ((SFRIFG1 &OFIFG))
UCSCTL7 &= ~(XT1LFOFFG + DCOFFG); // Clear XT1,DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear fault flags
UCSCTL6 &= ~(XT1DRIVE_3); // Xtal is now stable, reduce drive strength
SFRIE1 = OFIE; // Enable osc fault interrupt
// #warning "clocks are outputted to port 11" //Test purpose pins
// P11DIR |= 0x07; // ACLK, MCLK, SMCLK set out to pins
// P11SEL |= 0x07; // P11.0,1,2 for debugging purposes.
void prvSetupTimerInterrupt( void )
/* Ensure the timer is stopped. */
TA1CTL = 0;
/* Run the timer of the ACLK. */
// TACTL = TASSEL_1|CNTL_0|ID_0; // use ACLK as 32768;
TA1CTL = TASSEL1|ID0; // use ACLK as 32768;
/* Clear everything to start with. */
TA1CTL |= TACLR;
/* Set the compare match value according to the tick rate we want. */
TA1CCR0 = ( portACLK_FREQUENCY_HZ / configTICK_RATE_HZ ) - 1;
/* Enable the interrupts. */
TA1CCTL0 = CCIE;
/* Start up clean. */
TA1CTL |= TACLR;
/* Up mode. */
// TACTL |= TASSEL_1 | MC_1 | CNTL_0 | ID_0;
TA1CTL |= TASSEL1 | MC1 | ID0;