I use the FreeRTOS port for the PIC32 microcontroller on the PIC32MX starter kit. Just played with tasks, but tasks were not context switching. Here are my basic configuration settings:
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) #define configKERNEL_INTERRUPT_PRIORITY 0x01 #define configMAX_SYSCALL_INTERRUPT_PRIORITY 0x03 #define configTICK_RATE_HZ ( ( portTickType ) 100 )
Now I have two tasks that are flashing with two LEDs. Both have priority 4 (highest). During normal operation, the LEDs should flash alternately for every 100 ticks. But this does not happen. The second LED flashes for 100 ticks, and control passes to the general exception handler. Why is this happening? There seems to be no planning at all.
FreeRTOS - , , , . , , . .
, - (, ), .
, , , , - . , .
, , "" . , , #pragma, PIC32.., "".
№1 : . , .
, " ", MPLAB void vPortIncrementTick( void ) ( 177 FreeRTOS\Source\portable\MPLAB\PIC32MX\port.c) . , .
void vPortIncrementTick( void )
? - ( )?
, . , A , A , A , B . , , (, , ).
, , :
for (;;) { led(on); sleep(delay); led(off); sleep(delay); }
... , . , :
for (;;) { led(on); led(off); }
( , , , , , - , .)
, ?
- :
xTaskCreate( yourFirstTask, "firstTask", STACK_SIZE, NULL, TASK_PRIORITY, NULL ); xTaskCreate( yourSecondTask, "secondTask", STACK_SIZE, NULL, TASK_PRIORITY, NULL ); vTaskStartScheduler();
, , , .
, FreeRTOS/Demo/Common/Minimal/flash.c. , , PIC32 ( Microchip Explorer16).
In its simplest form, a task that simply switches and the LED every 500 ms will look like this:
/* Standard task prototype, the parameter is not used in this case. */ void vADummyTask( void *pvParameters ) { const portTickType xDelayTime = 500 / portTICK_RATE_MS; for( ;; ) { ToggleLED(); vTaskDelay( xDelayTime ); } }
Source: https://habr.com/ru/post/1795228/More articles:Why is O (N Log N) creating a binary search tree? - binary-treeSet response encoding using HttpClient 3.1 - javaMigration of working .each (... change ()) to .each (.live ("change ...")) does not work jQuery - jqueryAndroid: understanding remapCoordinateSystem function - androidWhat is the best way to provide online video that also works on iPhone / iPad? - html5Does it make sense to use expression-based access control in Spring Security? - springHow can I make sure that the file comes from the phone to the server without being tampered with? - androidDrawing circle with Breshenem algorithm on OpenGL - c ++column restriction that uses user-defined function (udf) - sqlintellij maven output link - intellij-ideaAll Articles