Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported baud rate 115200 #37

Closed
scargill opened this issue Apr 2, 2015 · 31 comments
Closed

Unsupported baud rate 115200 #37

scargill opened this issue Apr 2, 2015 · 31 comments

Comments

@scargill
Copy link

scargill commented Apr 2, 2015

The examples use 115200 baud ratge - yet the compiler complains that it's an invalid baud rate - it still works of course. Can this be removed?

@igrr
Copy link
Member

igrr commented Apr 2, 2015

Could you please post the sketch itself and the verbose compiler output when you submit issues? Verbose output can be enabled in the Arduino preferences. Thanks.

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

void loop() {
  // put your main code here, to run repeatedly:
  delay(1000);
  Serial.println("Hello ESP!");

}

This sketch with 115200 seems to work.

@scargill
Copy link
Author

scargill commented Apr 2, 2015

Absolutely it compiles no problem and runs no problem but when flashing the chip this is the message I see.. unsupported baud rate – it still works…

Sketch uses 189,636 bytes (36%) of program storage space. Maximum is 524,288 bytes.

warning: unsupported baud rate: 115200, using 115200

Uploading 31488 bytes from C:\Users\Peter\AppData\Local\Temp\build71807972327932918.tmp/sketch_apr02b.cpp_00000.bin to flash at 0x00000000

...............................

Uploading 158184 bytes from C:\Users\Peter\AppData\Local\Temp\build71807972327932918.tmp/sketch_apr02b.cpp_40000.bin to flash at 0x00040000

...........................................................................................................................................................

