Quality RTOS & Embedded Software

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


Loading

first project usig FreeRTOS with PIC32MX

Posted by chaabanemalki on January 29, 2014

Hello,

I really need some help here, with my first attemp to blink a LED inside a simple task,

I'm using pic32MX795F512L, and I checked the configuration fuses without FreeRTOS kernel, everything works fine.

then i used the demo provided with the FreeRTOS download to make my own code, here is the small code that i create

define LEDR_SYSTEM LATCbits.LATC1 // inverse

static void prvSetupHardware( void ); portBASE_TYPE TaskValid ;

void vTask1(void *pvParameters) {

     portTickType xLastWakeTime;
     char toggle;
     xLastWakeTime = xTaskGetTickCount();

     for(;;)
     {
             if(toggle ==1)

LEDRSYSTEM = 0, toggle = 0; else LEDRSYSTEM = 1, toggle = 1;

vTaskDelayUntil(&xLastWakeTime,(10000/portTICKRATEMS)); }

}

void main( void ) {

TRISCbits.TRISC1 = 0;

     TaskValid = xTaskCreate(vTask1,"Task 1",1000,NULL,1,NULL);


     vTaskStartScheduler();


     for(;;);

}

So I had a clean build for this code and ofcourse nothing working on the board, yet i noticed when i start debugging that the debugger tells me that the breakpoint in the line "portTickType xLastWakeTime;" in the task function is not valid, here is the exact error i'm getting

Break point at line 82 in file C:/****/main.c cannot be resolved to a valid program memory address*

and i'm getting the same error in each line inside the vTask1 function

I think that the function xTask1 function doesn't exist in the program memory, and some how the code failed to create it.

I checked the return value of the xTaskCreate and it is equal to 1, which means that the task was created successfully

another thing that i noticed is about the parameters portTICKRATEMS, i followed it's definition and here what i found

define portTICKRATEMS ( ( portTickType ) 1000 /

configTICKRATEHZ )

define configTICKRATEHZ ( ( portTickType ) 1000 )

That's mean portTICKRATEMS is equal to 1 ?, is that normal ? cause i'm not sure yet whether the portTICKRATEMS is defined and calculated by default or it is the programmer job.

I Really appreciate any help from you guys, cause i have like 10 days to integrate a GPS module in FreeRTOS


first project usig FreeRTOS with PIC32MX

Posted by rtel on January 29, 2014

configTICKRATEMS is the tick rate, in ms. Therefore, if your tick frequency is 1000, then there is one tick every ms to make the 1000 ticks in a second, so 1 is the expected value. The latest FreeRTOS version in SVN has renamed the constant configTICKPERIODMS (with backward compatibility maintained so configTICKRATEMS is #defined to configTICKPERIODMS so both work).

Did you start your project by adapting the existing MPLAB X project found in the FreeRTOS download? There is a build configuration for the pic32MX795, the following page shows how to select it - http://www.freertos.org/portPIC32MIPS_MK4.html

I would suggest starting with that, with mainCREATESIMPLEBLINKYDEMOONLY set to 1, that will give you a very simple two task example that is configured correctly for your part.

Once you have that building and running you can replace the two tasks with your own task, and take it from there.

Regards.

Attachments

alternate (6362 bytes)


[ 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