Low power using CircuitPython on the new Swan board

I see that the Swan has < 10uA low power mode…will that be supported in CircuitPython/Micropython?

MicroPython has excellent support for the STM32L4, including access to some of the low power modes.

I’m just not sure why Swan decided to support CircuitPython instead of MicroPython for this board; CircuitPython is great but MicroPython’s STM32 support is very mature.

All that said, it wouldn’t be difficult to create a MicroPython board definition and try it out. I’m holding off purchasing a Swan since, at the moment, shipping to Australia is 30% more expensive than the device itself!

1 Like

Hey @matt,

Is there anything specific you get out of MicroPython that you can’t access with CircuitPython (aside from possibly the low power modes)?


Hey Rob,

It’s a little challenging figuring out what’s supported in CircuitPython for the L4 but MicroPython has:

  • Interrupt and asyncio support
  • Usual peripheral support (SPI, I2C, UART - incl LPUART, ADC, DAC, CAN)
  • I2S (relatively new)
  • A secure way to perform upgrades
  • Low power support (light/deep sleep and clock frequency adjustment)
  • LittleFS support (a more robust filesystem)
  • Statically defined pins including optional labels per pin (refer to a pin with machine.Pin.board.SWAN_SPECIFIC_LED or machine.Pin.cpu.C4 or “C4”)

I’m sure there are others. In any case, for the stm port in particular, it’s very easy to create a board. Let me know if you want a hand doing so.


1 Like

This is really useful, thanks! We’re going to look into MicroPython support at some point here, so we’ll do our best to keep folks notified on this thread. :+1:


Great info @matt . Thanks. I certainly wish circuitPython had interrupt support. That’s a big one for me. From what I recall, micropython libraries for sensors and such were far and few between while circuitPython has hundreds (looked at them this morning). I realize there are probably a few little changes needed to make the libraries compatible. In any case, I would like to have what you described in micropython but with all the yummy circuitPython libraries. I want to have my cake and eat it, too.

1 Like

@PostThis CircuitPython libraries are almost all centralised which makes them much easier to find.

MicroPython’s are distributed but, thankfully, Mike Causer is doing a great job indexing a lot of them at his awesome-micropython page. There are a lot listed there but, if you want to use any of the CircuitPython libraries they’re usually pretty trivial to port to MicroPython.

@RobLauer great, I’ll keep an eye on this thread then :slight_smile: I only just noticed there was a published schematic; if I can find any spare time I’ll try and flesh out a basic board definition…


@PostThis I too think robust interrupt support is essential for when external events versus timers need to wake up the processor from low power modes, without limiting the application to simply restarting.

1 Like