From: Ivan Grokhotkov [mailto:notifications@github.com]
Sent: 02 April 2015 11:46
To: esp8266/Arduino
Cc: scargill
Subject: Re: [Arduino] Unsupported baud rate 115200 (#37)

Could you please post the sketch itself and the verbose compiler output when you submit issues? Verbose output can be enabled in the Arduino preferences. Thanks.

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

void loop() {
// put your main code here, to run repeatedly:
delay(1000);
Serial.println("Hello ESP!");

}

This sketch with 115200 seems to work.


Reply to this email directly or view it on GitHub #37 (comment) . https://github.com/notifications/beacon/ABzUg0N4gc7NwypgaHnOftd-OHPFKSWNks5n7RVNgaJpZM4D5FTG.gif

@igrr
Copy link
Member

igrr commented Apr 2, 2015

Hmm. How is that possible?

void serialport_setbaudrate(unsigned int baudrate)
{
    DWORD br = 0;
    switch(baudrate)
    {
        case 9600:      br = CBR_9600;      break;
        case 14400:     br = CBR_14400;     break;
        case 19200:     br = CBR_19200;     break;
        case 38400:     br = CBR_38400;     break;
        case 56000:     br = CBR_56000;     break;
        case 57600:     br = CBR_57600;     break;
        case 115200:    br = CBR_115200;    break;
        case 128000:    br = CBR_128000;    break;
        case 256000:    br = CBR_256000;    break;
    }
    if (br == 0)
    {
        LOGWARN("unsupported baud rate: %d, using 115200", baudrate);
        br = CBR_115200;
    }

Puzzled...

@cimba007
Copy link

cimba007 commented Apr 2, 2015

Not sure if this is related but the LOGWARN message looks the same:

Setting the upload speed to 921600 does not work, although 256000 is fine

Der Sketch verwendet 184.858 Bytes (35%) des Programmspeicherplatzes. Das Maximum sind 524.288 Bytes.
D:\Users\Jinja_Admin\Downloads\arduino-1.6.1-p1-windows\arduino-1.6.1/hardware/tools/esp8266/esptool.exe -vv -cd ck -cb 256000 -cp COM23 -ca 0x00000 -cf C:\User
s\Jinja\AppData\Local\Temp\build2025833383679790865.tmp/sketch_apr02a.cpp_00000.bin -ca 0x40000 -cf C:\Users\Jinja\AppData\Local\Temp\build2025833383679790865.t
mp/sketch_apr02a.cpp_40000.bin
esptool v0.4.2 - (c) 2014 Ch. Klippel ck@atelier-klippel.de
setting board to ck
setting baudrate from 115200 to 256000
setting port from COM1 to COM23
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
stat C:\Users\Jinja\AppData\Local\Temp\build2025833383679790865.tmp/sketch_apr02a.cpp_00000.bin success

Der Sketch verwendet 184.858 Bytes (35%) des Programmspeicherplatzes. Das Maximum sind 524.288 Bytes.
D:\Users\Jinja_Admin\Downloads\arduino-1.6.1-p1-windows\arduino-1.6.1/hardware/tools/esp8266/esptool.exe -vv -cd ck -cb 921600 -cp COM23 -ca 0x00000 -cf C:\User
s\Jinja\AppData\Local\Temp\build2025833383679790865.tmp/sketch_apr02a.cpp_00000.bin -ca 0x40000 -cf C:\Users\Jinja\AppData\Local\Temp\build2025833383679790865.t
mp/sketch_apr02a.cpp_40000.bin
esptool v0.4.2 - (c) 2014 Ch. Klippel ck@atelier-klippel.de
setting board to ck
setting baudrate from 115200 to 921600
setting port from COM1 to COM23
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
stat C:\Users\Jinja\AppData\Local\Temp\build2025833383679790865.tmp/sketch_apr02a.cpp_00000.bin success
warning: unsupported baud rate: 921600, using 115200
setting serial port timeouts to 1000 ms

@igrr
Copy link
Member

igrr commented Apr 2, 2015

@cimba007 as you see from the code snippet above, 921600 is not supported on Windows (because windows doesn't have CBR_921600 defined), so the output you have posted makes sense.
I think 921600 only works on Linux currently.

What I don't understand is how we can possibly get a message

warning: unsupported baud rate: 115200, using 115200

from the code snippet above...

@cimba007
Copy link

cimba007 commented Apr 2, 2015

Is there a way to increase the baud rate above CBR_256000 with windows? 256000 is already a huge speed improvement but more = better ;-)

It seems odd, since I can do the following:

Serial.begin(512000);

And now I can receive the messages perfectly fine.

@igrr
Copy link
Member

igrr commented Apr 2, 2015

Well, just found this:


/* These baudrates work on windows, but are not part of the windows headers */
#ifndef CBR_230400
#define CBR_230400 230400
#endif
#ifndef CBR_460800
#define CBR_460800 460800
#endif
#ifndef CBR_921600
#define CBR_921600 921600
#endif

source

So maybe it's okay to define those on Windows as well.

@4refr0nt
Copy link

4refr0nt commented Apr 2, 2015

Ivan!
ESPlorer (written on Java too) has support up to 921600 on any
platform. And on Windows too. I'm using jssc java library for
low-level communication (written on C). But for Arduino IDE may be
other way for supporting high speed.

2015-04-02 20:29 GMT+05:00, cimba007 notifications@github.com:

Is there a way to increase the baud rate above CBR_256000 with windows?
256000 is already a huge speed improvement but more = better ;-)

It seems odd, since I can do the following:

Serial.begin(512000);

And now I can receive the messages perfectly fine.


Reply to this email directly or view it on GitHub:
#37 (comment)

@igrr
Copy link
Member

igrr commented Apr 3, 2015

I've got a new esptool build ready which adds support for higher baud rates on Windows:
https://ci.appveyor.com/api/buildjobs/i3ih98t8cyby87j6/artifacts/esptool-0.4.2-3-g1e36d49-win32.zip
Could you guys please give it a try? You can unzip this esptool.exe into /hardware/tools/esp8266/esptool.exe
Thanks.

@cimba007
Copy link

cimba007 commented Apr 3, 2015

Perfect! I tryed some different baud-rates and here are the results for my 200kb sketch:

115200 ~21 seconds
256000 ~10.5 seconds
921600 ~ less then 4 seconds

Only rough estimations with stopwatch.

No error messages, works fine

esptool v0.4.2-3-g1e36d49 - (c) 2014 Ch. Klippel ck@atelier-klippel.de
setting board to ck
setting baudrate from 115200 to 921600
setting port from COM1 to COM23
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
stat C:\Users\Jinja\AppData\Local\Temp\build3547006662176080286.tmp/esp8266_serial_test.cpp_00000.bin success
setting serial port timeouts to 1000 ms
opening bootloader

@scargill
Copy link
Author

scargill commented Apr 3, 2015

Erm, I've just realised I have no idea how to set the baud rate in this Arduino environment for ESP8266. Someone enlighten me?

@cimba007
Copy link

cimba007 commented Apr 3, 2015

Go to the following path:

arduino-1.6.1-p1-windows\arduino-1.6.1\hardware\esp8266com\esp8266

and update the boards.txt

with the current one from the repository:

https://github.com/esp8266/Arduino/blob/esp8266/hardware/esp8266com/esp8266/boards.txt

Now you can use Tool > UploadSpeed in the Arduino IDE

  • use the current esptool.exe to support baud rates above 256000 for windows (igrr's link)

@scargill
Copy link
Author

scargill commented Apr 3, 2015

That looked impressive until I compiled and..
C:\Users\Peter\Documents\Arduino\hardware\arduino-esp8266-master\esp8266\cores\esp8266/Arduino.h:181:26: fatal error: pins_arduino.h: No such file or directory

#include "pins_arduino.h"
^

@cimba007
Copy link

cimba007 commented Apr 3, 2015

What Version are you using? I took the ~350mb download from here

and started the arduino_debug.exe with administrator priviledges (otherwise the compiler will crash).

The path suggests you are using the esp8266 library with the Arduino unmodified standalone?

@scargill
Copy link
Author

scargill commented Apr 3, 2015

I'm using Arduino 1.62 - and all was well.... until.... I tried this mod (wish I'd kept the original) - I'm assuming all I need is a special pins_arduino.h ???

@igrr
Copy link
Member

igrr commented Apr 3, 2015

Taking the most recent revision from git was likely the problem — I renamed board variants a few hours ago.
Instead, take this older version of boards.txt:
https://github.com/esp8266/Arduino/blob/2c7a0245b0c5b79d89423c4b890666e57f5d9339/hardware/esp8266com/esp8266/boards.txt

@scargill
Copy link
Author

scargill commented Apr 3, 2015

Yes that’s it thanks… as it happens my (fast) PC won’t do beyond 115kb, at the top speed nothing happens, at 230k it fails, 115k works a treat.

:)

