Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Holger Lembke
@holgerlembke
Question about time.h: Is there any info about how often a "time(nullptr)" call will result in an NTP query?
Does it happen always?
bwjohns4
@bwjohns4
Hey all, I’m using WiFimanager libary and the the WiFimanager parameters are defined like this:
Hey all, I’m using WiFimanager libary and the the WiFimanager parameters are defined like this: WiFiManagerParameter(const char *custom); Im trying to pass a PROGMEM char[] it by doing String(FPSTR()).c_str() and getting really weird results. It compiles but just doesn’t appear to work correctly. Does anyone know a better way to do this?
david gauchard
@d-a-v

Question about time.h: Is there any info about how often a "time(nullptr)" call will result in an NTP query?

@holgerlembke NTP server is queried once every hour by default, to set or adjust relatively to internal time. Internal time is given by micros64().

@bwjohns4 You are giving a temporary pointer. Your String should exist globally to hold the .c_str() pointer right. That's because WiFiManager (probably) keeps the raw pointer you passes instead of copying its content to a safe location (@tablatronix ?)
Holger Lembke
@holgerlembke
@d-a-v Thank you!
Holger Lembke
@holgerlembke
@d-a-v Do you know of any better documentation of the time-stuff in esp8266?
david gauchard
@d-a-v
Can you thoroughly read the NTP-TZ-DST.ino example and report what is unclear so we can add missing details in it ? @holgerlembke
Holger Lembke
@holgerlembke
@d-a-v as far as I see, it is total sunshine only code with any failure management. what and how to check if ntp call fails?
I found https://github.com/esp8266/Arduino/blob/master/tests/device/test_time/test_time.ino more reduced to the needed code. would make a better example for starters.
david gauchard
@d-a-v
@holgerlembke
Well, if NTP servers do not answer, the link may be down, or you would set new ones after some timeout. The example you show does not use automatic timezone.
If you have a good idea for starters, please make a proposal !
Also, there's an ongoing PR esp8266/Arduino#7637 that I forgot to mention, which improves the API and simplify the ntp-tz-dst example.
StanJ
@Tech-TX
@holgerlembke the NTP code from last year also queried the NTP server every time I reconnected WiFi. I haven't used it again since July 2019, so that may have changed. For something that makes & breaks WiFi frequently, that's a lot of NTP traffic.
david gauchard
@d-a-v
sntp timer is reset when dhcp client starts, at every new wifi re/connections. It can be disabled as shown in the NTP-TZ-DST example. I believe SNTP traffic is quite low anyway.
Erriez
@Erriez
Does anyone have experiences to open a full ESP8266 flash dump with a disassembler (preferably free tools)?
StanJ
@Tech-TX
I've seen a couple of them, but it's LOADS easier if you have the .elf file. IDA Pro can disassemble it (there's a plug-in for Espressif, google: themadinvenntor ida-xtensa-master) and there's another on Github that one gent used to partially disassemble the SDK, creating his own version of the sdk: https://github.com/pfalcon/esp-open-sdk . There's yet a third, but I haven't used it and can't find the git repo at the moment. It looked... cumbersome to disassemble and didn't appear to have any better luck than objdump did.
see also:
Here's the one I couldn't remember: ScratchABit by pfalcon:
https://libraries.io/github/pfalcon/ScratchABit
StanJ
@Tech-TX
bbs.espressif.com oopsie.jpg
Oopsie at bbs.espressif.com:
That's weird: gitter doesn't do inline images?
tobozo
@tobozo
@Tech-TX it still does but the image query gets a 502 status (Bad Gateway), let's hope it's only a temporary glitch
EngRanya
@EngRanya
Hey All, I'm using HTTP request to POST parameters to database using host URL , It worked well . but when I added WIFIManager in my code , HTTP Request returns -1 and connection Fails , what 's the problem ?
The url worked on POSTMAN and wifi network connected Successfully using WIFIManager
EngRanya
@EngRanya
any help ?
FrFrey98
@FrFrey98

Hey,
I have a problem while trying to use the Feather Huzzah (https://www.adafruit.com/product/3213) with the Ardurino IDE. I configurated the IDE like it is recommended in here : https://learn.adafruit.com/adafruit-fea ... rduino-ide, but when I try to upload my code I get the message "esptool.FatalError: Invalid head of packet (0x46)". I even tried it not with my own code but with the Blink test code from the same article, but the error message stays the same.
Maybe someone has an idea where this problem comes from.
I am from Germany so excuse me if my english is not perfect.
Here ist the completet log of the Arduino IDE:

Arduino: 1.8.13 (Windows 10), Board: "Adafruit Feather HUZZAH ESP8266, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Executable segment sizes:

IROM : 237664 - code in flash (default or ICACHE_FLASH_ATTR)

IRAM : 28080 / 32768 - code in IRAM (ICACHE_RAM_ATTR, ISRs...)

DATA : 1260 ) - initialized variables (global, static) in RAM/HEAP

RODATA : 804 ) / 81920 - constants (global, static) in RAM/HEAP

BSS : 25464 ) - zeroed variables (global, static) in RAM/HEAP

Der Sketch verwendet 267808 Bytes (25%) des Programmspeicherplatzes. Das Maximum sind 1044464 Bytes.

Globale Variablen verwenden 27528 Bytes (33%) des dynamischen Speichers, 54392 Bytes für lokale Variablen verbleiben. Das Maximum sind 81920 Bytes.

esptool.py v2.8

Serial port COM3

Connecting....

Chip is ESP8266EX

