0

Huzzah ESP8266 Upload Problems
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Huzzah ESP8266 Upload Problems

by cfatbu on Thu Jul 27, 2017 10:40 am

OK, thanks. I had tried switching things around, and now have CS on #12, SDI on #13, SDO on #14, and SCK on #4. The connection is working mostly reliably again and I've now successfully tested the wifi functionality of the chip. The problem now seems to be that I can receive the first reading from the 3 sensors on the BME280, but every subsequent reading is either incorrect or NaN. I've tried varying delays to no success, and am basically using the BME280 code from Adafruit (again, it worked on the Arduino). Any thoughts on why the first reading would be correct but the others are not? I've also tried SCK on gpio 5, with the same results.

cfatbu
 
Posts: 14
Joined: Wed Jul 19, 2017 2:39 pm

Re: Huzzah ESP8266 Upload Problems

by adafruit_support_rick on Thu Jul 27, 2017 11:39 am

And it's consistent? The first readings are always good, and subsequent readings are always bad?
Well, I can't think of a good reason for things to be happening that way.

Does the example bme280test sketch do the same thing?

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Huzzah ESP8266 Upload Problems

by cfatbu on Thu Jul 27, 2017 2:22 pm

Yes, it is consistent. The bme280 test code works fine with the Arduino (Uno), in that I get repeatable results that match the atmospheric conditions. With the Huzzah, the first reading (temp, humidity, pressure) will match atmospheric, and the following sets are either completely off or NaN. There were a few instances where, for the first reading, only the temp reading was accurate, and humidity & pressure were garbage, but lately the . I've tried switching around the pin assignments but it hasn't made a difference. Could there be some sort of buffer or timing problem at play here?

cfatbu
 
Posts: 14
Joined: Wed Jul 19, 2017 2:39 pm

Re: Huzzah ESP8266 Upload Problems

by adafruit_support_mike on Fri Jul 28, 2017 12:06 am

IIRC, there's a fencepost issue in the BME280's signal timing.

When you call it for a reading, it returns the value stored in its registers, takes another reading, stores that, then drops into a sleep state to minimize self-heating. The value you get is from the previous measurement, not the one triggered when you called for a value. You'll get that one next time.

If you have any kind of long delay between readings, call the BME280 twice. Discard the first reading because it's from who knows how long ago, and use the second reading.

adafruit_support_mike
 
Posts: 63725
Joined: Thu Feb 11, 2010 2:51 pm

Re: Huzzah ESP8266 Upload Problems

by cfatbu on Fri Jul 28, 2017 11:37 am

Thanks -- this is important to know. I don't think it fixed my problem. I didn't see this issue when I tried it on my Arduino, and minimizing the delay time on the Huzzah (as well as calling the sensor twice and comparing both readings) still gives nan.

For example, if I simply call for the BME280 readings 10 consecutive times, within the main loop & no delay in between each call, the first set of 10 will consistently return 7 accurate readings, and the remainder will give incorrect values. The next iteration of the loop will then consistently give nan for all sensors, for each call to the BME.

The one fix that does give repeatable, accurate readings is if I reinitiate the BME280 prior to each reading call, by adding the bme.begin call to the main loop. This seems needlessly redundant but I'll stick with it unless you have advice otherwise.

If it helps, I'm setting this all up with the software SPI. Ideally I would use I2C instead, to free up some of the gpio pins for other sensors, but I can't get the board to recognize the BME280 ("Could not find valid BME280 sensor..."). For the I2C configuration I've instead connected SCL to #4 and SDI to #5 (vice versa as well due to the published ambiguity about these assignments), and I used the "Adafruit_BME280 bme;" declaration instead of "Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK);" for the software SPI.

cfatbu
 
Posts: 14
Joined: Wed Jul 19, 2017 2:39 pm

Re: Huzzah ESP8266 Upload Problems

by adafruit_support_rick on Sat Jul 29, 2017 8:46 am

