MKRZero and library ESP8266

Hello, I’m trying to adapt a ESP8266 library from this link GitHub - itead/ITEADLIB_Arduino_WeeESP8266: An easy-to-use Arduino ESP8266 library besed on AT firmware., which is made for an Arduino UNO, for a MKRZero board.
The problem is that library uses HardwareSerial library to manage the communication, however I’m not sure if the MKRZero uses this library.

If I try to use a command of this library in a program and write in my board, don’t work and stops to be recognized by the computer and I need to enter in the bootloader mode and re-write the board with another program.

By the other hand my ESP8266 has this firmware in it:
AT version:1.2.0.0(Jul 1 2016 20:04:45)
SDK version:1.5.4.1(39cb9a32)
Ai-Thinker Technology Co. Ltd.
Dec 2 2016 14:21:16

I see that exist a most recent version and I’m not sure if is better upgrade or leave it as it is.
Can anyone help me, please?

Can anyone help me, please?

Some code you didn't post doesn't do what you want, which you didn't do a good job of describing. Instead, it does something else, which you did not describe. The code attempts to talk to some external hardware, connected in some way that you did not describe (by posting a schematic, not a bunch of words).

So, probably not.

PaulS:
Some code you didn't post doesn't do what you want, which you didn't do a good job of describing. Instead, it does something else, which you did not describe. The code attempts to talk to some external hardware, connected in some way that you did not describe (by posting a schematic, not a bunch of words).

So, probably not.

Sorry, I going to try to give more information.

The module ESP8266-01 is connected like that:

When I use a code like that, which is a simple auto-configuration and communication via USB to introduce commands to the ESP8266. Works fine.

char* SSDI = "EMN01";
char* PASS = "1234";

// the setup function runs once when you press reset or power the board
void setup() {
	SerialUSB.begin(115200);
	Serial1.begin(115200);
	delay(1000);

	Serial1.print("AT+CWMODE=2\r\n");
	while (Serial1.available())
	{
		SerialUSB.print((char)Serial1.read());
	}
	delay(2000);
	Serial1.print("AT+CWSAP=\"");
	Serial1.print(SSDI);
	Serial1.print("\",\"");
	Serial1.print(PASS);
	Serial1.print("\",3,0\r\n");
	while (Serial1.available())
	{
		SerialUSB.print((char)Serial1.read());
	}
	delay(2000);
	Serial1.print("AT+CIPMUX=1\r\n");
	while (Serial1.available())
	{
		SerialUSB.print((char)Serial1.read());
	}
	delay(1000);
	Serial1.print("AT+CIPSERVER=1,333\r\n");
	while (Serial1.available())
	{
		SerialUSB.print((char)Serial1.read());
	}
}

// the loop function runs over and over again until power down or reset
void loop() {
	if (Serial1.available())
	{
		SerialUSB.print((char)Serial1.read());
	}
	if (SerialUSB.available())
	{
		Serial1.print((char)SerialUSB.read());
	}
}

But when I try to use the library like this way, as I say before, the MKRZero don’t work, even more, the computer stops recognize the board and I need to write another program in bootloader mode to restore the module.

#include <ESP8266.h>
#include <doxygen.h>

ESP8266 wifi(Serial1);


void setup() {
	if (wifi.setOprToSoftAP())              //Configure the ESP8266 as Acces Point
	{
		while (Serial1.available())
		{
			SerialUSB.print((char)Serial1.read());
		}
	}
}

// the loop function runs over and over again until power down or reset
void loop() 
{
	if (Serial1.available())
	{
		SerialUSB.print((char)Serial1.read());
	}
	if (SerialUSB.available())
	{
		Serial1.print((char)SerialUSB.read());
	}
}

At first, I thought that MKRZero don’t uses the HardwareSerial.h but I was wrong. And now I don’t have any idea what’s wrong with it.

What is the source of the 3.3V power? I think it is safe get it from the MKRZERO 3.3V pin. The ESP8266 draws hundreds of mA when its radio is turned on so the 3.3V source must be able to provide this. Check the current rating of the voltage regulator on the MKRZERO board. As I recall, it is high enough.

I would not leave unused pins of the ESP-01 floating. Try connecting them to 3.3V using 10K ohm esistors. But check the ESP-01 specifications. Perhaps some are supposed to be pulled down. I have not used an ESP-01 in years.

gdsports:
What is the source of the 3.3V power? I think it is safe get it from the MKRZERO 3.3V pin. The ESP8266 draws hundreds of mA when its radio is turned on so the 3.3V source must be able to provide this. Check the current rating of the voltage regulator on the MKRZERO board. As I recall, it is high enough.

I would not leave unused pins of the ESP-01 floating. Try connecting them to 3.3V using 10K ohm esistors. But check the ESP-01 specifications. Perhaps some are supposed to be pulled down. I have not used an ESP-01 in years.

The source of the 3.3V is the arduino, and the arduino is powered via USB.

Like I said, when I use a program without the library the board and the ESP8266 works fine. I can give commands via USB and the module ESP reply without problems. I can send and receive messages via wifi whit the module, too.

The problems appear when I try to use the library. Like the program I post before, I only use the library to change the function mode of the ESP to access point and that is enough to soft-brick the Arduino.

If it was what you say and the power source of the ESP wasn’t enough or the floating pins was the problem I think the ESP don’t work in any case. And anyway, that don’t explain why the arduino stops being recognized by the pc.

It could be that library block the serial USB communication?

I think there is a power problem. Perhaps the MKRZERO cannot supply enough current. The ESP may draw little current when idle because its radio is turned off. Changing the mode to AP or STA will cause it to turn its radio on which triggers the problem. Using a separate 3.3V power supply for the ESP should confirm this.

gdsports:
I think there is a power problem. Perhaps the MKRZERO cannot supply enough current. The ESP may draw little current when idle because its radio is turned off. Changing the mode to AP or STA will cause it to turn its radio on which triggers the problem. Using a separate 3.3V power supply for the ESP should confirm this.

The arduino still soft-bricking without the ESP connected anyway. I try to do a little program to see if the Arduino continues working even though the computer does not recognize it.
It doesn’t, for some reason that library mess-up the arduino.