I have a configuration problem, I’m trying to adapt the atmega323 port -> to Atmega644 but
when I try to run 2 tasks does not work.
My code
#include <stdlib.h> #include <avr/interrupt.h>
#include “FreeRTOS.h” #include “task.h”
/*---------------------------------------
* Implementation of functions defined in portable.h for the AVR port.
*---------------------------------------*/
/* Start tasks with interrupts enables. */ #define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x01 ) /// ….> ??? ist a register?? or interrupt mask register??
I also change the code for prvSetupTimerInterrupt()
static void prvSetupTimerInterrupt( void )
{
unsigned long ulCompareMatch;
unsigned char 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 long ) 1;
/* Setup compare match value for compare match A. Interrupts are disabled
before this is called so we need not worry here. */
ucLowByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff );
ulCompareMatch >>= 8;
ucHighByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff );
OCR1AH = ucHighByte;
OCR1AL = ucLowByte;
// Generate tick pulses on PD5
//DDRD |= (1<<PD5);
TCCR1A = (0<<COM1A1) | (0<<COM1A0) // normal operation (or toggle OC1A = PD5 on compare match)
| (0<<COM1B1) | (0<<COM1B0) // normal operation
| (0<<WGM11) | (0<<WGM10); // CTC (together with WGM12 and WGM13)
// TOP is OCR1A
/* Setup clock source and compare match behaviour. */
// ucLowByte = portCLEAR_COUNTER_ON_MATCH | portPRESCALE_64;
// TCCR1B = ucLowByte;
TCCR1B = (0<<ICNC1) | (0<<ICES1) // Noise Canceler: Off
| (0<<WGM13) | (1<<WGM12)
| (0<<CS12) | (1<<CS11) | (1<<CS10); // no prescaler, source = sys_clk
TCCR1C = (0<<FOC1A) | (0<<FOC1B); // reserved in PWM, set to zero
/* Enable the interrupt - this is okay as interrupt are currently globally
disabled. */
ucLowByte = TIMSK;
ucLowByte |= portCOMPARE_MATCH_A_INTERRUPT_ENABLE;
TIMSK = ucLowByte;
}