Wakeup with UART (LoPy4)
-
Hello guys. I am trying to communicate with a Lopy4 through its serial port. In paticular by UART 1. (P3 and P4). Furthermore, the LoPy4 must be in sleep mode.
I need to wake up the LoPy4 using the UART port. I have tried using the following code:from machine import UART import time print("Starting Loop...") uart = UART(1, baudrate=9600, bits=8, parity=None, stop=1, pins=('P3', 'P4')) i = 0 while True: print("*****************************: %d" % i) print("Going to sleep") machine.pin_sleep_wakeup([('P4')], mode=machine.WAKEUP_ALL_LOW, enable_pull=True) time.sleep(1) machine.sleep() print("Weak up...") (wake_reason, gpio_list) = machine.wake_reason() if(wake_reason==machine.PWRON_WAKE): print("Wake up for Power On") elif(wake_reason==machine.PIN_WAKE): print("Wake up for PIN") elif(wake_reason==machine.RTC_WAKE): print("Wake up for RTC") elif(wake_reason==machine.ULP_WAKE): print("Wake up for ULP") else: print("Wake up undefined") n_bytes = uart.any() print(n_bytes) buff = uart.read(n_bytes) # read up to 5 bytes print(buff) i = i + 1The problem is that the LoPy cannot read the bytes sent to it correctly. Has anyone been able to wake up a LoPy using the serial port?
Thanks
-
Topic is old but I want to bump it anyway.
Same problem here. Received message with this method is unusable.
This might be why (from ESP32 documentation on UART wakeup):
"Note that the character which triggers wakeup (and any characters before it) will not be received by the UART after wakeup. This means that the external device typically needs to send an extra character to the ESP32 to trigger wakeup, before sending the data."
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login