station.scan() issue on ESP32
Re: station.scan() issue on ESP32
Thanks for that.
Yes please, I would like to see the circuit diagram for this, sounds like teh 25 sec design is teh one you suggest
So we have the tri state as follows if I understand it right
1) Output ==> low
2) Output ==> high
3) Input
If the microcontroller freezes whilst in any of these three states, will the WDT trigger after a timeout period and thus reset the microcontroller ?
Yes please, I would like to see the circuit diagram for this, sounds like teh 25 sec design is teh one you suggest
So we have the tri state as follows if I understand it right
1) Output ==> low
2) Output ==> high
3) Input
If the microcontroller freezes whilst in any of these three states, will the WDT trigger after a timeout period and thus reset the microcontroller ?
Re: station.scan() issue on ESP32
- as output toggle 33
- pin 33 to tri-state
- do some processing represented by utime.sleep(1), ie less then the 1.6 seconds
- pin 33 back to output
I have seen a more concise way of toggling a pin.
I will do a schematic this evening, give me about 10-12 hours.
- pin 33 to tri-state
- do some processing represented by utime.sleep(1), ie less then the 1.6 seconds
- pin 33 back to output
I have seen a more concise way of toggling a pin.
I will do a schematic this evening, give me about 10-12 hours.
Re: station.scan() issue on ESP32
Ahead of schedule!
It is actually a .pdf I took a photo but it is too big.
It is actually a .pdf I took a photo but it is too big.
- Attachments
-
- Hardware watchdog.zip
- (10.69 KiB) Downloaded 173 times
Re: station.scan() issue on ESP32
Thanks for that
Unfortunately I cannot open that zip file, 7-zip thinks it is corrupted or not a valid archive file
Unfortunately I cannot open that zip file, 7-zip thinks it is corrupted or not a valid archive file
Re: station.scan() issue on ESP32
I have sent you a PM. Did you change the extension to .pdf?
Re: station.scan() issue on ESP32
Hi Dave
Not sure where the PM goes to as I did not get anything with that
You are right, renaming it to pdf did the trick . I assumed that as it was a zip suffix, I would need to iunzip it
Thanks for the circuit diagram and code . Nice and simple
If you had to do it again, which device would you buy. I know you already mentioned the 25 sec one to save doing too many pats, especially usefull when there is a long task in the microprocessor waiting on some response from something out of one's control but I note that is a whole host of variants for thresholds, etc ...
Where did you get the design notes for this (other than the tech doc for the device ?)
I will look into building one
Out of interest, on the ESP32, i have tested the internal watchdog to see how long a period I can set, and so far I have managed to get up to five minutes and it still workls fine and resets the microprocessor. Quite useful compared to 25 sec max on the AMD63, but academic really as 25 seconds should be more than enough for most cases
Not sure where the PM goes to as I did not get anything with that
You are right, renaming it to pdf did the trick . I assumed that as it was a zip suffix, I would need to iunzip it
Thanks for the circuit diagram and code . Nice and simple
If you had to do it again, which device would you buy. I know you already mentioned the 25 sec one to save doing too many pats, especially usefull when there is a long task in the microprocessor waiting on some response from something out of one's control but I note that is a whole host of variants for thresholds, etc ...
Where did you get the design notes for this (other than the tech doc for the device ?)
I will look into building one
Out of interest, on the ESP32, i have tested the internal watchdog to see how long a period I can set, and so far I have managed to get up to five minutes and it still workls fine and resets the microprocessor. Quite useful compared to 25 sec max on the AMD63, but academic really as 25 seconds should be more than enough for most cases
Re: station.scan() issue on ESP32
The PM was sent. You might need to set it up ... it's been a long time. The Private Message icon should be near the top right corner.
You can not attach .pdf to a message. I did mention that in the message.
I mentioned 25 seconds because WiFi connections and getting NTP time can take many seconds. That hardware wdt can be disabled, so if you are happy to let something connect you can just disable it.
Found some more related code:
Just from the datasheet and 50 years designing hardware.
There have been some threads on here about really long periods.
You can not attach .pdf to a message. I did mention that in the message.
I mentioned 25 seconds because WiFi connections and getting NTP time can take many seconds. That hardware wdt can be disabled, so if you are happy to let something connect you can just disable it.
Found some more related code:
Code: Select all
# H/W WDT methods
from machine import Pin
#HW_WDT_PIN = 33
#hw_wdt_pin = Pin(HW_WDT_PIN, Pin.OUT)
hw_wdt_pin = Pin(33, Pin.OUT)
# disable H/W watchdog
def disable_hw_wdt():
hw_wdt_pin.init(mode = hw_wdt_pin.IN) # change to input so that WDT chip doesn't reset
# enable H/W watchdog
def enable_hw_wdt():
hw_wdt_pin.init(mode = hw_wdt_pin.OUT) # change back to output
# pat the watchdog
def pat_the_dog():
# led = Pin(13, Pin.OUT)
# led.value(not led.value())
hw_wdt_pin.value(not hw_wdt_pin.value()) # toggle WDT input
There have been some threads on here about really long periods.
Re: station.scan() issue on ESP32
Hi Dave
I am still confused about tristating the WDI and why it is needed
The tech document says
""" Watchdog Input. Generates a reset if the logic level on the pin remains low
or high for the duration of the watchdog timeout. The timer is cleared if a
logic transition occurs on this pin or if a reset is generated. Leave this pin
floating to disable the watchdog timer. """
If you tristate it, ie switch it to input as you suggest, that will disable the watchdog function from what I can see as it would thus be floating ?, so if the microprocessor freezes whilst in this state, I assume that the WDT will never drive the reset of the microprocessor ?
I think I am probably not fully understanding how this works
Thanks Dave
I am still confused about tristating the WDI and why it is needed
The tech document says
""" Watchdog Input. Generates a reset if the logic level on the pin remains low
or high for the duration of the watchdog timeout. The timer is cleared if a
logic transition occurs on this pin or if a reset is generated. Leave this pin
floating to disable the watchdog timer. """
If you tristate it, ie switch it to input as you suggest, that will disable the watchdog function from what I can see as it would thus be floating ?, so if the microprocessor freezes whilst in this state, I assume that the WDT will never drive the reset of the microprocessor ?
I think I am probably not fully understanding how this works
Thanks Dave
Re: station.scan() issue on ESP32
Correct,
I connect at the beginning of a script and when successfully connected to WiFi run my main script with watchdog enabled.
With a 25 second wdt I would be happy sprinkling "pat-the-dog()" through-out the connect phase.
Did you find the PM?
probably clearer to say, you could disable the watchdog for some periods BUT you will lose protection.so if you are happy to let something connect you can just disable it.
I connect at the beginning of a script and when successfully connected to WiFi run my main script with watchdog enabled.
With a 25 second wdt I would be happy sprinkling "pat-the-dog()" through-out the connect phase.
Did you find the PM?
Re: station.scan() issue on ESP32
Thanks Dave
I can see what you were trying to say now ...
Yes, with the 25 second part, the ESP32 would boot and connect within that time, so the WDT could be enabled from the start
which is what I would want as with my luck, I would get a freeze before I enable the WDT and would then have to take a trip in the car to go and reset everything
How would one enable the WDT permanently ?
If one waits until the ESP32 has booted to be able to put the WDT pin in output state, there is still a small chance that you could get a freeze during the boot process and leave you frozen (very small but still a possibiity)
I guess one could place a pull up/down resistor on the WDI pin so that it is by default in an up or down state whenit start , and then pull it up or down as needed from the ESP32 (If teh ESP32 started in input mode on WDI , it then should not matter as teh pull up/down resistor on WDI would ensure it is enabled ?
I am not sure what the WDT would do though once it has reached the 25 second timeout. Yes it would pull the the EN pin down or up, but then what happens ? does it lift it up again after a few milliseconds and then restart the 25 second timeout, ad infinitum (if so that is workable)
No I do not have a PM from you . Where woudl I look for that ???
Thanks Dave
I can see what you were trying to say now ...
Yes, with the 25 second part, the ESP32 would boot and connect within that time, so the WDT could be enabled from the start
which is what I would want as with my luck, I would get a freeze before I enable the WDT and would then have to take a trip in the car to go and reset everything
How would one enable the WDT permanently ?
If one waits until the ESP32 has booted to be able to put the WDT pin in output state, there is still a small chance that you could get a freeze during the boot process and leave you frozen (very small but still a possibiity)
I guess one could place a pull up/down resistor on the WDI pin so that it is by default in an up or down state whenit start , and then pull it up or down as needed from the ESP32 (If teh ESP32 started in input mode on WDI , it then should not matter as teh pull up/down resistor on WDI would ensure it is enabled ?
I am not sure what the WDT would do though once it has reached the 25 second timeout. Yes it would pull the the EN pin down or up, but then what happens ? does it lift it up again after a few milliseconds and then restart the 25 second timeout, ad infinitum (if so that is workable)
No I do not have a PM from you . Where woudl I look for that ???
Thanks Dave