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
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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.