Freertos counting semaphore

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using  FreeRTOS V9.0.0rc1 on ATMEGA32 with clock of 1159200Hz, on AVR STUDIO 7. I try to use counting semaphore in timer2 (32Khz external crystal) interrupt to handle to task. But both task run at different speed even when both having same  priority. I think this is due to stack overflow.????? (Please see attachment)


My program doing this,


1. Timer 2 initialized in asynchronous mode for 1 sec interrupt.  

2. Couting semaphore is created using "xSemaphoreCreateCounting" function.

3. Start_task1 is start counter "g" and run in 600ms

4. display_task is for displaying counter form interrupt handler task "d" and "h" on LCD screen, run in 300ms

5. When interrupt come (1sec), it give semaphore to  handler_task1,  handler_task2

6. handler_task1 take semaphore form interrupt and increment counter "h"

7. handler_task2 take semaphore form interrupt and increment counter "d"


The problem is both handler task run at different speed. For example when handler_task1 couner reach 200, handler_task2 counter at 5. Even some time display hang


So please help to solve this.........     




Last Edited: Sun. Mar 27, 2016 - 03:21 PM