2022-09-12 03:25 PM
Hello
I created a task that is needed to be executed from ISR. previously I did for ESP32 but using the same manner, I could not do it.
Based on my search, I found 2 ways which I tried but could not have my task run.
first manner:
Inside the ISR:
BaseType_t checkIfYeildRequired;
checkIfYeildRequired=xTaskResumeFromISR(ADXL_HandlerHandle);
portYIELD_FROM_ISR(checkIfYeildRequired);
Then first line of my task in for loop:
vTaskSuspend(NULL);
Second Manner:
BaseType_t pxHigherPriorityTaskWoken = pdFALSE;
vTaskNotifyGiveFromISR(ADXL_HandlerHandle , &pxHigherPriorityTaskWoken);
if ( pxHigherPriorityTaskWoken == pdTRUE) {
portYIELD_FROM_ISR(pxHigherPriorityTaskWoken);
Then first line of my task in for loop:
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
How I created the task outside of the main function as a global variable:
/
* Definitions for ADXL_Handler */
osThreadId_t ADXL_HandlerHandle;
const osThreadAttr_t ADXL_Handler_attributes = {
.name = "ADXL_Handler",
.priority = (osPriority_t) osPriorityNormal,
.stack_size = 1024 * 4
};
/* Definitions for Clock_Task */
osThreadId_t Clock_TaskHandle;
const osThreadAttr_t Clock_Task_attributes = {
.name = "Clock_Task",
.priority = (osPriority_t) osPriorityNormal,
.stack_size = 256 * 4
};
then inside main function:
/* creation of ADXL_Handler */
ADXL_HandlerHandle = osThreadNew(ADXL_Handler_TaskFun, NULL, &ADXL_Handler_attributes);
/* creation of Clock_Task */
Clock_TaskHandle = osThreadNew(Clock_Task_Fun, NULL, &Clock_Task_attributes);
osKernelStart();
Could you please tell me What I am supposed to ?
2022-09-25 09:22 AM
2022-09-25 02:29 PM
What is priority of TIM16 interrupt? Is it higher (smaller number) than the max. allowed interrupt priority for FreeRTOS calls?