FreeRTOS UART stop send

I wanna send data to a UART (motor controller) and when I test the software the UART stop to send in few seconds, I dont know why, but when I remove this part of the code:

enviado = sendDataUART(0x21,0,2); //Leemos la velocidad de motor 1 (izquierdo)
while(enviado == false)
{
enviado = sendDataUART(0x21,0,2);
}
enviado = sendDataUART(0x22,0,2); //Leemos la velocidad de motor 2 (derecho)
while(enviado == false)
{
enviado = sendDataUART(0x22,0,2);
}
enviado = sendDataUART(0x26,0,2); //Leemos la tensión
while(enviado == false)
{
enviado = sendDataUART(0x26,0,2);
}

it works fine. Could you tell me why? Thank you
Here is the complete code:

xSemaphoreHandle xSemaphore_UART;

static void vTaskSerialUSB( void *pvParameters )
{
boolean enviado;
portTickType xLastWakeTimeSerialUSB;
const portTickType xFrequencySerialUSB = 1000; // Ejecutamos la tarea cada 1000ms
xLastWakeTimeSerialUSB = xTaskGetTickCount(); // Initialise the xLastWakeTime variable with the current time.
for(;;)
{
vTaskDelayUntil(&xLastWakeTimeSerialUSB, xFrequencySerialUSB);
SerialUSB.print("encoder izq: ");
SerialUSB.print(encoder_izq_new);
SerialUSB.print("\t");
SerialUSB.print("encoder der: ");
SerialUSB.print(encoder_der_new);
SerialUSB.print("\t");
SerialUSB.print("x_enc: ");
SerialUSB.print(x_enc);
SerialUSB.print("\t");
SerialUSB.print("y_enc: ");
SerialUSB.print(y_enc);
SerialUSB.print("\t");
SerialUSB.print("teta_enc: ");
SerialUSB.print(teta_enc);
SerialUSB.print("\n");
enviado = sendDataUART(0x21,0,2); //Leemos la velocidad de motor 1 (izquierdo)
while(enviado == false)
{
enviado = sendDataUART(0x21,0,2);
}
enviado = sendDataUART(0x22,0,2); //Leemos la velocidad de motor 2 (derecho)
while(enviado == false)
{
enviado = sendDataUART(0x22,0,2);
}
enviado = sendDataUART(0x26,0,2); //Leemos la tensión
while(enviado == false)
{
enviado = sendDataUART(0x26,0,2);
}


static void vTaskPosCalc( void *pvParameters )
{
for(;;)
{
sendDataUART(0x32,0x08,3);
sendDataUART(0x31,0x08,3);
}

static void vTaskEncCount( void *pvParameters )
{
boolean enviado;
portTickType xLastWakeTimeEncCount;
const portTickType xFrequencyEncCount = 10; // Ejecutamos la tarea vTaskEncCount cada 10ms
xLastWakeTimeEncCount = xTaskGetTickCount(); // Initialise the xLastWakeTime variable with the current time.
for(;;)
{
vTaskDelayUntil(&xLastWakeTimeEncCount, xFrequencyEncCount);
enviado = sendDataUART(0x25,0,2); //Leemos la posición global de los encoders
while(enviado == false)
{
enviado = sendDataUART(0x25,0,2);
}
reading_enc = true;
xQueueReceive(xQueue_der, &encoder_der_new, 0);
xQueueReceive(xQueue_izq, &encoder_izq_new, 0);
odometer_thread();

}
}

//**********
//FUNCIONES
//**********
boolean sendDataUART(char command, char data, char numbytes)
{
xSemaphoreTake( xSemaphore_UART, ( portTickType ) 100 );
int numUnread=0;
int watchdog=0;
unsigned long time1;
unsigned long time2;
char buf[3];
buf[0] = 0x00;
buf[1] = command;
buf[2] = data;
Serial1.write(buf, numbytes);
if (command == 0x25) //LECTURA ENCODERS
{
time1 = millis();
do
{
numUnread = Serial1.available();
time2 = millis();
if(time2 > time1)
watchdog = time2-time1;
else
watchdog = 0xffffffff - time2 + time1;
}
while(numUnread < 8 || watchdog > 500);
if(watchdog > 500)
return false;
else
{
encoder_izq_old = encoder_izq_new; //guardo los viejos encoders en variables
encoder_der_old = encoder_der_new; //guardo los viejos encoders en variables
encoder_izq_new = 0;
encoder_der_new = 0;
for(int i = 0; i < 4; i++)
{
encoder_izq_new = encoder_izq_new + (Serial1.read() << (24-8*i));
}
for(int i = 0; i < 4; i++)
{
encoder_der_new = encoder_der_new + (Serial1.read() << (24-8*i));
}
xSemaphoreGive( xSemaphore_UART );
return true;
}
}
else if (command == 0x21 || command == 0x22 || command == 0x26 || command == 0x27 || command == 0x28)
{
time1 = millis();
do
{
numUnread = Serial1.available();
time2 = millis();
if(time2 > time1)
watchdog = time2-time1;
else
watchdog = 0xffffffff - time2 + time1;
}
while(numUnread < 1 || watchdog > 500);
if(watchdog > 500)
return false;
else
{
if(command == 0x21)
{
vel_izq = Serial1.read();
xSemaphoreGive( xSemaphore_UART );
return true;
}
else if(command == 0x22)
{
vel_der = Serial1.read();
xSemaphoreGive( xSemaphore_UART );
return true;
}
else if(command == 0x26)
{
volt_12v = Serial1.read();
xSemaphoreGive( xSemaphore_UART );
return true;
}
else if(command == 0x27)
{
curr_izq = Serial1.read();
xSemaphoreGive( xSemaphore_UART );
return true;
}
else if(command == 0x28)
{
curr_der = Serial1.read();
xSemaphoreGive( xSemaphore_UART );
return true;
}
}
}
xSemaphoreGive( xSemaphore_UART );
}


void odometer_thread()
{

}


void setup()
{
Serial1.begin(38400);
vSemaphoreCreateBinary( xSemaphore_UART );
xTaskCreate(vTaskSerialUSB, (const signed char *)"SerialUSB", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, NULL);
xTaskCreate(vTaskPosCalc, (const signed char *)"PosCalc", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, NULL);
xTaskCreate(vTaskEncCount, (const signed char *)"EncCount", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 3, NULL);
vTaskStartScheduler();
}

void loop()
{
// Insert background code here
}