Tag Archives: arduino

esp32:A fatal error occurred: Timed out waiting for packet header

Question

When I download the program to esp32 with Arduino IDE, the following error message appears:

My board is the following Board:

 

Causes and Solutions

The reason is that there is an error in the baud rate selection. The baud rate I selected is 921600 by default. In fact, 115200 should be selected. In this way, you can download normally after downloading again.

As shown in the figure below, it is successful.

 

 

Collect2.exe: error: LD returned 5 exit status solution

The problem
When using XP, the following errors often occur during Arduino compilation:
collect2.exe: error: ld Return5 exit status
ror failing for board Arduino Duemilanove or Diecimila
:>piling for board Arduino Duemilanove or Diecimila
: Compiling for board Arduino Duemilanove or Diecimila Do a batch of your own, rerun the faulty link section on the command line, will pop up a window, is the “memory cannot be read” error. Then he quit.

Here I’m using Arduino Ide1.6.5
After the error code tracking, the problem is not Arduino, but Windows XP NTDLL.DLL module, Arduino link program LD. Exe calls the function of NTDLL.DLL module error, when it returns (RET), into the area of no permission, only repair NTDLL.DLL can solve the above problem. This error can occur on Windows XP and Windows 7, but the forum says it won’t occur on Windows 10. There are a lot of solutions in foreign forums that use a lower version of Arduino’s LD. Exe instead. Maybe the lower version of LD. Exe doesn’t call NTDLL.DLL, but some are not very useful either.

The solution
Rename ld.exe (e.g. old-ld. exe) under C:\Programs\Arduino\hardware\tools\avr\avr\bin in IDE1.6.1, 1.6.2 or 1.6.3.
Copy LD. Exe from the lower version IDE 1.0.6 to the current version. (I’m looking for version 1.0.0, also can) to replace
reference: http://forum.arduino.cc/index.php?Topic = 316146.0.
ld exe download link:
https://download.csdn.net/download/m0_37738838/11149647
Compromise:
through observation, although links appear a mistake, but, in the target directory, has created the elf file, but have not hex file, is the link, appeared in the generated after the elf file called NTDLL. DLL errors, suspended below for the elf generated hex file work.
After analyzing the correct link process, using AVR-objcopy, using batch processing to complete the generation of ELF file to HEX file.
create an elf2hex.bat file and write the following to the elf2hext.bat file.
“D:\ Arduino-1.6.11 \hardware\tools\avr/bin/avr-objcopy” -o ihex-j. EEPROM –set-section-flags=.EEPROM =alloc,load –no-change-warnings — change-section-lma.EEPROM =0 “D:\ Arduino_Hex/ Pelican.ino.eep” “D:\ Arduino_Hex/ Pelican.ino.eep”
Replace the Pelican filename according to your application, where d:\Arduino_Hex is the target directory for the compilation of Arduino and is created by yourself [1].

(1). Collect2.exe: error: LD returned 5 exit status.
(1). Out of the race. But the ELF file has been generated.
(2). Run the elf2hex.bat file and the hex file will appear in the target.

Arduino ide 1.6.9 problems encountered error:’TKD2′ was not declared in this scope

Previously, I used an Arduino link to an infrared receiver to receive commands from the remote control. Control some peripherals. Using a library downloaded from Github.
I need to use it again these days. I’ve got a problem. The first error is
D:\Tools\Arduino\libraries\RobotIRremote\ SRC \ irremotetools.cpp :5:16: error: ‘TKD2’ was not declared in this scope
int RECV_PIN = TKD2; // the pin the IR receiver is connected to

            ^

Exit status 1
error for development board Arduino/Genuino Uno at compile time.
Tip me. TKD2 not found.
and then there’s the problem of finding two IRremote libraries. One of the libraries is used. So we can just delete the library that he gave the path to instead of the Arduino IDE installation directory. Write using the IRemote library provided by the Library in the Arduino IDE.
D:\Tools\Arduino\ Srtirremote \IRremoteTools. CPP :5:16: Error: ‘TKD2’ was not declared in this scope
int RECV_PIN = TKD2; // the pin the IR receiver is connected to

            ^

Exit status 1
error for development board Arduino/Genuino Uno at compile time.
I used an example of the arduino-CC remote control.
https://www.arduino.cc/en/Tutorial/RobotRemoteControl
He has too many examples. A lot I don’t need. I just want the code for his remote reception button. It is enough. But there is an error with a CPP in the library.
It looks like a CPP in the Library provided by Arduino IDE has an error. As a result. Open it up.
opens the CPP file prompted by the error.
D:\Tools\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp

