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

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