Software Timers -> xTimerStart(), xTimerStop()

I’m working with Arduino Mega (ATmega2560) and FreeRTOS. My question is: “How to start a timer, stop it and again start this timer ?”
The idea of project is to create a timer, start it, and while CallBack function is executing many times a temperature sensor store data in a buffer. When buffer is full I want to stop timer, then pass data to serial interface, and then start timer again. I try to start timer again but it doesn’t work right. How to do this ?

#include <Arduino_FreeRTOS.h>
#include <timers.h>


TimerHandle_t xAutoReloadTimer;
BaseType_t xTimerStarted, xTimerStopped;

void setup() {
  Serial.println("Create a Timer");
   xAutoReloadTimer = xTimerCreate(
      "AutoReload",                    // name of the timer
      mainAUTO_RELOAD_TIMER_PERIOD,    // period of timer (timer after which timer's callback function will be called)
      pdTRUE,                          // set timer to pdTRUE to create an auto-reload timer
      0,                               // timer unique ID
      prvAutoReloadTimerCallback);     // pointer to software timer's callback function
  Serial.println("Timer Created");
  if( xAutoReloadTimer != NULL ) {

void loop() {
  // put your main code here, to run repeatedly:


void prvAutoReloadTimerCallback( TimerHandle_t xTimer ) {
  TickType_t xTimeNow;
  xTimeNow = xTaskGetTickCount();
  Serial.print("Auto-reload timer callback executing ");
  Serial.println( xTimeNow/62 );
  if (xTimeNow/62 == 10) {
    /* pass data to serial interface and start timer again */
    /* Here I just print some on serial interface */
    for (int i = 0; i < 10; i++){
    //startTimer(); // is not working good

void startTimer() {
  xTimerStarted = xTimerStart( xAutoReloadTimer, 0 );
        if( xTimerStarted == pdPASS )
          Serial.println("Timer started");
          Serial.println("start scheduler");

void stopTimer() {
  xTimerStopped = xTimerStop(xAutoReloadTimer, 0);
  if (xTimerStopped == pdPASS){
    Serial.println("Timer Stoped");
    xTimerStarted = pdFAIL;

It’s better to keep timer callbacks short an more important non-blocking.
The callbacks should have minimal influence to the behavior of the timer task.
Instead think about just signaling the timer event to a task doing the real work.

BTW What is vTaskEndScheduler good for ?