title: How receive data with HAL_UART?
body: <p>I'm learning about the STM32. I'm want receive data by UART byte-to-byte with interruption. </p>
  
  <pre><code>HAL_UART_Receive_IT(&amp;huart1, buffer, length)
  </code></pre>
  
  <p>Where &amp;huart1 is my uart gate, buffer is the input storage and length is the amount of input bytes. I use the following function to read data</p>
  
  <pre><code>static requestRead(void *buffer, uint16_t length)
  {
      uint8_t teste;
      while (HAL_UART_Receive_IT(&amp;huart1, buffer, length) != HAL_OK) osDelay(1);
      //HAL_UART_RxCpltCallback
  }
  </code></pre>
  
  <p>I store my data in:</p>
  
  <pre><code>void StartDefaultTask(void const *argument)
  {
      char sender[] = "Alaska Sending\n";
      uint8_t receive[10];
      uint8_t data[30];
  
      for (;;)
      {
          uint8_t i = 0;
          memset(data, 0, 30);
  
          requestRead(&amp;receive, 1);
          data[i++] = receive;
  
          while (data != '\r')
          {
              requestRead(&amp;receive, 1);
              data[i++] = receive;
          }
  
          //HAL_UART_Transmit(&amp;huart1, data, i, HAL_MAX_DELAY);
  
      }
      /* USER CODE END StartDefaultTask */
  }
  </code></pre>
  
  <p>My problem is the value receive and store. When I send by serial a string of character as <strong>Welcome to Alaska\n</strong>, only W is read and stored, then I need send again the buffer and again just store only W. How solve this?</p>