On the ESP8266, you need to explicitly specify which pins you're using for I2C in the Wire.begin function call. The BME280 library doesn't provide for this. You can easily edit the library's Adafruit_BME280.cpp file to do this. Find the library's begin function (it's around line 40), and change the Wire.begin to add the appropriateSCL and SDA pins:
Code: Select all | TOGGLE FULL SIZE
bool Adafruit_BME280::begin(uint8_t a) {
  _i2caddr = a;

  if (_cs == -1) {
    // i2c
    Wire.begin(SDA_PIN, SCL_PIN);  //#define the symbols SDA_PIN and SCL_PIN as appropriate
  } else {

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Huzzah ESP8266 Upload Problems

by cfatbu on Mon Jul 31, 2017 10:13 am

Got it, thanks -- this works fine.

cfatbu
 
Posts: 14
Joined: Wed Jul 19, 2017 2:39 pm

Re: Huzzah ESP8266 Upload Problems

by cfatbu on Sun Feb 25, 2018 4:08 pm

I had this setup working fine (Huzzah breakout + BME280), where I communicated via I2C (GPIO 5: SDI; GPIO 4: SCK) and had edited the Adafruit_BME280.cpp to include the changes described above. In the interim I've been unsuccessfully trying to replicate this setup with the Feather Huzzah board, so over this past week I've now switched back to the Huzzah breakout and soldered all the connections to a proto board (ported over from the previous breadboard setup).

Once the proto board was setup, the Huzzah's flash memory had retained an older program that reported the BME280 output, and its output to the Arduino serial monitor was as expected. I then tried uploading a different program to the Huzzah but the BME280 can no longer be found. I checked the BME280.cpp file and I no longer see the edits I made to hard code the I2C pinouts. I suspect the BME280 libraries were updated in the interim.

So: My hardware connections are identical to before (my solder connections are all fine, via a continuity test; the chip is receiving 3.3V power) and my software is identical, but the board is no longer recognized. I know the BME280 functions properly since it reported out from the old code stored in the memory, so I figure the problem has to be due to some other change in the Arduino software. Could this be due to a likely library update and if so, how should I adapt it to properly identify the I2C connections? The .cpp code has definitely changed, as previously it specified a Wire.begin line, and now it shows
_wire -> begin;
as the default code. Editing this line to:

_wire ->begin(5,4);

does not resolve the issue.

cfatbu
 
Posts: 14
Joined: Wed Jul 19, 2017 2:39 pm

Re: Huzzah ESP8266 Upload Problems

by adafruit_support_mike on Tue Feb 27, 2018 4:33 am

It sounds like the Arduino IDE may have 'helpfully' updated the BME280 library for you.

That's an ongoing problem in technology: people should be helpful, machines should be obedient, and trying to swap those around leads to trouble.

You can avoid that by making your own private copy of the BME280 library. Github will let you scan back through previous versions of the code and download the one you used before. Rename the files and the class so you can edit that without having the code changed under you again.

adafruit_support_mike
 
Posts: 63725
Joined: Thu Feb 11, 2010 2:51 pm

Re: Huzzah ESP8266 Upload Problems

by cfatbu on Tue Feb 27, 2018 11:16 am

Mike: many thanks. I had forgotten about the github repository for previous versions. It turns out my previously-edited library was there all along, but that the underlying issue is that the Arduino update put the new library in a different location. I don't know how the IDE searches for its libraries, but the previous library was installed such that it sat in the Applications/Arduino/Contents/Java/libraries/ folder. This is the version I had edited and worked, previously. The new library update was installed to a different location, in my User directory, under Documents/Arduino/libraries/. It did the same thing for the OneWire library as well. Removing these restored BME280 functionality.

Separately:
I'm still confused as to why I can't communicate with the Feather Huzzah. I've (think) successfully got it talking via the USBtoUART port, but the espcomm_sync, open, and upload_mem keep failing:

esptool v0.4.12 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
setting board to nodemcu
setting baudrate from 115200 to 57600
setting port from to /dev/cu.SLAB_USBtoUART
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
espcomm_upload_mem
opening port /dev/cu.SLAB_USBtoUART at 57600
tcgetattr
tcsetattr
serial open
opening bootloader
resetting board
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

I've alternately tried connecting GPIO #0 to ground via 220 Ohm, and as well with GPIO15, with the same result. The only difference I've incorporated in Arduino IDE between the Huzzah breakout board and the Feather is the port connection. The board LED lights to a dim red in the 220 Ohm configuration. I've seen this issue reported by others, with no clear fix. I'm running OSX 10.12.6. Any additional suggestions?

cfatbu
 
Posts: 14
Joined: Wed Jul 19, 2017 2:39 pm

Re: Huzzah ESP8266 Upload Problems

by adafruit_support_rick on Mon Mar 12, 2018 10:53 am

Why are you setting the baudrate to 57600? Should be 115200, I think...

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Huzzah ESP8266 Upload Problems

by cfatbu on Mon Mar 12, 2018 1:05 pm

I tried the lower baud rate because 115200 didn't work...

cfatbu
 
Posts: 14
Joined: Wed Jul 19, 2017 2:39 pm

Re: Huzzah ESP8266 Upload Problems

by adafruit_support_rick on Fri Mar 16, 2018 11:20 am

Do you have anything connected to the feather, other than the USB cable? Any other wiring on it? If so, remove everything and try again.

What board type do you have selected in the Tools menu? Should be Adafruit HUZZAH ESP8266

If you can, post some clear, detailed pictures of bth sides of the Feather

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Huzzah ESP8266 Upload Problems

by wetblanket on Fri Apr 13, 2018 6:45 pm

I'm having what sounds like the same problem. I used to be able to talk to the feather, updated some libraries, and now I can't. I'm getting the same error message. Were you ever able to fix it?

wetblanket
 
Posts: 14
Joined: Sun Mar 26, 2017 7:19 pm

Re: Huzzah ESP8266 Upload Problems

by adafruit_support_rick on Sat Apr 14, 2018 12:01 pm

You're seeing this?
Code: Select all | TOGGLE FULL SIZE
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed


Sometimes, usb cables can be a problem. Try some different ones.

Do you have anything connected to the feather, other than the USB cable? Any other wiring on it? If so, remove everything and try again.

What board type do you have selected in the Tools menu? Should be Adafruit HUZZAH ESP8266.
Which version of the ESP8266 board package is installed? Check using the Boards Manager

If you can, post some clear, detailed pictures of both sides of the Feather

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Please be positive and constructive with your questions and comments.