title: OTA for esp32 using ethernet checksum failed
body: <p>I'm using <em>Atmega2560</em> connected to Ethernet module to get binary file of <em>Esp32</em> then send the file through UART to Esp32 to update it's firmware.</p>
  
  <p>I'm trying to get binary file data through Ethernet module using HttpClient library but when the data stored in Esp32 OTA partition, then I'm getting:</p>
  
  <pre><code>esp_image: Checksum failed . Calculated 0xad read 0x0
  </code></pre>
  
  <p>When i checked some of the received data from the binary file before being sent to esp32, i can see that some location have <code>0x0</code> instead of the right value it should be.</p>
  
  <p>That's part of my code where i read the binary file and sent it to Esp32.</p>
  
  <pre><code>EthernetClient transport;
  HttpClient client(transport, SERVER, SERVER_PORT);
  Serial.print("Check for update file ");
  Serial.println(PATH);
  client.get(PATH);
  int statusCode = client.responseStatusCode();
  Serial.print("Update status code: ");
  Serial.println(statusCode);
  if (statusCode != 200)
  {
  client.stop();
  return;
  }
  long bin_length = client.contentLength();
  if (bin_length == HttpClient::kNoContentLengthHeader) {
  client.stop();
  Serial.println("Server didn't provide Content-length header. Can't continue with update.");
  return;
  }
  Serial.print("Server returned update file of size ");
  Serial.print(bin_length);
  Serial.println(" bytes");
  ESPSerial.print(String(bin_length)); //send file size to ESP
  delay(10000);
  byte data_char;
  int counter=0;
  while (bin_length &gt; 0)
  {
  if (!client.readBytes(&amp;data_char, 1)) // reading a byte with timeout
  break;
  ESPSerial.write(data_char); //here send data to esp32
  if(bin_length==0||bin_length==1||bin_length==2){Serial.print("last data=");Serial.println(data_char,HEX);}
  counter++;
  if(counter==1000)
  {
  Serial.println(bin_length);
  counter=0;
  delay(100);
  }
  bin_length--;
  }
  client.stop();
  if (bin_length &gt; 0)
  {
  Serial.print("Timeout downloading update file at ");
  Serial.print(bin_length);
  Serial.println(" bytes. Can't continue with update.");
  return;
  }
  </code></pre>
  
  <p>Anyone could help me with this problem?</p>