NodeMCU (ESP8266) with Arduino IDE

Additional Board Manager URL: http://arduino.esp8266.com/stable/package_esp8266com_index.json

/home/andreas/.arduino15/packages/esp8266/hardware/esp8266/2.3.0
/home/andreas/Arduino/

EspExceptionDecoder

github: EspExceptionDecoder

LED Blinky

void setup() {
    pinMode(D4, OUTPUT);
    
    Serial.begin(9600);
}

void loop() {
    Serial.println("HIGH");
    digitalWrite(D4, HIGH);
    delay(1000);
    
    Serial.println("LOW");
    digitalWrite(D4, LOW);
    delay(1000);
}

RFID

ESP8266-MFRC522
Arduino RFID Library for MFRC522
Mifare MFRC522 RFID Reader/Writer
Installing Additional Arduino Libraries

Firmware Version: 0x11 = (unknown)
Card UID: 82 8B C9 55
Card SAK: 08
PICC type: MIFARE 1KB
Sector Block   0  1  2  3   4  5  6  7   8  9 10 11  12 13 14 15  AccessBits
  15     63   00 00 00 00  00 00 FF 07  80 69 FF FF  FF FF FF FF  [ 0 0 1 ] 
         62   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         61   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         60   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
  14     59   00 00 00 00  00 00 FF 07  80 69 FF FF  FF FF FF FF  [ 0 0 1 ] 
         58   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         57   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         56   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
  13     55   00 00 00 00  00 00 FF 07  80 69 FF FF  FF FF FF FF  [ 0 0 1 ] 
         54   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         53   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         52   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
  12     51   00 00 00 00  00 00 FF 07  80 69 FF FF  FF FF FF FF  [ 0 0 1 ] 
         50   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         49   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         48   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
  11     47   00 00 00 00  00 00 FF 07  80 69 FF FF  FF FF FF FF  [ 0 0 1 ] 
         46   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         45   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         44   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
  10     43   00 00 00 00  00 00 FF 07  80 69 FF FF  FF FF FF FF  [ 0 0 1 ] 
         42   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         41   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         40   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
   9     39   00 00 00 00  00 00 FF 07  80 69 FF FF  FF FF FF FF  [ 0 0 1 ] 
         38   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         37   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         36   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
   8     35   00 00 00 00  00 00 FF 07  80 69 FF FF  FF FF FF FF  [ 0 0 1 ] 
         34   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         33   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  [ 0 0 0 ] 
         32   00
Soft WDT reset

ctx: cont 
sp: 3ffef130 end: 3ffef3e0 offset: 01b0

>>>stack>>>
3ffef2e0:  3ffef316 00000006 00000006 40203746  
3ffef2f0:  00000000 00000000 40230314 40203b69  
3ffef300:  3ffef317 00000007 00000007 40202f71  
3ffef310:  00000000 00000000 00000000 00000000  
3ffef320:  00004937 00120100 3ffe84a9 3ffef3a0  
3ffef330:  00000000 00000000 0000001c 00000004  
3ffef340:  00000000 00000000 3ffee2a8 3ffee2a8  
3ffef350:  3ffef3a0 0000004b 3ffee394 402035ec  
3ffef360:  3ffee2a8 00000010 3ffee394 3ffef3a0  
3ffef370:  3ffee2a8 00000007 3ffee2a8 402031bc  
3ffef380:  3ffe84a8 3ffee394 3ffee394 3ffee3b8  
3ffef390:  3ffee394 3ffee2a8 3ffee2a8 40203354  
3ffef3a0:  ffffffff 3ffeffff 3ffee394 40203638  
3ffef3b0:  3ffe8425 3ffee394 3ffee2a8 40201c64  
3ffef3c0:  3fffdad0 00000000 3ffee3b0 40203910  
3ffef3d0:  feefeffe feefeffe 3ffee3c0 40100114  
<<<stack<<<

EspExceptionDecoder
===================

Decoding 11 results
0x40203746: Print::print(unsigned long, int) at /home/andreas/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Print.cpp line 84
0x40230314: rijndaelKeySetupEnc at ?? line ?
0x40203b69: Print::print(__FlashStringHelper const*) at /home/andreas/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Print.cpp line 84
0x40202f71: MFRC522::PICC_DumpMifareClassicSectorToSerial(MFRC522::Uid*, MFRC522::MIFARE_Key*, unsigned char) at /home/andreas/Arduino/libraries/MFRC522/MFRC522.cpp line 35
0x402035ec: Print::println() at /home/andreas/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Print.cpp line 84
0x402031bc: MFRC522::PICC_DumpMifareClassicToSerial(MFRC522::Uid*, MFRC522::PICC_Type, MFRC522::MIFARE_Key*) at /home/andreas/Arduino/libraries/MFRC522/MFRC522.cpp line 35
0x40203354: MFRC522::PICC_DumpToSerial(MFRC522::Uid*) at /home/andreas/Arduino/libraries/MFRC522/MFRC522.cpp line 35
0x40203638: Print::println(char const*) at /home/andreas/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Print.cpp line 84
0x40201c64: loop at /home/andreas/Arduino/esp8266_rfid/esp8266_rfid.ino line 45
0x40203910: loop_wrapper at /home/andreas/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_main.cpp line 56
0x40100114: cont_norm at /home/andreas/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/cont.S line 109

