Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

[Atmega32] second tick hangs on a task with the same priority as others

Posted by rafaeladel on January 19, 2016

I'm a beginner at FreeRTOS, I've wrote a simple application that turn on and off between two leds (each task turns a led on and turn off the other).

The problem is i've wrote the two tasks but the schedular puts a task in running and switch to the other and stops at this task without switching again.

Maybe i've missunderstood how it works. So please help would be appreciated. This is the code i've written

~~~~

define F_CPU 8000000UL
include
include "freertos/FreeRTOS.h"
include "freertos/task.h"
include "freertos/FreeRTOSConfig.h"

void taskone(void *pvParameters); void tasktwo(void *pvParameters);

int main(void) { DDRC = 0xff; xTaskCreate(taskone, NULL, 50, NULL, 1, NULL); xTaskCreate(tasktwo, NULL, 50, NULL, 1, NULL); vTaskStartScheduler(); return 0; }

void task_one(void *pvParameters) { while(1) { PORTC = 0x0f; } }

void task_two(void *pvParameters) { while(1) { PORTC = 0xf0;

}

} ~~~~


[Atmega32] second tick hangs on a task with the same priority as others

Posted by edwards3 on January 19, 2016

Do you know the task is still running ok and not just crashed? What code is executing when you pause the debugger? Does the xTickCount variable in tasks.c increment still?


[Atmega32] second tick hangs on a task with the same priority as others

Posted by rafaeladel on January 19, 2016

Can you tell me how to check this, please ? I'm trying to access xTickCount via xTaskGetCount(), But don't know how to check it. Tried printing it on LCD but nothing's showing up. (LCD is working and code its tested).


[Atmega32] second tick hangs on a task with the same priority as others

Posted by edwards3 on January 19, 2016

How do you know the code is running still?


[Atmega32] second tick hangs on a task with the same priority as others

Posted by rafaeladel on January 19, 2016

I've tried converting xTaskGetCount() to string and print it on LCD. Here's what I got: 1. xTickCount starts at 0 -> Tasktwo fires. xTickCount becomes 1 -> Taskone fires. xTickCount stops counting afterwards ! 2. When I put xTaskDelay(1) inside the two tasks. xTickCount increments normally beyond 1 but still it hangs on one task without switching back and fourth.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists