gmag11 / ESPNtpClient

High accuracy NTP library for ESP32 and ESP8266
MIT License
118 stars 25 forks source link

esp8266 crash on first ntp sync #48

Open Schawen opened 1 year ago

Schawen commented 1 year ago

After adding ESPNtpClient to my project the "WEMOS D1 mini Pro" crash a few sec after boot, when trying to sync ntp (I think(?)).

The main job of the code is to use ADS1115 in continuous mode which does 8 differential measurements per sec. "Continuous mode" does the job in background and uses interrupt to inform the main program that there are new results available.

The ntp interrupt probably conflicts with the ads1115 interrupt ? Can someone confirm my assumption or am I wrong? Is there a way to circumvent this problem?

Output of Arduino exception decoder:

Exception 4: Level1Interrupt: Level-1 interrupt as indicated by set level-1 bits in the INTERRUPT register
Decoding 116 results
0x40216ca0: __esp_delay at ?? line ?
0x40216d23: esp_try_delay(unsigned int, unsigned int, unsigned int) at ?? line ?
0x402044a2: _ZL14hostByNameImplPKcR9IPAddressj14DNSResolveType$part$0 at ESP8266WiFiGeneric.cpp line ?
0x4022073c: SPIClass::endTransaction() at ?? line ?
0x4026345f: sta_input at ?? line ?
0x402634ca: sta_input at ?? line ?
0x4021258e: NTPClient::getTime() at ?? line ?
0x4027c36e: wifi_get_opmode at ?? line ?
0x4027d553: wifi_station_get_connect_status at ?? line ?
0x4021a9fc: std::__detail::__variant::__gen_vtable_impl     >::operator=(std::__detail::__variant::_Move_assign_base   >&&)::{lambda(auto:1&&, auto:2)#1}&&, std::variant   >&)>, std::integer_sequence  >::__visit_invoke(std::__detail::__variant::_Move_assign_base   >::operator=(std::__detail::__variant::_Move_assign_base   >&&)::{lambda(auto:1&&, auto:2)#1}, std::variant   >) at ?? line ?
0x4020499c: ESP8266WiFiSTAClass::status() at ?? line ?
0x402049bc: ESP8266WiFiSTAClass::isConnected() at ?? line ?
0x4021277e: NTPClient::s_getTimeloop(void*) at ?? line ?
0x4021aa9d: std::variant   >::swap(std::variant   >&) at ?? line ?
0x4021aae4: Ticker::_static_callback() at ?? line ?
0x40212720: NTPClient::s_getTimeloop(void*) at ?? line ?
0x4027aac5: ets_timer_handler_isr at ?? line ?
0x4027ab0a: ets_timer_handler_isr at ?? line ?
0x40216aea: loop_task(ETSEventTag*) at core_esp8266_main.cpp line ?
0x40105a3d: call_user_start_local at ?? line ?
0x40105a43: call_user_start_local at ?? line ?
0x4010000d: call_user_start at ?? line ?
0x401000ab: app_entry_redefinable at ?? line ?
0x402177dd: Twi::write_bit(bool) at ?? line ?
0x4021774d: Twi::write_stop() at ?? line ?
0x402179d1: Twi::readFrom(unsigned char, unsigned char*, unsigned int, unsigned char) at ?? line ?
0x40202e2a: TwoWire::requestFrom(unsigned char, unsigned int, bool) at ?? line ?
0x40202e60: TwoWire::requestFrom(unsigned char, unsigned char, unsigned char) at ?? line ?
0x40219714: Adafruit_I2CDevice::_read(unsigned char*, unsigned int, bool) at ?? line ?
0x40219790: Adafruit_I2CDevice::read(unsigned char*, unsigned int, bool) at ?? line ?
0x40203084: Adafruit_ADS1X15::readRegister(unsigned char) at ?? line ?
0x402030b1: Adafruit_ADS1X15::getLastConversionResults() at ?? line ?
0x4010023c: adsNewDataReadyISR() at ?? line ?
0x401008c8: interrupt_handler at ?? line ?
0x401007fc: interrupt_handler at ?? line ?
0x4021e275: SPIClass::transferBytesAligned_(unsigned char const*, unsigned char*, unsigned char) at ?? line ?
0x4021e217: SPIClass::transferBytesAligned_(unsigned char const*, unsigned char*, unsigned char) at ?? line ?
0x4021e1f0: SPIClass::transferBytesAligned_(unsigned char const*, unsigned char*, unsigned char) at ?? line ?
0x40100378: ets_post at ?? line ?
0x401061d5: ets_timer_disarm at ?? line ?
0x4021bba8: FatFile::cmpName(unsigned short, FatLfn_t*, unsigned char) at ?? line ?
0x4021bb98: FatFile::cmpName(unsigned short, FatLfn_t*, unsigned char) at ?? line ?
0x40100378: ets_post at ?? line ?
0x40102ad5: rcUpdateTxDone at ?? line ?
0x401026a4: pp_post at ?? line ?
0x40105923: lmacTxFrame at ?? line ?
0x40104afe: lmacRecycleMPDU at ?? line ?
0x4021e398: SPIClass::transferBytes(unsigned char const*, unsigned char*, unsigned int) at ?? line ?
0x40104f6f: lmacRecycleMPDU at ?? line ?
0x4021d7fe: SdSpiArduinoDriver::receive() at ?? line ?
0x40104a37: lmacProcessTxSuccess at ?? line ?
0x4021d7fe: SdSpiArduinoDriver::receive() at ?? line ?
0x40103900: wDev_ProcessFiq at ?? line ?
0x4021d858: SdSpiArduinoDriver::send(unsigned char) at ?? line ?
0x401035e8: wDev_ProcessFiq at ?? line ?
0x4021bb2d: FatFile::cacheDir(unsigned short) at ?? line ?
0x4022f31e: _scanf_i at /workdir/repo/newlib/newlib/libc/stdio/nano-vfscanf_i.c line 213
0x4022f27c: _scanf_i at /workdir/repo/newlib/newlib/libc/stdio/nano-vfscanf_i.c line 188
0x4021af55: FatFile::readDirCache(bool) at ?? line ?
0x4021bb2d: FatFile::cacheDir(unsigned short) at ?? line ?
0x4021ae53: FatFile::read(void*, unsigned int) at ?? line ?
0x4022e0fc: __ssputs_r at /workdir/repo/newlib/newlib/libc/stdio/nano-vfprintf.c line 179
0x4022f339: _scanf_i at /workdir/repo/newlib/newlib/libc/stdio/nano-vfscanf_i.c line 218
0x40229d64: _strtoul_r at /workdir/repo/newlib/newlib/libc/stdlib/strtoul.c line 195
0x4025f6e3: ieee80211_output_pbuf at ?? line ?
0x4022e969: __ssvfscanf_r at /workdir/repo/newlib/newlib/libc/stdio/nano-vfscanf.c line 336 (discriminator 1)
0x40250999: glue2esp_linkoutput at /local/users/gauchard/arduino/arduino_esp8266/origin/tools/sdk/lwip2/builder/glue-esp/lwip-esp.c line 301
0x402177dd: Twi::write_bit(bool) at ?? line ?
0x4021774d: Twi::write_stop() at ?? line ?
0x402179d1: Twi::readFrom(unsigned char, unsigned char*, unsigned int, unsigned char) at ?? line ?
0x40202e2a: TwoWire::requestFrom(unsigned char, unsigned int, bool) at ?? line ?
0x40202e60: TwoWire::requestFrom(unsigned char, unsigned char, unsigned char) at ?? line ?
0x40104afe: lmacRecycleMPDU at ?? line ?
0x40219714: Adafruit_I2CDevice::_read(unsigned char*, unsigned int, bool) at ?? line ?
0x40219790: Adafruit_I2CDevice::read(unsigned char*, unsigned int, bool) at ?? line ?
0x40265ac3: ieee80211_add_ie_vendor_esp_freq_annon at ?? line ?
0x402177dd: Twi::write_bit(bool) at ?? line ?
0x4021774d: Twi::write_stop() at ?? line ?
0x4022e648: _sungetc_r at /workdir/repo/newlib/newlib/libc/stdio/nano-vfscanf.c line 183
0x4022e6dc: __ssrefill_r at /workdir/repo/newlib/newlib/libc/stdio/nano-vfscanf.c line 230
0x40100378: ets_post at ?? line ?
0x402177dd: Twi::write_bit(bool) at ?? line ?
0x4021774d: Twi::write_stop() at ?? line ?
0x40100378: ets_post at ?? line ?
0x401026a4: pp_post at ?? line ?
0x4010593b: lmacRxDone at ?? line ?
0x4010322f: rcReachRetryLimit at ?? line ?
0x40202e2a: TwoWire::requestFrom(unsigned char, unsigned int, bool) at ?? line ?
0x4010340c: rcReachRetryLimit at ?? line ?
0x40219714: Adafruit_I2CDevice::_read(unsigned char*, unsigned int, bool) at ?? line ?
0x401038c6: wDev_ProcessFiq at ?? line ?
0x40105923: lmacTxFrame at ?? line ?
0x40100378: ets_post at ?? line ?
0x401065c3: system_get_time at ?? line ?
0x401061d5: ets_timer_disarm at ?? line ?
0x40218fc6: run_scheduled_functions() at ?? line ?
0x40216d60: loop_end at ?? line ?
0x40106319: ets_timer_arm_new at ?? line ?
0x40251978: memp_malloc at /local/users/gauchard/arduino/arduino_esp8266/origin/tools/sdk/lwip2/builder/lwip2-src/src/core/memp.c line 356
0x40211a95: NTPClient::begin(char const*, bool) at ?? line ?
0x40212c84: NTPClient::s_receiverTask(void*) at ?? line ?
0x40202c0d: loop at ?? line ?
0x4025275b: tcp_listen_with_backlog at /local/users/gauchard/arduino/arduino_esp8266/origin/tools/sdk/lwip2/builder/lwip2-src/src/core/tcp.c line 830