Deep Sleep not working
-
I'm using a LoPy + Pysense with the latest firmware (1.7.5b2) and today's Pysense libraries from Github.
With this minimal program:
import pycom import utime from lib.pysense import Pysense py = Pysense() pycom.rgbled(0xff00ff) utime.sleep_ms(1000) pycom.rgbled(0xff0000) utime.sleep_ms(1000) py.setup_sleep(3) py.go_to_sleep()
...the LED should turn pink for 1 second, then red for 1 second, and then sleep for 3 seconds.
What happens is that the LED turns pink, then red, and then stays red.
The USB device can still be found on the computer and I can still connect to the LoPy via WLAN (though usually not get a shell).
Sometimes I managed to get into the shell via WLAN when waiting for a while and saw this error message:
Traceback (most recent call last): File "main.py", line 10, in <module> File "lib/pysense.py", line 138, in setup_sleep File "lib/pysense.py", line 157, in calibrate_rtc IndexError: list index out of range
Any ideas? Was the current library successfully tested with the current Pysense board?
-
@dbrgn I'm having the same issue and I can reproduce it even with all latest firmware
So to get back to your original question, is there a way to reset PIC with a Lopy GPIO, ie in case of I2C Error, reset the PIC should recover. Can we locate the PIC reset pin on the PySense/PyTrack boards? I would like to solder a wire from LoPy GPIO on it.It's difficult to tell our customers to recycle power on devices located in the field.
-
Just discovered another oddity:
Running the pytrack for a whole night the PIC on the pytrack seems to have locked up some how which caused the following loop being repeated infinite times. No clue why the lopy resets in the first place tough ...ets Jun 8 2016 00:22:57 rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0x00 clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:QIO, clock div:2 load:0x3fff9010,len:12 ho 0 tail 12 room 4 load:0x3fff9020,len:388 load:0x40078000,len:11412 load:0x4009fc00,len:848 entry 0x4009fd9c INFO:main:System booted INFO:main:(sysname='LoPy', nodename='LoPy', release='1.7.6.b1', version='v1.8.6-703-g5e80328a on 2017-07-05', machine='LoPy with ESP32', lorawan='1.0.0') Traceback (most recent call last): File "main.py", line 19, in <module> File "pytrack.py", line 76, in __init__ Exception: Pytrack board not detected MicroPython v1.8.6-703-g5e80328a on 2017-07-05; LoPy with ESP32 Type "help()" for more information. >>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ets Jun 8 2016 00:22:57 rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0x00 clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:QIO, clock div:2 load:0x3fff9010,len:12 ho 0 tail 12 room 4 load:0x3fff9020,len:388 load:0x40078000,len:11412 load:0x4009fc00,len:848 entry 0x4009fd9c INFO:main:System booted INFO:main:(sysname='LoPy', nodename='LoPy', release='1.7.6.b1', version='v1.8.6-703-g5e80328a on 2017-07-05', machine='LoPy with ESP32', lorawan='1.0.0') Traceback (most recent call last): File "main.py", line 19, in <module> File "pytrack.py", line 76, in __init__ Exception: Pytrack board not detected MicroPython v1.8.6-703-g5e80328a on 2017-07-05; LoPy with ESP32 Type "help()" for more information. >>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Does anybody know if there is a way to perform a reset of the pic from the lopy?
-
@dbrgn I had the same problem and solved it in the same way. In my case it was the older firmware that does not support a call to "I2C.deinit()" causing a hang. The newer firmware does support it.
-
Ah, you are right. It does not freeze, connecting from telnet is still possible afterwards! Still the serial connection is in a strange state. Trying to connect over a serial connection does work but I my case chars typed on the serial console will not show up, however they show up in the telnet connection (very strange...) Looks like tx from the pc over the serial connection is working but not rx ... (that made me believe it freezed).
-
@this.wiederkehr I'm having similar problems that the serial connection immediately drops when calling
setup_sleep
. Probably the same underlying issue. I don't think it freezes in my case though.
-
I am having some issues with sleep on the pytrack (and lopy) too. I am on the newest firmware 1.7.6.b1 and the Pysense firmware to 0.0.3. There seems to be an interference between serial communication over the uart (connected over the micro usb port of the pytrack) to the pc and the calibrate_rtc function (this function is called when doing Pytrack().setup_sleep().
Specifically: If I call calibrate_rtc over the serial connection the board will immediatly freeze, even a reset of the lopy is not enough to recover the pytrack. To recover from this I have to powercycle the pytrack thus i think this is an issue in the pic firmware.
If I do not have a serial connection from the pc open and call the function calibrate_rtc from telnet everything seems fine.
@daniel: Is a serial connection during calibrate_rtc not supported or is this an issue in the firmware of the pic?
-
It seems to work now after upgrading the LoPy firmware to 1.7.6.b1 and the Pysense firmware to 0.0.3.