Counting semaphore of freertos hang atmega 32

Status
Not open for further replies.

samic45mit1

Member level 3
Joined
Dec 11, 2009
Messages
62
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
indore
Activity points
1,815
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. I try how use counting semaphore in freertos



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

Attachments

  • main.txt
    6.5 KB · Views: 61

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…