Use a delay in MFRC522.cpp

[...]
/**
 * Dumps memory contents of a sector of a MIFARE Classic PICC.
 * Uses PCD_Authenticate(), MIFARE_Read() and PCD_StopCrypto1.
 * Always uses PICC_CMD_MF_AUTH_KEY_A because only Key A can always read the sector trailer access bits.
 */
void MFRC522::PICC_DumpMifareClassicSectorToSerial([...]) {
  [...]

    Serial.println();
    //delay(50);
  }
  
  return;
} // End PICC_DumpMifareClassicSectorToSerial()
[...]

Soft WDT reset

WDT fires if setup() takes more than 1 sec #34
cores/esp8266/Esp.h
cores/esp8266/cont.S

NodeMCU (ESP8266) Soft WDT reset
Automatic reboot after wdt reset #1017
SoftwareSerial: wdt reset #1426
Uploads and runs ok, but does not run after power cycle #1074

TLS / WiFiClientSecure

Making an ESP8266 Web-Accessible
Slack Integration using Arduino IDE and ESP8266 Adafruit Feather HUZZAH
Secure Sensor Streaming over HTTPS to Azure IoT Hub
IoT Security: Connecting Your ESP8266 to Adafruit IO with SSL/TLS
Python 2.7: TLS/SSL wrapper for socket objects
Python 3.3: TLS/SSL wrapper for socket objects
Fedora Documentation: Transport Layer Security
Fedora Documentation: Implementing TLS Clients With Python

/home/andreas/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/debug.h
Before:
#ifndef DEBUGV
#define DEBUGV(...)
#endif

After:
#ifndef DEBUGV
#define DEBUGV(...) ets_printf(__VA_ARGS__)
#endif

Sketch:
void setup() {
    Serial.begin(115200);
    Serial.setDebugOutput(1);
}
connected with BACHI.NET, channel 6
dhcp client start...
ip:10.0.0.84,mask:255.0.0.0,gw:10.0.0.1
WiFi connected
IP address: 
10.0.0.84
Card UID: D9 F8 D0 B5
:ref 1
please start sntp first !
:wr
:sent 72
:ww
:rn 1460
:rd 5, 1460, 0
:rdi 1460, 5
:rd 74, 1460, 5
:rdi 1455, 74
:rd 5, 1460, 79
:rdi 1381, 5
:rd 1376, 1460, 84
:rdi 1376, 1376
:c0 1376, 1460
:rn 543
:rd 524, 543, 0
:rdi 543, 524
:rd 5, 543, 524
:rdi 19, 5
:rd 14, 543, 529
:rdi 14, 14
:c0 14, 543
:wr
:sent 887
:ww
:wr
:sent 267
:ww
:wr
:sent 267
:ww
:wr
:sent 6
:ww
:wr
:sent 69
:ww
:rn 75
:rd 5, 75, 0
:rdi 75, 5
:rd 1, 75, 5
:rdi 70, 1
:rd 5, 75, 6
:rdi 69, 5
:rd 64, 75, 11
:rdi 64, 64
:c0 64, 75
connection successfully
Verify certificate...

verify!!!
domain name: '10.0.0.89'
CN: 'Server', no match
certificate doesn't match

verify!!!
domain name: 'Server'
CN: 'Server', no match
certificate doesn't match

:wr
:sent 53
:rn 53
:ww
:wr
:sent 53
:rch 53, 53
:ww
:ur 1
:close
:del
DEBUGV(":abort\r\n");
DEBUGV(":close\r\n");
DEBUGV(":tc err %d\r\n", err);
DEBUGV(":ref %d\r\n", _refcnt);
DEBUGV(":ur %d\r\n", _refcnt);
DEBUGV(":del\r\n");
DEBUGV(":rd %d, %d, %d\r\n", size, _rx_buf->tot_len, _rx_buf_offset);
DEBUGV(":rdi %d, %d\r\n", buf_size, copy_size);
DEBUGV(":pd %d, %d, %d\r\n", size, _rx_buf->tot_len, _rx_buf_offset);
DEBUGV(":rpi %d, %d\r\n", buf_size, copy_size);
DEBUGV(":wr !_pcb\r\n");
DEBUGV(":wr !ERR_OK\r\n");
DEBUGV(":wr\r\n");
DEBUGV(":ww\r\n");
DEBUGV(":sent %d\r\n", len);
DEBUGV(":c0 %d, %d\r\n", size, _rx_buf->tot_len);
DEBUGV(":c %d, %d, %d\r\n", size, _rx_buf->len, _rx_buf->tot_len);
DEBUGV(":rcl\r\n");
DEBUGV(":rch %d, %d\r\n", _rx_buf->tot_len, pb->tot_len);
DEBUGV(":rn %d\r\n", pb->tot_len);
DEBUGV(":er %d %d %d\r\n", err, _size_sent, _send_waiting);

Leave a Reply

Your email address will not be published. Required fields are marked *