#include "IRremote.h"
#include "IRremoteTools.h"
#include <Arduino.h>

int RECV_PIN = TKD2; // the pin the IR receiver is connected to
IRrecv irrecv(RECV_PIN); // an instance of the IR receiver object
decode_results results; // container for received IR codes

void beginIRremote(){
    irrecv.enableIRIn(); // Start the receiver
}

bool IRrecived(){
    return irrecv.decode(&results);
}

void resumeIRremote(){
    irrecv.resume(); // resume receiver
}

unsigned long getIRresult(){
    return results.value;
}

We found out he had this thing called TKD2. But there’s no declaration or define on it and then we’re going to look for his H header file.

#ifndef IRREMOTETOOLS_H
#define IRREMOTETOOLS_H

extern void beginIRremote();

extern bool IRrecived();

extern void resumeIRremote();

extern unsigned long getIRresult();

#endif

There is no declaration of TKD2
Then move on to D:\Tools\Arduino\libraries\RobotIRremote\ SRC \ irremotetools.cpp
to find the introduced.h header files. Let’s see if we have TKD2.
however. I am!

#include "IRremote.h"
#include "IRremoteTools.h"

I looked for both of them. There’s no such thing as TKD2. As for the

#include <Arduino.h>

You don’t have to look for this one. Because that’s what the Arduino environment comes with. The external library is definitely not going to have a variable or define in there.
so we come to the conclusion that there is a problem with the library code provided by the arduinio ide??Lie to me. I don’t read much. But as far as we can find out, the reason is that the library file code provided by his official is wrong… All right.
I went to the official place to get feedback. I did a little bit of searching. Some people say that 1.6.7 has this problem.
however. They either use something they don’t know why. Or code not written in the official tutorial. Then there are some messages and replies and so on that don’t make sense.
and of course I’m going to talk about it here. I got this error right here. Arduino.cc is a copy and paste of the code from the official arduino.CC tutorial. And check for basic syntax errors. Compile and you get this error

error: 'TKD2' was not declared in this scope

Arduino. Cc official remote library tutorial
https://www.arduino.cc/en/Tutorial/RobotRemoteControl
Let me just copy and paste it again. There’s still this mistake.
Ah. Let’s just do it ourselves. It’s easier.
We have two ways to solve this problem.
the first type:
modifier this CPP
D:\Tools\Arduino\libraries\RobotIRremote\ SRC \ irremotetools.cpp
bar

#include "IRremote.h"
#include "IRremoteTools.h"
#include <Arduino.h>

int RECV_PIN = TKD2; // the pin the IR receiver is connected to
IRrecv irrecv(RECV_PIN); // an instance of the IR receiver object
decode_results results; // container for received IR codes

void beginIRremote(){
    irrecv.enableIRIn(); // Start the receiver
}

bool IRrecived(){
    return irrecv.decode(&results);
}

void resumeIRremote(){
    irrecv.resume(); // resume receiver
}

unsigned long getIRresult(){
    return results.value;
}

Change TKD2 inside to 11 or the IO port on the data receiving port that you use to plug into the infrared receiver header to
to look like this

#include "IRremote.h"
#include "IRremoteTools.h"
#include <Arduino.h>

int RECV_PIN = 11; // the pin the IR receiver is connected to
IRrecv irrecv(RECV_PIN); // an instance of the IR receiver object
decode_results results; // container for received IR codes

void beginIRremote(){
    irrecv.enableIRIn(); // Start the receiver
}

bool IRrecived(){
    return irrecv.decode(&results);
}

void resumeIRremote(){
    irrecv.resume(); // resume receiver
}

unsigned long getIRresult(){
    return results.value;
}

I changed it to 11
Of course. So if you need to modify the port. Also modify the CPP file for the library of the Arduino IDE’s library. This is a bit of bull. Let’s do the second amendment.
second method. It’s written in C++ syntax.
of course. You can just copy my code.
modified
D:\Tools\Arduino\libraries\RobotIRremote\ SRC \ irremotetools.h

#ifndef IRREMOTETOOLS_H
#define IRREMOTETOOLS_H

extern void beginIRremote();

extern bool IRrecived();

extern void resumeIRremote();

extern unsigned long getIRresult();

#endif

Change the h file to

#ifndef IRREMOTETOOLS_H
#define IRREMOTETOOLS_H

extern void beginIRremote( int receivePin );

extern bool IRrecived();

extern void resumeIRremote();

extern unsigned long getIRresult();

#endif

It is an extern void beginIRremote(int receivePin);
this method adds a parameter
. Then we modify
D:\Tools\Arduino\libraries\RobotIRremote\ SRC \ irremotetools.cpp

