Post topics, source code that relate to the Arduino Platform

User avatar
By Max Pickle
#94782 I have an AZDelivery Node MCU ESP8266 [1] linked via SPI to a Adafruit BME280 Temperature, Humidity and Pressure Sensor [2] that when the data connections are made it prevents the ESP from booting and communicating with the IDE. The error from Visual Code Studio is:

Code: Select all    Arduino: 1.8.19 (Windows Store (Windows 10), Board: "Generic ESP8266 Module, 80 MHz,         
    Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache +
    32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, dtr (aka nodemcu), 26 MHz, 40MHz,
    DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory,     
    Disabled, None, Only Sketch, 115200"

    Executable segment sizes:
    ICACHE : 32768           - flash instruction cache
    IROM   : 231724          - code in flash         (default or ICACHE_FLASH_ATTR)
    IRAM   : 26793   / 32768 - code in IRAM          (IRAM_ATTR, ISRs...)
    DATA   : 1496  )         - initialized variables (global, static) in RAM/HEAP
    RODATA : 876   ) / 81920 - constants             (global, static) in RAM/HEAP
    BSS    : 25608 )         - zeroed variables      (global, static) in RAM/HEAP

    Sketch uses 260889 bytes (27%) of program storage space. Maximum is 958448 bytes.
    Global variables use 27980 bytes (34%) of dynamic memory, leaving 53940 bytes for local
    variables. Maximum is 81920 bytes. v3.0
    Serial port COM11
    Traceback (most recent call last):
    File "..packages\esp8266\hardware\esp8266\3.0.2/tools/", line 66, in <module> esptool.main(cmdline)

    File "..packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\", line 3552, in main
    esp.connect(args.before, args.connect_attempts)
    File "../packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\", line 529, in
    connect raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))

    esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
    esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

I have:

    - Tried the board, circuit and code in the Arduino IDE and same error so I do not believe it to be a Visual Code Studio specific problem.
    - Tried a different board - same error so I do not believe the board to be faulty.
    - Tried a different sensor - same error so I do not believe the sensor to be faulty
    - Disconnected the data lines - board boots, sensor shows power and correctly the node reports that the board cannot be found. So this would be the expected behaviour.
    - Uploaded the basic block sketch to the ESP and it works correctly.
    - Tried circuit and sensor with an Arduino Uno and it works.

The code is taken from the BME280test [3] example with appropriate changes made to the pin numbers and line 31 commented out to disable i2c with either 31/32 uncommented to enable SPI. Below is the circuit I am using with the following pinout:

    - 3v3/Vin N/A Red Vin
    - GND N/A Black GND
    - D5 HSPI SCK White SCK (GPIO 14)
    - D6 HSPI MISO Green SDO (GPIO 12)
    - D7 HSPI MOSI Blue SDI (GPIO 13)
    - D8 HSPI CS Yellow CS (GPIO 15)


So, it seems to be an error with the ESP8266 and BME280 that blocks any sort of communication with the board but I have nothing to go on. I'm going to try a ESP32 and see if it gives a different response. If anyone has any idea or has experienced something similar I would welcome some insights.

Apologies for the duplication with ... ts-booting. I'm keen to get and answer but struggled to decide on the best home for the question.

[2]: ... t/overview
[3]: ... 80test.ino
User avatar
By Max Pickle
#94811 Hi,

Thanks for the response. I'm guessing you missed "Tried circuit and sensor with an Arduino Uno and it works." from my problem description above. Easily done.

I know the sensor is working and have them working on my desk now with an ESP32 - same circuit. Just seemed to be something about the ESP8266.