kd5uwl wrote on Saturday, October 10, 2009:
Kafes,
Sorry, I found your direct emails in my spam folder. I’ve now replied to you directly.
To anyone following along here, it was the Timer1 setup that needs attention, not Timer2 like I said before.
Here are the pertinent sections of port.c - this is what worked for my 1284p:
/*---------------------------------------
* Implementation of functions defined in portable.h for the AVR port.
*---------------------------------------*/
/* Start tasks with interrupts enables. */
#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x80 )
/* Hardware constants for timer 1. */
#define portCLEAR_COUNTER_ON_MATCH ( ( unsigned portCHAR ) 0x08 )
#define portPRESCALE_64 ( ( unsigned portCHAR ) 0x03 )
#define portCLOCK_PRESCALER ( ( unsigned portLONG ) 64 )
#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE ( ( unsigned portCHAR ) 0x02 )
And then further down, in the function called " prvSetupTimerInterrupt":
static void prvSetupTimerInterrupt( void )
{
unsigned portLONG ulCompareMatch;
unsigned portCHAR ucHighByte, ucLowByte;
/* Using 16bit timer 1 to generate the tick. Correct fuses must be
selected for the configCPU_CLOCK_HZ clock. */
ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
/* We only have 16 bits so have to scale to get our required tick rate. */
ulCompareMatch /= portCLOCK_PRESCALER;
/* Adjust for correct value. */
ulCompareMatch -= ( unsigned portLONG ) 1;
/* Setup compare match value for compare match A. Interrupts are disabled
before this is called so we need not worry here. */
ucLowByte = ( unsigned portCHAR ) ( ulCompareMatch & ( unsigned portLONG ) 0xff );
ulCompareMatch >>= 8;
ucHighByte = ( unsigned portCHAR ) ( ulCompareMatch & ( unsigned portLONG ) 0xff );
OCR1AH = ucHighByte;
OCR1AL = ucLowByte;
/* Setup clock source and compare match behaviour. */
ucLowByte = portCLEAR_COUNTER_ON_MATCH | portPRESCALE_64;
TCCR1B = ucLowByte;
/* Enable the interrupt - this is okay as interrupt are currently globally
disabled. */
ucLowByte = TIMSK1;
ucLowByte |= portCOMPARE_MATCH_A_INTERRUPT_ENABLE;
TIMSK1 = ucLowByte;
}
/*---------------------------------------*/
#if configUSE_PREEMPTION == 1
/*
* Tick ISR for preemptive scheduler. We can use a naked attribute as
* the context is saved at the start of vPortYieldFromTick(). The tick
* count is incremented after the context is saved.
*/
//void SIG_OUTPUT_COMPARE1A( void ) __attribute__ ( ( signal, naked ) );
void TIMER1_COMPA_vect( void ) __attribute__ ( ( signal, naked ) );
//void SIG_OUTPUT_COMPARE1A( void )
void TIMER1_COMPA_vect( void )
{
vPortYieldFromTick();
asm volatile ( "reti" );
}
#else
/*
* Tick ISR for the cooperative scheduler. All this does is increment the
* tick count. We don’t need to switch context, this can only be done by
* manual calls to taskYIELD();
*/
//void SIG_OUTPUT_COMPARE1A( void ) __attribute__ ( ( signal ) );
void TIMER1_COMPA_vect( void ) __attribute__ ( ( signal ) );
// void SIG_OUTPUT_COMPARE1A( void )
void TIMER1_COMPA_vect( void )
{
vTaskIncrementTick();
}
#endif
Note also in the above that I commented out signals like this:
// void SIG_OUTPUT_COMPARE1A( void )
and replaced with singals like this:
void TIMER1_COMPA_vect( void )
I don’t know if this is "right", but it’s working for me. 
That is, everything but the serial demo - wish I could get that working.
73, kd5uwl