Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Goseese
#13417 Hello, all.

First I am able to uplaod a sketch to the ESP8266 using the Arudino IDE and an FTDI adaptor.

I am trying to uplaod a sketch using a 32u4 as the FTDI adpator, but the process does not complete.

I have a very simple sketch on the 32u4 that listens for any bytes of data on USB Serial port and writes those bytes to Serial1.

The serial connection between the 32u4 and ESP8266 is working. I can send data between the two of them.

Here is the sketch I have on the 32u4
Code: Select allvoid setup()
{
  Serial.begin(115200);     
  Serial1.begin(115200);// 1200 2400 19200, 38400, 57600, 115200
}

void loop()
{
        while (Serial.available())
        {
            char sbyte = Serial.read();
            Serial1.write(sbyte);
        }
        delay(1);
        while (Serial1.available())
        {
            char sbyte = Serial1.read();
            Serial.write(sbyte);
        }
        delay(1);
}


I have verbose logging turned on for both compile and upload, but I don't get any logged output after esptool starts up. the process hangs indefinatley.

here is as far as the verbose logging goes.
Code: Select all   setting board to none
   setting baudrate from 115200 to 115200
   setting port from /dev/tty.usbserial to /dev/cu.usbmodem142141
   setting address from 0x00000000 to 0x00000000
   espcomm_upload_file
   stat /var/folders/69/gdyqzzv91jq_4fdl81x_xbt40000gn/T/build7816511780309378484.tmp/esp_blink.cpp_00000.bin success
opening port /dev/cu.usbmodem142141 at 115200
   tcgetattr
   tcsetattr
   serial open
opening bootloader
resetting board
trying to connect
   setting character timeout 0
   done
   setting character timeout 1
   done
   espcomm_cmd: sending command header
   espcomm_cmd: sending command payload
trying to connect
   setting character timeout 0
   done
   setting character timeout 1
   done
   espcomm_cmd: sending command header
   espcomm_cmd: sending command payload
   espcomm cmd: receiving 2 bytes of data
   setting character timeout 0
   done
   setting character timeout 1
   done
   espcomm_open
Uploading 30160 bytes from /var/folders/69/gdyqzzv91jq_4fdl81x_xbt40000gn/T/build7816511780309378484.tmp/esp_blink.cpp_00000.bin to flash at 0x00000000
   erasing flash
   espcomm_cmd: sending command header
   espcomm_cmd: sending command payload
   setting timeout 5000
   setting character timeout 50
   done
   setting timeout 1
   setting character timeout 1
   done
   espcomm cmd: receiving 2 bytes of data
   writing flash


Has anybody been able to upload sketches to the ESP8266 in this way, or can you think of any command line switches I could try on esptool? I have tried multiple upload speeds.
User avatar
By ian
#13481 I do this all the time, although not wth a 32u4. The code I use:

Code: Select allvoid loop()
{

  /* send everything received from the hardware uart to usb serial & vv */
  if (Serial.available() > 0) {
    char ch = Serial.read();
    Serial1.print(ch);
  }
  if (Serial1.available() > 0) {
    char ch = Serial1.read();
    Serial.print(ch);
  }

}
User avatar
By Goseese
#13482 That looks pretty close to my sketch, except you are doing a print instead of write, I will give that a try.

Also, I notice you are only doing 1 char at a time, instead of looping while serial.available. That might be it too.

Can you confirm your baud rate settings of your Serial and Serial1 ports and esptool?

Are you hooking up the ESP8266 to Serial1, or Serial?
User avatar
By ian
#13549 A couple of thoughts...
When you are busy in a while() loop the other serial device could be merrily overflowing?
I'm not sure why you are using delay(). A delay of 1 millisecond is around 10 bytes of data at 115k
My configuration uses a Teensy 3.1 with Serial (USB) connected to my PC and Serial1 connected to the ESP8266.
I tend to use 115k, sometimes 460k, never any problems.

Cheers

Ian