I installed a fresh copy of Ubuntu 20.04, and Arduino IDE1.8.16. At the beginning adding user to dialout
group enabled uploading sketch to Aruino AVR family, and ESP32, but still ESP8266 gives this error:
Sketch uses 260889 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 27980 bytes (34%) of dynamic memory, leaving 53940 bytes for local variables. Maximum is 81920 bytes.
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____
Traceback (most recent call last):
File "/home/guy/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/upload.py", line 66, in <module>
esptool.main(cmdline)
File "/home/guy/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool/esptool.py", line 3552, in main
esp.connect(args.before, args.connect_attempts)
File "/home/guy/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool/esptool.py", line 529, in connect
raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
So I tried to erase flash using esptool.py
:
guy@desktop:~$ esptool --chip auto --port /dev/ttyUSB0 erase_flash
esptool.py v2.8
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____
A fatal error occurred: Failed to connect to Espressif device: Timed out waiting for packet header
Since AVR's and ESP32 work properly using USB's and ACM's I can guess that is is not a problem with the ability to access serial comm.
What might it be ?
1 Answer 1
There is something wrong with some new kernels of Ubuntu 20.04 LTS, interfering with ESP8266 core uploading process
5.4.0-88-generic #99-Ubuntu SMP Thu Sep 23 17:29:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
I had the same issue and downgraded the kernel to
5.4.0-86-generic #97-Ubuntu SMP Fri Sep 17 19:19:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
solved the issue
The issue happens to ESP8266 core uploading process, with the following tested Ubuntu cores
linux-5.11.0-37-generic
linux-5.4.0-89-generic
linux-5.4.0-88-generic
and tested OK with
linux-5.11.0-38-generic
linux-5.11.0-36-generic
linux-5.8.0-48-generic
linux-5.4.0-90-generic
linux-5.4.0-86-generic
Temporarily fix
To temporarily fix the issue by using working kernel, e.g. linux-5.4.0-86-generic
A. Select from GNU GRUB boot menu
Advanced options for Ubuntu
- Ubuntu, with Linux 5.4.0-86-generic
If you don't have that kernel, install by
sudo apt install linux-image-5.4.0-86-generic
- Reboot and select
5.4.0-86-generic
from GNU GRUB boot menu
To save the selected GRUB settings
More info GRUB Simple-configuration
- Edit
/etc/default/grub
by
$ sudo gedit /etc/default/grub
- Add to the file
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
- Activate the change so that last selected value is used for the next boot.
$ sudo update-grub
Update
Just testing OK with latest kernel
linux-5.11.0-38-generic
linux-5.4.0-90-generic
It seems recent kernel release has fixed the issue