Features: WiFi

WARNING: Detected crystal freq 20.22MHz is quite different to normalized freq 26MHz. Unsupported crystal in use?

Crystal is 26MHz

MAC: 00:08:ff:00:00:00

Uploading stub...

Running stub...

Traceback (most recent call last):

File "C:\IoTW\arduino-1.8.13\portable\packages\esp8266\hardware\esp8266\2.7.2/tools/upload.py", line 65, in

esptool.main(cmdline)

File "C:/IoTW/arduino-1.8.13/portable/packages/esp8266/hardware/esp8266/2.7.2/tools/esptool\esptool.py", line 2909, in main

esp = esp.run_stub()

File "C:/IoTW/arduino-1.8.13/portable/packages/esp8266/hardware/esp8266/2.7.2/tools/esptool\esptool.py", line 637, in run_stub

p = self.read()

File "C:/IoTW/arduino-1.8.13/portable/packages/esp8266/hardware/esp8266/2.7.2/tools/esptool\esptool.py", line 292, in read

return next(self._slip_reader)

File "C:/IoTW/arduino-1.8.13/portable/packages/esp8266/hardware/esp8266/2.7.2/tools/esptool\esptool.py", line 2057, in slip_reader

raise FatalError('Invalid head of packet (0x%s)' % hexify(b))

esptool.FatalError: Invalid head of packet (0x46)

esptool.FatalError: Invalid head of packet (0x46)

Dieser Bericht wäre detaillierter, wenn die Option
"Ausführliche Ausgabe während der Kompilierung"
in Datei -> Voreinstellungen aktiviert wäre.

Earle F. Philhower, III
@earlephilhower

WARNING: Detected crystal freq 20.22MHz is quite different to normalized freq 26MHz. Unsupported crystal in use?

There's something fishy with the board or the serial<->USB adapter is what esptool is saying here.

FrFrey98
@FrFrey98
I've tried it in multiple usb ports and with different cables, so the board may be defect?
and thanks for the response!
Earle F. Philhower, III
@earlephilhower
That would be my guess. I've never seen anything like that, but it's obviously doing something very bad.
Whatever the cause, it's not related to your code or esptool.
FrFrey98
@FrFrey98
Ok, thank you. And what exactly is this crystal freq?
Earle F. Philhower, III
@earlephilhower
The external oscillator for the chip. A board component. Run through a PLL to get the 80/160MHz used internally.
Juraj Andrássy
@jandrassy
I see that message when I upload to a esp8266 on Uno WiFi Dev Ed. It has a 40 MHz crystal. The esp8266 is accessible only over the ATmega. And I use a passthrough sketch which has 115200 at USB side and 230400 baud at esp8266 side.
Earle F. Philhower, III
@earlephilhower
Ah, strange. @FrFrey98 said he's using a plain board, though, no Arduino+ESP combo or passthrough.
Juraj Andrássy
@jandrassy
yes, the adafruit huzzah has a 26 MHz crystal and the CP2104 USB chip
FrFrey98
@FrFrey98
so what does this mean?
Drzony
@drzony
@FrFrey98 some USB->Serial converters do not like USB3.0 ports
can you connect to your board using Arduino Serial Monitor?
FrFrey98
@FrFrey98
I also tried a usb 2.0 port
How can i connect something with the arduino serial monitor?
Drzony
@drzony
Tools->Serial Monitor
Juraj Andrássy
@jandrassy
try the baud rate recommended by Adafruit: 921600 baud
StanJ
@Tech-TX

I think 921600 baud is too fast if it won't work at 115200. I looked up the Huzzah at Adafruit's site and found this:

I'm stuck in bootloader mode and can't upload
You say your led is stuck on dim and you get an error trying to upload? And you're sure your serial cable is connected and working correctly? Well, here's a potential fix: Connect the GPIO0 pin to GND through a 220 ohm resistor. Leave it connected while you upload. You may have to try it a couple of times, but it should eventually upload and get the HUZZAH unstuck from bootload mode! You can then remove the resistor connection, and your HUZZAH will be happy ever after!
(Note: you may also have to tie RST and EN (CH_PD) together to get this to work. Remove the connection once you have the module programmed).

Looks like the Huzzah is using an AI Thinker ESP-12E module, which should be reliable. I have a big handful of the AI ESP-12F and -12S modules here at home, never had problems with them. I looked at the Huzzah schematic and it appears to be a solid design, no funny business.

https://docs.ai-thinker.com/_media/esp8266/docs/esp12e_datasheet.pdf

StanJ
@Tech-TX
adafruit Feather ESP8266 HUZZAH programming sch.jpg
That looks like the root cause of the GPIO0 issue with the Huzzah. They have an LED through a 1K current limiting resistor on GPIO0. I'd have used a higher efficiency LED and a higher value resistor myself. The trick above about grounding GPIO0 through a 220 ohm resistor should help, if that LED is the source of the problem.
Juraj Andrássy
@jandrassy
what is this with io 0? the esp8266 is already in bootloader mode and stub is uploaded
StanJ
@Tech-TX
I don't know absolutely that the SDK doesn't check GPIO0 again during the hand-off to the flash upload code. Without that, I see a problem that's avoidable. Whether it's causing what @FrFrey98 is seeing only he can tell us. I haven't seen any other boards hanging a strong pull-up on GPIO0 like that.
Juraj Andrássy
@jandrassy
it doesn't matter at that time. some have io 0 wired all the time to ground some have buttons and hold io 0 only for the short time of the reset.