You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently dipping my feet into MicroPython, specifically the SAMD port. As part of this, I am trying to port an Arduino project I wrote some time ago. One feature of this Arduino project for the SAMD21 (Arduino Zero compatible) is the use of the Arduino Low Power library to enter a sleep state, and to wake up from said sleep state when a particular pin is asserted (an IRQ pin from an accelerometer). I have browsed the MicroPython documentation and I see the methods to enter light sleep and deep sleep, but I do not see a way to make a machine.Pin wake up the board on an incoming signal.
The MicroPython documentation references a wake parameter of the Pin.irq() method, to be used with the constants machine.IDLE, machine.SLEEP or machine.DEEPSLEEP. However, these constants are not available in the machine module for the SAMD21. Also, from a cursory examination of the source code, the SAMD port does not appear to implement the wake parameter either.
Is wake-on-pin available in the first place in the SAMD21 port?
The firmware file I downloaded is: SAMD_GENERIC_D21X18-20260406-v1.28.0.
The lightsleep and deepsleep methods do not use the Arduino Low Power library to enter a sleep state. Instead, the board is just configured to the lowest suitable clock frequency, which is 200kHz. The firmware stays active, but at low pace and low power consumption.
If at that time a Pin IRQ is noticed, the board MCU is reconfigured to full speed again.
So you can use any pin as wake pin. You only have to configure a Pin.IRQ for that Pin before calling e.g. lightsleep. The only difference between these two is, that with deepsleep a reset is performed when the sleep terminates.
The current at lightsleep/deepsleep is about 500µA for the SAMD21, measured with a SEEED XIAO board with removed power LED. But that will vary with each board configuration. You can get a similar behavior by just configuring the board to a lower clock frequency using machine.freq(). The lowest accepted value is 1 MHz. USB works down to 8 MHz clock frequency.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I am currently dipping my feet into MicroPython, specifically the SAMD port. As part of this, I am trying to port an Arduino project I wrote some time ago. One feature of this Arduino project for the SAMD21 (Arduino Zero compatible) is the use of the
Arduino Low Powerlibrary to enter a sleep state, and to wake up from said sleep state when a particular pin is asserted (an IRQ pin from an accelerometer). I have browsed the MicroPython documentation and I see the methods to enter light sleep and deep sleep, but I do not see a way to make amachine.Pinwake up the board on an incoming signal.The MicroPython documentation references a
wakeparameter of thePin.irq()method, to be used with the constantsmachine.IDLE,machine.SLEEPormachine.DEEPSLEEP. However, these constants are not available in themachinemodule for the SAMD21. Also, from a cursory examination of the source code, the SAMD port does not appear to implement thewakeparameter either.Is wake-on-pin available in the first place in the SAMD21 port?
The firmware file I downloaded is:
SAMD_GENERIC_D21X18-20260406-v1.28.0.All reactions