I am working with atmega128. I am using FreeRTOS v10.4.1. I have created two tasks with the same priority and tested them on Proteus , but the switching between two tasks occurred just one time and did not repeated again. I have configUSE_PREEMPTION and configUSE_TIME_SLICING set to 1 in FreeRTOSConfig.h.
#include <avr/io.h>
#define F_CPU 8000000
#include <util/delay.h>
#include "FreeRTOS.h"
#include "task.h"
void task_1(void *pv);
void task_2(void *pv);
int main(void)
{
DDRA = 1;
DDRB = 1;
xTaskCreate(task_2,"task2",85,NULL,2,NULL);
xTaskCreate(task_1,"task1",85,NULL,2,NULL);
vTaskStartScheduler();
}
void task_1(void *pv)
{
while(1)
{
PORTA ^= 1;
_delay_ms(50);
}
}
void task_2(void *pv)
{
while(1)
{
PORTB ^= 1;
_delay_ms(50);
}
}