Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


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 ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner