Threads cant do execution of timer

Hi All!
I ve got some problem with execution of timer
Its can do an execution only when threads suspended
I need to read vaule from LTC4151 every 1 sec
Here my init and code:
"


/* Definitions for tmrInitLTC */
osTimerId_t tmrInitLTCHandle;
const osTimerAttr_t tmrInitLTC_attributes = {
  .name = "tmrInitLTC"
};
 tmrInitLTCHandle = osTimerNew(tmrLTCCallback, osTimerPeriodic, NULL, &tmrInitLTC_attributes);

/* LTC4151 reading*/
void tmrLTCCallback(void *argument)
{

  /* USER CODE BEGIN tmrInitPpmCallback */
	if(tmrstatus & 0x01)
	{
		tmrstatus = 0x03;
		vTaskResume(I2CcommHandle);
	}
	if ((xTimerGetPeriod(tmrInitLTCHandle) / portTICK_PERIOD_MS) > 1000) {
			xTimerChangePeriod(tmrInitLTCHandle, 1000 / portTICK_RATE_MS, portMAX_DELAY);
	}
  /* USER CODE END tmrInitLTCCallback */


}


reading value by threads:


 osThreadId_t I2CcommHandle;
const osThreadAttr_t I2Ccomm_attributes = {
  .name = "I2CComm",
  .stack_size = 128 * 12,//4,
  .priority = (osPriority_t) osPriorityBelowNormal,
};

"
Please help how to distribute threads and timer execution, I didnt find how priorities can be here the reason
Thanks

The first thing I notice is that you are mixing two different APIs. You start with calling osTimerNew which would be some sort of generic OS wrapper file, which might or might not return a FreeRTOS Timer handle, and then you give it to some xTimer… functions which are FreeRTOS direct functions. Unless the wrapper explicitly says you can do this, you should be using the wrapper functions for the latter operations, or the direct FreeRTOS call for the first.

I didn’t fully understand what the problem exactly is.
Is the timer not expiring resp. is the callback not in invoked as expected ?
But did you setup the FreeRTOS timer task prio as highest in your application as recommended (as rule of thumb) ?
If there is an other task with a higher prio busy running (without waiting/blocking for some event) the timer tasks can’t run an do it’s job.

Thanks yo all for your support!
I change timer to x (cut os timer)and nothing solved
Now my code is

void vTimerCallback(TimerHandle_t pxTimer);


/* Software timer definitions. */
#define configUSE_TIMERS                         1
#define configTIMER_TASK_PRIORITY                1//( 2 )
#define configTIMER_QUEUE_LENGTH                 10
#define configTIMER_TASK_STACK_DEPTH             256

 tmrInitLTCHandle = xTimerCreate("Timer1", (1000 / portTICK_RATE_MS), pdTRUE, (void * )1, vTimerCallback);

xTimerStart(tmrInitLTCHandle, portMAX_DELAY);


/* LTC4151 reading*/
void vTimerCallback(TimerHandle_t tmrInitLTCHandle)

	 {
	  int32_t lArrayIndex; 	 
	  	   configASSERT( tmrInitLTCHandle);  
	      lArrayIndex = ( int32_t ) pvTimerGetTimerID( tmrInitLTCHandle );
			if(lArrayIndex==1)
			{
				if(tmrstatus & 0x01)
					{
						tmrstatus = 0x03;
						vTaskResume(I2CcommHandle);
					}
			}



}

Still cant start, also wanted to notice on my other threads, there are:


/* Definitions for networkInit */
osThreadId_t networkInitHandle;
const osThreadAttr_t networkInit_attributes = {
  .name = "networkInit",
  .stack_size = 384 * 4,
  .priority = (osPriority_t)  osPriorityHigh,
};
/* Definitions for uartM3gProc */
osThreadId_t uartM3gProcHandle;
const osThreadAttr_t uartM3gProc_attributes = {
  .name = "uartM3gProc",
  .stack_size = 256 * 4,
  .priority = (osPriority_t) osPriorityNormal,
};

/* Definitions for TCPProc */
osThreadId_t TCPProcHandle;
const osThreadAttr_t TCPProc_attributes = {
  .name = "TCPProc",
  .stack_size =384 * 10,//8,//4,
  .priority = (osPriority_t) osPriorityNormal,
};

/* Definitions for uartPpmProc */
osThreadId_t uartPpmProcHandle;
const osThreadAttr_t uartPpmProc_attributes = {
  .name = "uartPpmProc",
  .stack_size = 256 * 8,//4,
  .priority = (osPriority_t) osPriorityNormal,
};
/* Definitions for logging */
osThreadId_t loggingHandle;
const osThreadAttr_t logging_attributes = {
  .name = "logging",
  .stack_size = 128 * 4,
  .priority = (osPriority_t) osPriorityBelowNormal,
};
/* Definitions for logging */
osThreadId_t loginiHandle;
const osThreadAttr_t logini_attributes = {
  .name = "logini",
  .stack_size = 128 * 8,
  .priority = (osPriority_t) osPriorityBelowNormal,
};

osThreadId_t I2CcommHandle;
const osThreadAttr_t I2Ccomm_attributes = {
  .name = "I2CComm",
  .stack_size = 128 * 12,//4,
  .priority = (osPriority_t) osPriorityBelowNormal,
};


/* Definitions for uartPpmTx */
osThreadId_t uartPpmTxHandle;
const osThreadAttr_t uartPpmTx_attributes = {
  .name = "uartPpmTx",
  .stack_size = 128 * 8,//4,
  .priority = (osPriority_t) osPriorityNormal,
};
/* Definitions for uartM3gTx */
osThreadId_t uartM3gTxHandle;
const osThreadAttr_t uartM3gTx_attributes = {
  .name = "uartM3gTx",
  .stack_size = 128 * 8,//128 * 4,
  .priority = (osPriority_t) osPriorityNormal,
};

/* Definitions for TCPTx */
osThreadId_t TCPTxHandle;
const osThreadAttr_t TCPTx_attributes = {
  .name = "TCPTx",
  .stack_size = 384 * 12,//128 * 4,
  .priority = (osPriority_t) osPriorityNormal,
};

/* Definitions for TCPip */
osThreadId_t mtcpConHandle;
const osThreadAttr_t mtcpCon_attributes = {
  .name = "mtcpCon",
  .stack_size = 384 * 4,
  .priority = (osPriority_t) osPriorityNormal,
};

/* Definitions for quStatusCode */
osMessageQueueId_t quStatusCodeHandle;
const osMessageQueueAttr_t quStatusCode_attributes = {
  .name = "quStatusCode"
};
/* Definitions for quMsgLog */
osMessageQueueId_t quMsgLogHandle;
const osMessageQueueAttr_t quMsgLog_attributes = {
  .name = "quMsgLog"
};
/* Definitions for quMsgPpm */
osMessageQueueId_t quMsgPpmHandle;
const osMessageQueueAttr_t quMsgPpm_attributes = {
  .name = "quMsgPpm"
};

//* Definitions for quTCP */
/*osMessageQueueId_t quTCPHandle;
const osMessageQueueAttr_t quTCP_attributes = {
  .name = "quTCP"
};*/

/* Definitions for quMsgM3g */
osMessageQueueId_t quMsgM3gHandle;
const osMessageQueueAttr_t quMsgM3g_attributes = {
  .name = "quMsgM3g"
};
/* Definitions for tmrInitPpm */
osTimerId_t tmrInitPpmHandle;
const osTimerAttr_t tmrInitPpm_attributes = {
  .name = "tmrInitPpm"
};


/* Definitions for tmrInitLTC */
/*osTimerId_t tmrInitLTCHandle;
const osTimerAttr_t tmrInitLTC_attributes = {
  .name = "tmrInitLTC"
};
*/
TimerHandle_t tmrInitLTCHandle;
/* Definitions for tmrAuth */
osTimerId_t tmrAuthHandle;
const osTimerAttr_t tmrAuth_attributes = {
  .name = "tmrAuth"
};

Do they able to work within sheduler and OS?
I thought what whey do
But now I didnt understand
Maybe somebody can provide an example of os timer?

Thanks in advance!!!

There are lots of examples of using timers in the main FreeRTOS download and in the book. No point providing more here.

It is still not clear what your problem is. It sounds like your timer works as expected if all the other threads are suspended, but not otherwise. Is that the case? If so, then unsuspend one task at a time until you find the one that stops the timer executing as expected. I am going to guess the offending task has a priority above the priority you are assigning to the timer task, and is using 100% CPU time to starving the timer task of any execution time.

I recommended giving the timer task the highest prio in you’re application. Prio 1 is just 1 above the lowest prio 0.
Try #define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
It might be confusing to mix those osPriority priorities with normal values except you know exactly their meaning/values.

Thanks for your replay, I did what you said, and still dont understand, I just returned to the begining) And cant find the point how I can set priorities of os or x timers(
Examples dont cover it

Thnanks, Itried to change proities of timer in cmsis source but it ginen nothing
And now I confused in values of proirites. I thought what 0 is the hiest priority likein NVIC priorities settings

For Tasks, 0 is the lowest priority, the Idle task is at priority 0.
For Interrupts, the order depends on the processor, for Cortex M series, 0 is the highest priority, but this is backwards from what many other processors do.

Now I use only xTimer API but still can execute timer withing additional threads
Also I cant understand what numeric value is the hiest priority of timer
My problem is in the folowing
I Add thread which receive queue value with the lowestnormal priority and timer stop to execute
All combination of timer numeric priority values didnt get any

Timers don’t have priorities, and all run inside the Timer task. Timers can signal other tasks to tell them to act. Timer callback functions generally should be very quick, and shouldn’t block.

I am unable to understand what these two lines mean. Can you provide some minimal code example to help me understand?