Getting error on uploading code into esp8266 nodemcu by Arduino - arduino

Recently I bought a esp8266 nodemcu for my project.
For running the blink code, I followed this tutorial esp8266 quick start.
But ended up with this :
Sketch uses 246,319 bytes (23%) of program storage space.Maximum is 1,044,464 bytes.
Global variables use 32,276 bytes (39%) of dynamic memory, leaving 49,644 bytes for local variables.Maximum is 81,920 bytes.
Uploading 250464 bytes from C:\Users\test\AppData\Local\Temp\build544514107263874658.tmp/arduinowifi.cpp.bin to flash at 0x00000000
.error: failed sending 1044 bytes
error: failed sending 0xC0
warning: espcomm_send_command: didn't receive command response
warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed
error: failed sending 0xC0
error: failed sending 8 bytes
error: failed sending 4 bytes
error: failed sending 0xC0
warning: espcomm_send_command: didn't receive command response
error: espcomm_upload_mem failed
I tried with different baud rate but failed.
Arduino IDE: 1.6.5 and 1.8.5
OS: Windows 10 and Ubuntu 16.04LTS
Update: Solved after using USB HUB.

The problem may come from circuit breakdown. I have this problem today and solved by following. Jump D3 (or GPIO00) to GND (if your PC still can see port). However, GPIO0 is set to OUTPUT/HIGH by default and may cause excessive current consumption. To prevent board fail, 1K resister may add between GPIO0(D3) and GND. Plug module power and upload program. Sometimes, please remember that you may need to unplug and plug module every new upload.
For another method,direct program to chip, use FTD232 (switch jumper to 3.3V) connect between FTD232 and NodeMCU like as Vcc(check it is 3.3V):3.3V , Tx:Rx, Rx:Tx, Gnd:Gnd, Gnd:D3. (you may use on board GND to D3)
Plug and upload. if the second method cannot work your ESP8266 IC may be gone.
As mention above, if your ESP8266 set GPIO0 as OUTPUT/HIGH, ground it may damage chip. Make sure that you
1) unplug power before ground GPIO0 (or add a resister)
2) power it and upload
3) remove GPIO0 when enter upload to prevent short out the output when program start to run.

First, you have to install the driver for the nodeMCU! You can get it here:
https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
And then go to control panel->devices and check if your system detects the nodeMCU.
Next go to preferences and add the board to Arduino IDE
Next disconnect and reconnect (just for confirmation) to verify if a led(blue usually) blinks upon connection.
After these steps, then go to Arduino IDE and select the board as ESP -12E module
Set the programmer as AVRiSP mk ll
And then compile and upload!

Related

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x00)

I tried all the google solutions, It seems like RST button doesn't actually reset. Just red led blinking all the time, and no serial output or anything I'm working on Windows 10, ESP32 Dev Module ,on COM4 ,Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 115200, None.
I tried with different esp it works
Sketch uses 204738 bytes (15%) of program
storage space. Maximum is 1310720 bytes.
Global variables use 13416 bytes (4%) of
dynamic memory, leaving 314264 bytes for
local
variables. Maximum is 327680 bytes.
esptool.py v3.0-dev
Serial port COM4
Connecting........_____....._____....._____....._____....._____....._____....._____
`
A fatal error occurred: Failed to connect
to ESP32: Invalid head of packet (0x00)
I normally upload at 921600. Your settings look perfect, it is working very well for me. Try the following -
If the Serial pins(Rx/Tx) are connected anywhere, disconnect/unplug them.
Keep the boot button on hold while it is trying to connect.
Change the USB port. If you are using hardware debuggers, zadig can mess things up.
I have faced similar issues, the above mentioned ones have always solved it. Choosing wrong board also results in this issue, I tried ESP-01, ESP-03 or other smaller boards with this setting and faced this. So make sure you are using exactly the ESP32 dev module and not anything else.
I had this problem, turns out I didn't have the proper USB driver installed.
SiLabs CP2104 Driver
Hope this helps someone in the future.

ESP32 Cam: A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

I have an ESP32-Cam AIThinker and everytime I try to upload (File > Examples > ESP32 > Camera), I always get this error everytime: A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header.
I've been following YouTube tutorials but none just seem to work for me :(
Here are my upload settings. At the time of writing, I am using Arduino IDE 1.8.15 and esp32 board version 1.0.6.
I have tried:
Using FTDI232 to upload
Pinout Diagram
Using Arduino to upload
Pinout Diagram
Using ESP32-CAM-MB that came with the ESP32-Cam I bought.
Pressing the RST button while and before uploading (also waiting for the "connection" text to appear then pressing RST).
Switching between 3.3v and 5v, still the same error.
Switching between QIO and DIO flash mode.
Swapping RX and TX.
Though I didn't get any errors uploading using the ESP32-CAM-MB, I was stuck on this and it wouldn't show me IP to where I can access the camera.
I am new to this so please take it easy :)
This is what worked for me: Remove the GPIO0 and GND short after uploading the code and press the RST button.
Press the Reset (or Boot in some boards) button and keep it pressed until you see that the code is being written (uploaded) on the board.

Arduino ESP32 Error when uploading any type of file

I just installed the ESP32 library, and every time I try to upload a file to the ESP it gives me this error:
esptool.py v2.6
Serial port COM3
Connecting.....
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: aa:aa:aa:aA:aa:aa
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Warning: Could not auto-detect Flash size (FlashID=0xffffff, SizeID=0xff), defaulting to 4MB
Compressed 8192 bytes to 47...
A fatal error occurred: Timed out waiting for packet content
A fatal error occurred: Timed out waiting for packet content
If you use the bare board check for
Serial monitor closed
3.3V stable voltage and
correct connection via FTDI/USB
if using a CP210x (driver 2019) or similar you can try lowering the baud rate for flashing to 115200 or/and
to pull EN to GND (If the board has a boot button then press this one) until the connect_____.....___ appears then release OR the magic sequence
Press and hold RESET / Press and release BOOT / Release the RESET
If you have hardware attached:
IO12 must be pulled low on power up as it is also the MTDI line. The device does have a weak pull down on IO12
See docu page 18 Figure 4If you are using it as I2C or similar you may have a pull-up connected. When removing the pull up resistor you could program it.

Arduino - Burning Bootloader without External Crystal

I'm trying to burn the bootloader to an ATMEGA328P - AUR, the 32-pin SMD variation with my Arduino Uno. I've tried the recommended way that the Arduino website suggests to burn the bootloader. However, I don't have the 16MHz crystal recommended, so I tried the workaround method they describe to use the internal 8MHz oscillator. Burning the bootloader gives me the "Yikes! Invalid device signature" error. Do you think there is an incompatibility with the chip? Problem with using the internal oscillator? Should I just get the crystal?
For just invalid device signature - (this usually occurs if internal clock is on)
For the ATMEGA328p if it is preloaded with a bootloader for some reason there is a mismatch in signatures so you'll have to do this THEN UNDO IT << please don't forget or else you'll have to bootload everytime before you write a script until you UNDO this.
You'll want to open up the avrdude.conf file in Arduino's program files
for mac: show package contents for PC and Linux just search the Program Files
in this file search for " ATMEGA328P " under it should be a field named signature replace "0x1e 0x95 0x14" (the 328 signature) with "0x1e 0x95 0x0F" (the 328p signature)
Follow step 2 - 4 below, if this works you're all set.
if internal clock is not on a sync error occurs
The ATMEGA328p has an internal oscillator which operates at 8MHz but this oscillator is apparently turned off when the a 16MHz bootloader is burned to it. So if you are gonna burn an 8MHz (lilypad) type bootloader to it you'll have to do so with the 16MHz oscillator in place so the internal clock can be turned on.
To do this:
load ArduinoISP example script on the UNO R3 that you're going to be boot loading with
(Configure in Tools > Boards > LilyPad Arduino or ATMEGA328 on breadboard)
(Configure in Tools > Port > ArduinoISP)
Afterwards you should be ready to burn boot loader
if sync error persist it means that the clocks are missaligned meaning you've got to slow down the boot loader
in the Hardware folder search for a boards.txt file within the avr folder
edit the line in the file containing "atmega328bb.upload.speed=57600" to read "atmega328bb.upload.speed=19200"
try steps 2 - 4 just above again
Try each of these steps in various combinations or appropriately as the problem evolves. If this doesn't seem to work just continue search forums... I had found all this in about 3 hrs on google - good luck!

avrdude: error: buffered memory access not supported

I am trying to upload this firmware sck_beta_v0_8_6 via Arduino 1.0.5-r2.
I have chosen LilyPad Arduino USB as the board. The device is a Smart Citizen Kit Urban Shield v.1.1.
The upload fails with the following error message:
Found programmer: Id = "BÛR"; type =
Software Version = . ; Hardware Version = .
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
What am I doing wrong?
Sometimes, a different USB cable will make all the difference. There is a wide range in the quality of cables on the market, and sometimes, you get one on the ragged edge of acceptable.
The Arduino lilypad seems to be particularly susceptible to this. Glad this helped.
Press the Reset Button before upload the code, until you hear the "unplug" sound (in windows). Open the IDE and try it again
I had the same error message trying to upload a sketch to an Arduino Leonardo board from a Levovo laptop using Arduino ver 1.0.6. Both Device Manager and Arduino showed the board connected on COM3. Arduino also gave an error message that COM3 was being used by another App. I tried changing USB cables but got the same message. What worked was changing the USB outlet from the top right rear on the Lenovo to the bottom right rear outlet. It connected on COM8 and I was able to upload the sketch. Understand there are speed differences between the two outlets. Now all I need to do is figure out why I cannot upload sketches to the same Leonardo board on my HP laptop with Windows 10 and the most recent Arduino version. Connects on COM6 but hangs up when uploading. (Note: Also had to edit some Arduino library files that worked on ver 1.0.6 but showed compile errors in the latest version.)
I had the same error, but I later found that I had the wrong Arduino type selected, instead of Nano I had Yun.
I had the same issue when trying to upload code into Arduino Micro ( Chinese clone ). Spending hours on Google, flashing new bootloader - still nothing. Physical reset and opening COM port with boundrate 1200 doesn't work. Why?
I HAVE ATMEGA168 INSTEAD OF ATMEGA32u4!
Google is telling, that Arduino Micro got Atmega32u4, but my clone got Atmega168! First of all, check what atmega type do you have by lookup on black soldered chip on Arduino.
So instead of choose "Arduino Micro" on "Board" menu, i choose Arduino Nano and everything works!
I get this same error, avrdude: error: buffered memory access not supported also with garbage-looking output with programmer id # with versions ., when I point avrdude at the serial port of the stock main firmware of my Leonardo-compatible breakout board instead of the serial port offered during the bootloader; it seems that the latter is what avrdude can program?
The normal initial output when actually connecting to the bootloader would be something like:
Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
Software Version = 1.0; No Hardware Version given.
To get to the bootloader you can either
press the reset button (if you don't have a reset button, connecting reset to ground), or
briefly connect to the main firmware's serial port at 1200 bps and disconnect
The bootloader will present a different serial USB device than the main firmware's serial USB device, so it may get assigned a different serial port number in your OS, usually the next available one. For instance in Windows my Leonardo-compatible main firmware was assigned COM3 and the bootloader was assigned COM4.
A python script, courtesy of https://nicholaskell.wordpress.com/tag/leonardo/, for doing this serial 'knock':
reset.py:
#!/usr/bin/env python
import serial, sys
serialPort = sys.argv[1]
ser = serial.Serial(
port=serialPort,
baudrate=1200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS
)
ser.isOpen()
ser.close() # always close port
In Windows land, I have a cmd script for using this in a virtualenv
reset.cmd:
"C:\Program Files (x86)\Python37-32\Scripts\virtualenv.exe" pyreset_virtualenv
pyreset_virtualenv\Scripts\pip.exe install pyserial
pyreset_virtualenv\Scripts\python reset.py COM3
pause
adjust to suit your serial port and python path.
Either way, after getting the bootloader connected, you have a brief window of a couple of seconds where avrdude can connect to the new serial port to start programming before the bootloader will go into the main firmware again, at which point you'll have to do the reset again. So, once you figure out the bootloader serial port, you'll want to prepare the avrdude command line to run in advance, so you can launch it without delay after the reset.
While this answer isn't specific to the lilypad, you need to reset the board to write or read from/to the memory. However, If you are using avrdude in the terminal you must send a specific baudrate(1200 for the Leonardo) then close, wait 2 seconds, and open the port. At that point you can read and write to and from your Arduino. I achieved this using python.
Along the lines of:
Import serial
Import time
Import os
Seri=serial.Serial(yourConnectedPort, specificBaudRate)
Seria.close()
time.sleep(2)
Seri.open()
os.system(your avrdude command)

Resources