ESP8266 Endless Resetting - Supply problem

Hi everyone!

I'm using an standalone ATmega328p, when I try to run the following sketch, the microcontroller keeps resetting:

void setup() {
  Serial.begin(19200);
}

void loop() {
  Serial.print("a");
  delay(5000);
}

Configs: Bootloader = Optiboot ATmega328p - Internal 8Mhz; Supply = 3.3V (regulated from Arduino Due); Wiring = +3,3V to VCC and AVCC / GND (to GND from Arduino Due) / Only TX connected (to Arduino Due TX0).

And: I'm using the Arduino Due as a TTL-USB converter, so as I read in internet, I just needed to connect the Arduino Due Reset to GND.

I know it's resetting because I receive 'a' as there wasn't 5 sec delay.

Can someone tell me how can I solve this? Maybe it's related to the bootloader?

How could you be getting anything???

Are there other connections that you're not mentioning? There must be.

How are you receiving the serial data? The wiring you describe above would not permit any serial communication whatsoever, since you have TX connected to TX. Serial has TX and RX wired to eachother (since one has to receive what the other transmits).

Do you have some other serial adapter connected or something?

Do you have a 10k pullup resistor on the reset pin? If not, that could cause such a problem.

DrAzzy: How could you be getting anything???

Are there other connections that you're not mentioning? There must be.

How are you receiving the serial data? The wiring you describe above would not permit any serial communication whatsoever, since you have TX connected to TX. Serial has TX and RX wired to eachother (since one has to receive what the other transmits).

Do you have some other serial adapter connected or something?

Sorry, I've forgotten to say: I'm using the Arduino Due as a TTL-USB converter, so (following the internet) I just needed to connect the Arduino Due Reset to GND. Changed in first post.

My ATmega328p TX is connected to the Arduino Due TX0 and with this I'm receiving the 'a' char, but without delay. If I connect to RX0, there is no serial data (maybe TX0 means Transmit to USB and RX0 receive from USB?).

[quote author=jack wp link=msg=2416631 date=1443544196] Do you have a 10k pullup resistor on the reset pin? If not, that could cause such a problem. [/quote]

I added it, but it didn't solve my problem.

"so (following the internet) I just needed to connect the Arduino Due Reset to GND. Changed in first post."

When you connect a reset pin to ground, it causes a reset. Depending on what you want, that may be wrong.

Jack wp: He's connecting the Due's reset pin to ground, not the ATmega328p's reset pin to ground (unless I'm really interpreting it wrong).

Yeah, that's right then - in that case, the wiring is correct (you're wiring the TX of the ATmega328p to the TX pin on the held-in-reset due, and that TX0 pin is connected to RX pin of the serial adapter on the Due)

Could you try a sketch like this that is more informative? That way you know that an "a" is never from a reset event, and "start" always indicates a reset/startup event, and takes the guesswork out.

void setup() {
  Serial.begin(19200);
  Serial.println("start");
}

void loop() {
  delay(5000);
  Serial.println("a");
}

Also, ffs, TTL serial adapters are like a dollar (2-4 for a nice one) including shipping on ebay, why are you using your big fancy due for such a task?

"He’s connecting the Due’s reset pin to ground, not the ATmega328p’s reset pin to ground "
Will that prevent the Due from sending serial signals, while it is held in reset mode. I may misunderstand.

DrAzzy: Jack wp: He's connecting the Due's reset pin to ground, not the ATmega328p's reset pin to ground (unless I'm really interpreting it wrong).

You are right.

DrAzzy: Also, ffs, TTL serial adapters are like a dollar (2-4 for a nice one) including shipping on ebay, why are you using your big fancy due for such a task?

I'm using what I have in hand :P

DrAzzy: Could you try a sketch like this that is more informative? That way you know that an "a" is never from a reset event, and "start" always indicates a reset/startup event, and takes the guesswork out.

void setup() {
  Serial.begin(19200);
  Serial.println("start");
}

void loop() {  delay(5000);  Serial.println("a"); }





Also, ffs, TTL serial adapters are like a dollar (2-4 for a nice one) including shipping on ebay, why are you using your big fancy due for such a task?

I get the following input (using RealTerm terminal):

start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start
                                                                         
start

Note: the space between words are CR LF

Still resetting :(

[quote author=jack wp link=msg=2416684 date=1443546179] "He's connecting the Due's reset pin to ground, not the ATmega328p's reset pin to ground " Will that prevent the Due from sending serial signals, while it is held in reset mode. I may misunderstand. [/quote]

In using the FTDI chip (TTL-USB) from Arduino Due not the processor, and the processor program is blank (pressed the Erase button).

Thanks for the replies!

I don't know why yet but: In the same Breadboard I had the ESP8266 Wifi Module just Powered Up without Data pins connected.

After I took the module out, my micontroller worked!

Very strange, because I tested with two different modules...

Thanks again! I will check from now on.

Do you have the 10k pullup from the '328’s reset to Vcc?

Do you have the 0.1uf ceramic decoupling capacitors between Vcc and Gnd, and between AVcc and Gnd on the '328p, as close to the pins as possible? Omitting these caps will result in unexpected resets or worse; they are not optional, despite that some guides omit them. Having the ESP8266 on the same power rails just makes this issue worse.

Yes, I put a Pullup resistor (10k) into ATmega328p reset.

I don't have 0.1uF right now, so I added 100uF in both Vcc and GND, now the microcontroller is resetting less often (with ESP8266 powered).

I will try other configurations and check the ESP8266 modules.

100uf is not sufficient for decoupling, though it's a good idea when using an esp8266 on he same breadboard.

You must install decoupling capacitors, 0.1 uf ceramic, between vcc and had, and between vcc and gnd, add close to the chip as possible. These are needed for almost every IC.

Well, of course if you are attempting to supply an ESP8266 from the "regulated" output of the DUE, the heavy surge load of the ESP8266 as it transmits packets will not surprisingly, cause power dips. It has nothing to do with suppressing transients that the 0.1 µF caps would manage - though you should still have them.

If the 100 µF causes less frequent resets, then you need to "up the ante" to 470 µF or so - or find a proper regulated 3.3 V supply for the ESP8266.

Paul__B:
Well, of course if you are attempting to supply an ESP8266 from the “regulated” output of the DUE, the heavy surge load of the ESP8266 as it transmits packets will not surprisingly, cause power dips. It has nothing to do with suppressing transients that the 0.1 µF caps would manage - though you should still have them.

If the 100 µF causes less frequent resets, then you need to “up the ante” to 470 µF or so - or find a proper regulated 3.3 V supply for the ESP8266.

That’s strange, because before using the standalone ATmega328p, I tested the ESP8266 with Arduino Due, and it worked pretty well. But to be sure, I tested it again and it really works (Arduino Due <> ESP8266).

Another thing is that I’m not transmiting packets in my test program, just trying to setup the module.

I will try both suggestions of 0,1uF and 470uF.
When I was writing this reply I figured out that my Capacitor is 104, which is 100nF = 0,1uF, so I think it couldn’t solve the problem.

Still trying!

I could solve the problem!

When I as testing things, I disconnected one by one pin of the ESP8266 to see which were the problem. And it was the pin CH_PD.

I followed the tutorials about wiring the ESP8266, and all of them just said to connect the CH_PD (Chip Power Down) direct to +3,3V.

So, I tried to put a 10k resistor from the pin to +3,3V (pullup) and now my microcontroller doesn’t reset anymore. Still strange, because the Arduino Due itself didn’t reset a single time (When communicating with ESP8266 and CH_PD direct to +3,3V).

Thanks for all the help!

I will change the title to be more suitable to the problem.

If you really want to do this right, you need to use a separate 3.3V supply for the ESP8266 that has very low impedance; for my projects, I use a DC-DC switcher, under $1 from various vendors eBay/Aliexpress.

Then the V+ that feeds the Arduino 5V regulator can feed the DC-DC switcher which is then set to 3.3V to feed the ESP8266. The ESP can consume over 500mA during transmitting, so the bulk capacitors on the DC-DC switcher are definitely necessary. you should also use the 100nF to decouple directly at Vcc and Gnd on the ESP8266 module.

Using this technique, I have created many stable ESP8266 projects, no reboots and no stability issues. you still must be careful in your code to ensure that you use Delay(0) often to allow the RTOS to service the RF section of the uC.

Ray My Projects

Thanks for you comments!

Actually, I'm trying to power the ESP8266 using 2xAA but it's difficult. I can't get a proper 3,3V regulator (I would use 4xAA and regulate to 3,3V), so I'll look for DC-DC switchers.

Delay(0) would be used like a delayMicroseconds()? Actually I'm sending a command and then waiting for the response before going to the next command. I don't know why and where to use Delay(0).

I'll see your projects, they appear very interesting.

giova014: Thanks for you comments!

Actually, I'm trying to power the ESP8266 using 2xAA but it's difficult. I can't get a proper 3,3V regulator (I would use 4xAA and regulate to 3,3V), so I'll look for DC-DC switchers.

Delay(0) would be used like a delayMicroseconds()? Actually I'm sending a command and then waiting for the response before going to the next command. I don't know why and where to use Delay(0).

I'll see your projects, they appear very interesting.

Most AA cells have too high of an internal resistance (about 0.15 Ω at room temperature) so a large bulk cap must be used to manage the 500+ mA spikes due to the RF power amp. The Vd is also affected by the total resistance of wiring, switch contacts (cheap), etc.

Ray