#include "IRremote.h"
#include "IRremoteTools.h"
#include <Arduino.h>

int RECV_PIN = TKD2; // the pin the IR receiver is connected to
IRrecv irrecv(RECV_PIN); // an instance of the IR receiver object
decode_results results; // container for received IR codes

void beginIRremote(){
    irrecv.enableIRIn(); // Start the receiver
}

bool IRrecived(){
    return irrecv.decode(&results);
}

void resumeIRremote(){
    irrecv.resume(); // resume receiver
}

unsigned long getIRresult(){
    return results.value;
}

to

#include "IRremote.h"
#include "IRremoteTools.h"
#include <Arduino.h>

//int RECV_PIN = TKD2; // the pin the IR receiver is connected to
//IRrecv irrecv(RECV_PIN); // an instance of the IR receiver object
IRrecv *irr;
decode_results results; // container for received IR codes

void beginIRremote( int receivePin ){
    //irrecv.enableIRIn(); // Start the receiver
    irr = new IRrecv( receivePin );
    irr->enableIRIn(); 
}

bool IRrecived(){
    //return irrecv.decode(&results);
    return irr->decode(&results);
}

void resumeIRremote(){
    //irrecv.resume(); // resume receiver
    irr->resume();
}

unsigned long getIRresult(){
    return results.value;
}

All right. And then you fix it. Let’s look at the code we’re using

#include <IRremote.h>
#include <IRremoteTools.h>

void setup() {
  Serial.begin(9600);

  beginIRremote(11); // Start the receiver
}

void loop() {
  if (IRrecived()) {
    unsigned long res = getIRresult();
    Serial.println( res );
    resumeIRremote(); // resume receiver
  }
}

Then compile


The project uses 4,772 bytes and takes up (14%) of program memory. The maximum is 32,256 bytes.
Global variables use 432 bytes, (21%) of dynamic memory, leaving 1,616 bytes for local variables. The maximum is 2,048 bytes.

OK, that’s it.
Once again given the arduino. Cc official the use of remote control library tutorial address

Warning: ESPCOMM_SYNC Failed Error: ESPCOMM_open Failed Error: ESPCOMM_UPLo

Warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed “
error: espcomm_upload_mem failed”

>
solutions;
First, hardware
1. Check the connection
to confirm the connection is correct,
UTXD — RXD
URXD — TXD
VCC – 3.3 V
GND – GND
2. Check to see if the serial port on ESP8266 is being used by other software stations and click on the serial port monitor. If the serial port window pops up normally, it’s ok,

If you can’t pop up, check the tool — port — (select the appropriate port).
Second, other
1. Select the corresponding development board,

2.
Press Flash (or BOOT) not to lose, and then press the reset button to release, and then click to download, flash(or BOOT) do not loose, download the end of the release.
with ESP12 activation instructions

Solution to burning problem of esp8266 module based on Arduino_ open failed error: espcomm_ upload_ mem failed

introduction

car doing a little boring, maybe temporarily stop for a while. Just picked up trash on Taobao, ESP8266 and other boards arrived. I’m going to try out Arduino, learn a wave of STM32 charging, and follow someone else’s tutorial at Station B (which is known as the place to learn) to experiment with ESP8266 and then start working on a wave of Awtrix-like gadgets. The first day it rolled over, and the blinking example of the car didn’t burn in.

ESP8266

ps: with a micro port and a usb cable, it saves the TTL to usb module and dupont cable. Sweet.

The correct

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

blogger was watching a tutorial, for several mainstream ESP8266 introduction, relevant information can also be found inside the
https://www.bilibili.com/video/BV1kf4y1y7GZ?t=680

the blogger tried to download the Bin file with the official loader provided in the tutorial, but the reset was successful, but the error was reported in the Arduino download.

solution: find the tool in Arduino => Reset Method => Nodemcu
problem solved!

if you buy the D1mini ESP8266 module in a certain treasure, you should switch the Rest Method mode

Remember to install the ESP8266 driver and select the correct serial port

is described in the recommended tutorials for installing drivers and burning using TTL to USB ports.

turn on TTL USB attachment:
UTXD, RXD
URXD – TXD
CH_PD — –
VCC – 3.3 v – 3.3 v
GND – GND
GPIO0 – GND

several online solutions:
reset method set to nodemcu, unsuccessful can try to unplug Vcc and then re-burn.
code burning GPIO2 can not power, GPIO0 connect to low level (download mode) while RST ground release (reset) (using TTL to USB module)
reduce baud rate/download rate, change 115200 to 9600 or other (not tested)