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

Atmega8 + FreeRTOS + PWM

Posted by misiekg on November 5, 2009
Hello,

I have problem with cooperating of those 3 as I wrote in the title. I Set up FreeRTOS with 2 tasks(one blinking diode and sending data to another task, second getting data and showing on lcd).

It is in small robot and I need in the future get ADC readings, proceed them and move engines using PWM.

The problem is that when I use PWM everything goes wrong. Task stop communicating and I get strange captions on LCD. If I switch off PWM, when task send/get data one engine is movin a little... I can post my code here if it would help.

Thank you very much in advance for help.

RE: Atmega8 + FreeRTOS + PWM

Posted by MEdwards on November 5, 2009
Sounds like the pwm code is bad, or using it in a task is causing some sort of corruption (stack overflow being most likely). Is the PWM using an interrupt or is it completely autonomous?

RE: Atmega8 + FreeRTOS + PWM

Posted by misiekg on November 6, 2009
Here is my pwm code. I use first init pwm in main, and then setPwm():

void initPwm ()
{
TCNT1 = 0;
OCR1A = 0;
OCR1B = 0;

TCCR1A = _BV(COM1A1)| _BV(COM1B1)| _BV(WGM11)| _BV(WGM10);
TCCR1B = _BV(CS10);
}

void setPwm(int le, int re)
{
if ( le < 0)
le = 0;
if (le > 800)
le = 800;
if (re < 0)
re = 0;
if (re >800)
re = 800;

OCR1A = re;
OCR1B = le;
}

Is FreeRTOS using timer? Maybe it uses my timer1, which I use for PWM?

Thanks for your reply.

RE: Atmega8 + FreeRTOS + PWM

Posted by misiekg on November 6, 2009
Even if I don't initialize PWM and don't set values it sensds signal to the pin connected to bridge while comunicating tasks.


[ 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