Skip to content

BasicHTTPClient not working ? #1963

@bistory

Description

@bistory

Basic Infos

Hardware

Hardware: NodeMCU v1.0 (ESP12E)
Core Version: 2.2.0

Description

Hi ! I'm new to the esp8266 world and I'm trying to test wifi using Arduino IDE and the NodeMCU dev board.
I have tested the Hello Server example and it works fine but now when I'm trying the BasicHTTPClient, the board crash when connecting to my AP.
I also tried to set an AP with my phone but the results remain the same...

Maybe it's a dumb problem but I'm stuck with it now :-(

Settings in IDE

Module: NodeMCU 1.0
Flash Size: 4MB/3MB
CPU Frequency: 80Mhz
Flash Mode: ?qio?
Flash Frequency: ?40Mhz?
Upload Using: ?OTA / SERIAL?
Reset Method: ?ck / nodemcu?

Sketch

/**
 * BasicHTTPClient.ino
 *
 *  Created on: 24.05.2015
 *
 */

#include <Arduino.h>

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

#include <ESP8266HTTPClient.h>

#define USE_SERIAL Serial

ESP8266WiFiMulti WiFiMulti;

void setup() {

    USE_SERIAL.begin(115200);
   // USE_SERIAL.setDebugOutput(true);

    USE_SERIAL.println();
    USE_SERIAL.println();
    USE_SERIAL.println();

    for(uint8_t t = 4; t > 0; t--) {
        USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
        USE_SERIAL.flush();
        delay(1000);
    }

    WiFiMulti.addAP("AndroidAP", "password");

}

void loop() {
    // wait for WiFi connection
    USE_SERIAL.print("[WIFI] Waiting...\n");
    if((WiFiMulti.run() == WL_CONNECTED)) {

        HTTPClient http;

        USE_SERIAL.print("[HTTP] begin...\n");
        // configure traged server and url
        //http.begin("https://192.168.1.12/test.html", "7a 9c f4 db 40 d3 62 5a 6e 21 bc 5c cc 66 c8 3e a1 45 59 38"); //HTTPS
        http.begin("http://192.168.1.5:1880/test.html"); //HTTP

        USE_SERIAL.print("[HTTP] GET...\n");
        // start connection and send HTTP header
        int httpCode = http.GET();

        // httpCode will be negative on error
        if(httpCode > 0) {
            // HTTP header has been send and Server response header has been handled
            USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);

            // file found at server
            if(httpCode == HTTP_CODE_OK) {
                String payload = http.getString();
                USE_SERIAL.println(payload);
            }
        } else {
            USE_SERIAL.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
        }

        http.end();
    }

    delay(10000);
}

Debug Messages

0x401004f4: calloc at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/cores/esp8266/umm_malloc/umm_malloc.c line 1682
0x40106dd4: pvPortZalloc at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/cores/esp8266/heap.c line 33
0x4021c891: wifi_param_save_protect_with_check at ?? line ?
0x401056a2: spi_flash_read at ?? line ?
0x4021c979: system_param_save_with_protect at ?? line ?
0x4021cd68: wifi_station_ap_number_set at ?? line ?
0x4021cec3: wifi_station_ap_number_set at ?? line ?
0x4021cf50: wifi_station_ap_number_set at ?? line ?
0x4021cf8c: wifi_station_set_config at ?? line ?
0x402026c4: ESP8266WiFiSTAClass::disconnect(bool) at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp line 432
0x4021c5de: wifi_get_opmode at ?? line ?
0x4021d407: wifi_station_get_connect_status at ?? line ?
0x40202704: ESP8266WiFiSTAClass::status() at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp line 440
0x4021ad96: ets_vsnprintf at ?? line ?
0x402024c3: ESP8266WiFiMulti::run() at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.cpp line 156
0x402051a0: Print::write(unsigned char const*, unsigned int) at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/cores/esp8266/Print.cpp line 76
0x402041fd: Print::write(char const*) at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/cores/esp8266/Print.cpp line 76
0x402042b4: Print::printf(char const*, ...) at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/cores/esp8266/Print.cpp line 76
0x40202098: loop at /Users/thomaslete/Projects/Arduino/BasicHttpClient/BasicHttpClient.ino line 41
0x40204cc4: operator new(unsigned int) at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/cores/esp8266/abi.cpp line 30
0x402025a7: __gnu_cxx::new_allocator ::allocate(unsigned int, void const*) at /Users/thomaslete/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/ext/new_allocator.h line 104
:  (inlined by) std::_Vector_base   >::_M_allocate(unsigned int) at /Users/thomaslete/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_vector.h line 168
:  (inlined by) void std::vector   >::_M_emplace_back_aux (WifiAPlist_t const&) at /Users/thomaslete/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/bits/vector.tcc line 404
0x401004d8: malloc at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/cores/esp8266/umm_malloc/umm_malloc.c line 1662
0x401053fc: ets_timer_arm_new at ?? line ?
0x40202675: ESP8266WiFiMulti::APlistAdd(char const*, char const*) at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.cpp line 198
0x40204e7c: esp_yield at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/cores/esp8266/core_esp8266_main.cpp line 43
0x40202690: ESP8266WiFiMulti::addAP(char const*, char const*) at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.cpp line 39
0x40202052: setup at /Users/thomaslete/Projects/Arduino/BasicHttpClient/BasicHttpClient.ino line 36
0x40204ec8: loop_wrapper at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/cores/esp8266/core_esp8266_main.cpp line 43
0x40100718: cont_norm at /Users/thomaslete/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/cores/esp8266/cont.S line 109

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions