cancel
Showing results for 
Search instead for 
Did you mean: 

Could not read the Interrupt Priority after vTaskStartScheduler()

ebast
Associate II

Hi All,

I want to use NVIC_GetPriority(DMA1_Channel4_IRQn) function with FreeRtos. I can use this function before the vTaskStartScheduler(); but, when I call NVIC_GetPriority(DMA1_Channel4_IRQn) function after vTaskStartScheduler();, it does not work do you have any suggestion?

#include <FreeRTOS.h>
#include <queue.h>
#include <task.h>
/* -- */
static void vTest_NVIC( void *pvParameters )
{
 tprintf("\r\nTask Started..."); 
  /* -- */
  while(1) {
    /* -- */   
    taskENTER_CRITICAL();  
    tprintf("\r\npriority= %d",NVIC_GetPriority(DMA1_Channel4_IRQn));	
    taskEXIT_CRITICAL();
 	vTaskDelay(3000);;		
  }
}
int main()
{
  portBASE_TYPE xReturn;		
  /* -- */
  xReturn = xTaskCreate ( vTest_NVIC, ( const signed portCHAR * const )"Test_NVIC", configMINIMAL_STACK_SIZE<<4, NULL, tskIDLE_PRIORITY, NULL );
  if( xReturn != pdPASS ) {
    tprintf("\n\rTest_NVIC initilisation problem.\n\r");
  }
  
  NVIC_InitTypeDef NVIC_InitStructure;
  NVIC_SetPriorityGrouping(3);
  /* DMA1 Channel4 interrupt setting */
  NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel4_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 11;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);	
  
  tprintf("\r\npriority= %d",NVIC_GetPriority(DMA1_Channel4_IRQn));   
  /* Now all the tasks have been started - start the scheduler. */
  vTaskStartScheduler();

The output of the program is like that.

priority= 11
 
Task Started...

Do you have any suggestions? thanks from now

0 REPLIES 0