Quality RTOS & Embedded Software

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


Loading

FreeRTOS cannot start up.

Posted by The_YongGrand on October 25, 2011
Dear FreeRTOS support,

I've made a stripped down program with the RTOS for the processor PIC32MX320F128H with a blinking LED for a test.

However, it refuses to start at all. Is there any thing I need to put inside for a bare essential RTOS to work?

Thanks.

Here's the code:
#pragma config POSCMOD=XT, FNOSC=PRIPLL
#pragma config FPLLIDIV=DIV_2, FPLLMUL=MUL_18, FPLLODIV=DIV_1
#pragma config FPBDIV=DIV_2, FWDTEN=OFF, CP=OFF, BWP=OFF

#include
#include

#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "croutine.h"
#include "timers.h"


void UART1_Init();
void UART1_putc(unsigned char);
void UART1_puts(unsigned char*);

static void prvSetupHardware( void );
static void prvCheckTask( void *pvParameters ) __attribute__((noreturn));
static void vLEDTask(void* pvParameters);
const portTickType smallDelay = 500 / portTICK_RATE_MS;

unsigned long i = 0;

int main()
{
prvSetupHardware();
xTaskCreate(vLEDTask, "LED", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL );
vTaskStartScheduler();
return 0;
}

void UART1_Init()
{
U1BRG = 77;
U1MODE = 0x8008;
U1STAbits.UTXEN = 1;
U1STAbits.URXEN = 1;
}

void UART1_putc(unsigned char inputc)
{
while(U1STAbits.UTXBF);
U1TXREG = inputc;
}

void UART1_puts(unsigned char* string)
{
while(*string)
UART1_putc(*string++);
}

static void prvSetupHardware( void )
{
AD1PCFG = 0xFFFF; //All pins as Digital
DDPCONbits.JTAGEN = 0; //Disable the JTAG port
SYSTEMConfigPerformance(72000000);
mOSCSetPBDIV(OSC_PB_DIV_2);
INTEnableSystemMultiVectoredInt();
TRISE = 0x0000;
PORTE = 0x0000;
PMCONbits.ON = 0;
}

static void vLEDTask(void* pvParameters)
{
for(;;)
{
PORTEbits.RE0 ^= 1;
vTaskDelay(1000);
}
}


The LEDTask is to toggle the LED for each second, but it didn't even start.

Thanks for the support.

RE: FreeRTOS cannot start up.

Posted by Richard on October 25, 2011
Did you start with the preconfigured demo provided in the FreeRTOS download, or create this from scratch?
Are the UART functions in the above code ever called in your stripped down demo?
How do you know it is not starting? If you step through the code in the debugger, how far does it get? What happens?
Have you tried your LED accessing code without the RTOS, or from main() before the RTOS is started?

Regards.

RE: FreeRTOS cannot start up.

Posted by The_YongGrand on October 25, 2011
Hello there,

Thanks for your prompt reply.

I create this from scratch, and adding the FreeRTOS includes and Cs to the project.

The UART functions are not called. It will be used later if I manage to start the RTOS successfully.

The debugger didn't get through anything else. I suspect it's not even working.

I tried the "accessing LED code" and it works well. Only thing is getting the RTOS started is a real challenge to me. I will not give up though, it's a learning process. :)

Thanks for the help.

RE: FreeRTOS cannot start up.

Posted by The_YongGrand on October 25, 2011
Apologies for double posting. Can't edit the previous post.

Apparently I simulated it, but when I put a breakpoint on "PORTEbits.RE0 ^= 1;", the MPLAB SIM just runs and runs without ever halting on that place.

When I placed a breakpoint on the "return 0", it immediately points on that.

Is it some stack overflow error according to the documentations?

Thanks.


[ 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