8000 Deepsleep go_to_sleep function does not work with UART(1) · Issue #91 · pycom/pycom-micropython-sigfox · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Deepsleep go_to_sleep function does not work with UART(1) #91

Closed
affoltep opened this issue Oct 28, 2017 · 2 comments
Closed

Deepsleep go_to_sleep function does not work with UART(1) #91

affoltep opened this issue Oct 28, 2017 · 2 comments

Comments

@affoltep
Copy link

Please include the following information when submitting a bug report:

  • The Pycom board you are using (e.g. WiPy 2.0, LoPy).
    Lopy

  • The firmware version you are using. You can get it by executing the following Python code at the REPL:

(sysname='LoPy', nodename='LoPy', release='1.9.2.b2', version='v1.8.6-796-g489fafa0 on 2017-10-15', machine='LoPy with ESP32', lorawan='1.0.0' )

The following code prevents the LoPy for changing in deepsleep, issued by the initialization of the UART on port 1:

from machine import UART
from deepsleep import DeepSleep

ds = DeepSleep()


uart = UART(1, 9600)                         # init with given baudrate
uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters
#uart.deinit()
#
ds.go_to_sleep(60)  # go to sleep for 60 seconds

If you uncomment the the uart.deinit() the LoPy crash.

Regards
Peter

@jmarcelino
Copy link
jmarcelino commented Oct 28, 2017

That's because the DeepSleep class also uses UART 1 to communicate with the DeepSleep shield
https://github.com/pycom/pycom-libraries/blob/master/deepsleep/deepsleep.py#L32

If you move the ds = DeepSleep() to be below your UART calls it should work.

@affoltep
Copy link
Author

Many Thank jmarcelino. You are completely right. I should have study the source code before writing an issue ;)

peter-pycom pushed a commit that referenced this issue Feb 28, 2020
also some restructuring and small adjustments
amotl pushed a commit to daq-tools/pycom-micropython that referenced this issue Mar 6, 2020
also some restructuring and small adjustments
X-Ryl669 pushed a commit to X-Ryl669/pycom-micropython-sigfox that referenced this issue May 12, 2023
also some restructuring and small adjustments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0