1
votes

I'm trying to upload the example Blink code to my ESP8266 modules, 1 of which is an ESP8266-07, the other a WeMos D1 mini PRO. I've installed the library for the ESPs according to online instructions. I'm uploading from Ubuntu 16.04, Arduino 1.8.9. I've also made sure to use sudo chmod 666 /dev/ttyUSB0.

I've tried uploading both through a normal USB cable and through a USB-TTL board, both of which made no difference. My Tools > Board settings are "Generic ESP8266 module" for the ESP8266-07 and "LOLIN(WEMOS) D1 mini Pro" for my mini Pro. In all 4 cases (2 different boards, 2 uploading cables/gateways), I've got the same error message.

raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for package header

I've also tried uploading the code to my Node MCU, in which case, I got a different error:

esptools.FatalError: Invalid head of package (0x46)
2

2 Answers

2
votes

I've resolved the problems with the ESP8266-07 and D1 mini Pro by changing the upload speed to 115200.
Another important thing to note is to set the right boards: "Generic ESP8266 module" for the ESP8266-07 and "LOLIN(WEMOS) D1 mini Pro" for the mini Pro. I sometimes forget to do so when changing between the 2 boards.
However, I haven't yet resolved the problem where my NodeMCU keeps returning esptool.FatalError: Invalid head of packet (0x46)

0
votes

There are a few different things to check for troubleshooting:

  • Check what your serial devices are enumerating as. They may be showing up as /dev/ttyACM* rather than /dev/ttyUSB0

  • Add your user to the dialout group

    sudo usermod -a -G tty yourUserName
    sudo usermod -a -G dialout yourUserName
    
  • Are you attempting to program through a USB hub? Those sometimes cause strange power issues that interfere with programming devices. If so, try plugging in directly to a primary USB port.