From: Ivan Grokhotkov [mailto:notifications@github.com]
Sent: 03 April 2015 14:09
To: esp8266/Arduino
Cc: scargill
Subject: Re: [Arduino] Unsupported baud rate 115200 (#37)

Taking the most recent revision from git was likely the problem — I renamed board variants a few hours ago.
Instead, take this older version of boards.txt:
https://github.com/esp8266/Arduino/blob/2c7a0245b0c5b79d89423c4b890666e57f5d9339/hardware/esp8266com/esp8266/boards.txt


Reply to this email directly or view it on GitHub #37 (comment) . https://github.com/notifications/beacon/ABzUg5DTUZKtWUjHSEwMhOCZgg3KBWTRks5n7ohygaJpZM4D5FTG.gif

@cimba007
Copy link

cimba007 commented Apr 4, 2015

hmm, after i was just happy, that the upload baud-rate increased i now can now longer upload new sketches. i do not get any kind of error but after flashing there is just the old content on the esp.

doing some investigation

UPDATE: Apparently the new codes gets uploaded but one thing confused my

After uploading a blank sketch the esp8266 still connects to my wifi with the last know connection settings (Serial output):

connected with FRITZ!Box Fon WLAN 7390, channel 11<\r><\n>
dhcp client start...<\r><\n>

@nerdralph
Copy link

I tried it out, and 921,600 works with a pl2303hx on Win7E/64. It seems even more reliable than when I tried 256,000.
I still sometimes get sync failed, but I was getting that at 115,200 as well.
warning: espcomm_sync failed
error: espcomm_open failed

Both the PL2303 and FT232 support 3mbps. I've even tested the pl2303 at 6mbps:
http://nerdralph.blogspot.ca/2014/05/high-speed-uart-pumping-out-data-at.html

So adding 3mbps support to esptool would probably work.

@nerdralph
Copy link

I tried adding 3000000 to serialport_setbaudrate, and it didn't work. It did set the port to 3mbps, but gave a sync failed error every time I tried. I'm guessing the esp8266 bootloader won't autobaud above 921,600bps.

Status for device COM16:

Baud:            3000000
Parity:          None
Data Bits:       8
Stop Bits:       1

@circuitFlower
Copy link

any updates on this? I'm getting
warning: espcomm_sync failed
error: espcomm_open failed
when I try to upload example files to the esp8266 on Yosemite.
I get it repeatedly, have never had a file successfully upload. I tried changing the baud rate, did not fix it.

@igrr
Copy link
Member

igrr commented Apr 11, 2015

@circuitFlower
Are you able to upload any other firmware using esptool.py?
Usually "espcomm_sync failed" means the chip was not put into bootloader mode prior to upload. Did you try pulling GPIO0 low and toggling power? Also may need to pull GPIO2 high, GPIO15 low, CH_PD high.

@circuitFlower
Copy link

Hi,
I ran an esptool command and received this error

mac-ae:esptool-master ae$ sudo ./esptool.py read_mac
Traceback (most recent call last):
File "./esptool.py", line 470, in
esp = ESPROM(args.port, args.baud)
File "./esptool.py", line 66, in init
self._port = serial.Serial(port, baud)
File "build/bdist.macosx-10.10-intel/egg/serial/serialutil.py", line 282, in init
File "build/bdist.macosx-10.10-intel/egg/serial/serialposix.py", line 289, in open
OSError: [Errno 2] No such file or directory: '/dev/ttyUSB0’

I noticed that there’s a default usb set in the python file, should I change that?
aside from that, I’m a little confused. does the arduino-esp8266 IDE automatically use the esptool, or do I need to put it into bootloader mode manually before I run the script in the IDE? I don’t see a command specifically for that?
Also, it’s probably important to note that I’m using the ESP8266 WI07c Wifi Module purchased from Electrodragon roughly January 24th. It doesn’t have a GPIO15? but CH_PD is high, GPIO0 IS LOW, GPIO2 IS HIGH (TRIED BOTH), GND is ground, VCC is +, I don’t have reset connected.

I did not have GPIO0 LOW, so I connected that, and now I’m getting this error (through the arduino-esp8266 ide).:
warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
closing bootloader

On Apr 11, 2015, at 11:35 AM, Ivan Grokhotkov notifications@github.com wrote:

@circuitFlower https://github.com/circuitFlower
Are you able to upload any other firmware using esptool.py?
Usually "espcomm_sync failed" means the chip was not put into bootloader mode prior to upload. Did you try pulling GPIO0 low and toggling power? Also may need to pull GPIO2 high, GPIO15 low, CH_PD high.


Reply to this email directly or view it on GitHub #37 (comment).

@igrr
Copy link
Member

igrr commented Apr 13, 2015

If you use esptool.py, then the port should be specified, as in esptool.py --port=/dev/tty.usbserial read_mac.
The IDE uses esptool (another one) and it can reset the board for you, but you need to connect DTR and RTS lines to control GPIO0 and RESET pins of ESP.

If you get "FLASH_DOWNLOAD_BEGIN failed" error, try uploading once more (I get this error sometimes, but on the second try it usually works). I also have seen a case when an FTDI-based USB-serial converter did not work well with FTDI driver provided by Apple. Installing drivers from FTDI helped resolve the issue.

@igrr
Copy link
Member

igrr commented May 5, 2015

High baud rates support is included into the latest esptool (which also resolves some of the upload issues).

@igrr igrr closed this as completed May 5, 2015
@santhosh8438
Copy link

Arduino: 1.8.3 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 921600, 4M (3M SPIFFS)"

I'm getting this ERROR when i use 921600 baudrate.... but its works on another Same module....

Build options changed, rebuilding all
Archiving built core (caching) in: C:\Users\Sandy\AppData\Local\Temp\arduino_cache_882395\core\core_esp8266_esp8266_nodemcuv2_CpuFrequency_80,UploadSpeed_921600,FlashSize_4M3M_7e4b3b36485033ea551fda2776e87af1.a
Sketch uses 224201 bytes (21%) of program storage space. Maximum is 1044464 bytes.
Global variables use 31736 bytes (38%) of dynamic memory, leaving 50184 bytes for local variables. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

@scargill
Copy link
Author

Why on EARTH would anyone want to try serial comms at that speed... surely that is just asking for trouble?

@santhosh8438
Copy link

That's the maximum speed henceforth i don't want to waste my time by using other br, I have 3 modules with same specification model all models supports that br, but only one is not compatible!!!

@scargill
Copy link
Author

Whatever works for you - but clearly - it doesn't always. I personally do all my stuff at 230400 and never have any issues...

@devyte
Copy link
Collaborator

devyte commented Jul 13, 2017

@scargill <--- same as him, I use 230Kbps. Going above that is asking for trouble.

Whether higher speeds work or not depends on a bunch of things, including manufacturer, wear, noise, power supply, etc. In some cases, what gets written to the flash could even become corrupted on reboot.

@santhosh8438
Copy link

Yeah, You may b right, i didn't considered the physical things...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants