Newbie questions about reasons to use MicroPython

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
davegravy
Posts: 1
Joined: Fri Jun 10, 2022 1:54 pm

Newbie questions about reasons to use MicroPython

Post by davegravy » Fri Jun 10, 2022 2:12 pm

Hi!

I don't know much about MicroPython yet but I've been programming in CPython for years. Please let me know if the following is not really a valid use-case for MicroPython, or if it's not likely to help me out much.

I want to start to develop for a somewhat constrained SBC running Debian and later shrink to an MCU. For ease of development I was considering implementing my first iteration in CPython and then reimplementing in C/C++ for RTOS or baremetal MCU. When I discovered MicroPython I thought potentially I could start with it on the SBC and reduce some of the reimplementation effort as I further constrain my hardware.

My reason for wanting to start with an SBC running Debian is for the USB drivers; I need to read a sensor that demands a USB host, and the network stack will be handy.

In future iterations I hope to eliminate the need for the bloat of USB, and to switch to an embedded cell module (UART) for internet comms.

Thanks!

David

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Newbie questions about reasons to use MicroPython

Post by pythoncoder » Sat Jun 11, 2022 7:43 am

You can run the Unix build of MP under Debian. MP aims to be a compatible subset of CPython, so developing under the Unix build of MP is ideal if you plan to port your code to a microcontroller. Porting effort should then be merely to accommodate hardware differences.
Peter Hinch
Index to my micropython libraries.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Newbie questions about reasons to use MicroPython

Post by jimmo » Mon Jun 20, 2022 5:36 am

davegravy wrote:
Fri Jun 10, 2022 2:12 pm
When I discovered MicroPython I thought potentially I could start with it on the SBC and reduce some of the reimplementation effort as I further constrain my hardware.
pythoncoder wrote:
Sat Jun 11, 2022 7:43 am
You can run the Unix build of MP under Debian. MP aims to be a compatible subset of CPython, so developing under the Unix build of MP is ideal if you plan to port your code to a microcontroller. Porting effort should then be merely to accommodate hardware differences.
The only limitation will be accessing hardware features from the unix build of micropython. There are a wide variety of CPython libraries for working with the Linux gpio/spi/i2c devices (e.g. https://pypi.org/project/spidev/ ) but "out of the box" the MicroPython port for Linux has none of these features, but this shouldn't be a showstopper (e.g. you could access gpio sysfs via file i/o).

KJM
Posts: 158
Joined: Sun Nov 18, 2018 10:53 pm
Location: Sydney AU

Re: Newbie questions about reasons to use MicroPython

Post by KJM » Tue Jun 21, 2022 1:24 am

I've been programming microcontrollers in upython for a couple of years now & repl development is nice. But I sometimes wonder if the time saved by not having to recompile after each code change is not lost by trying to find upython libs to match the wealth of stuff out there in C++ ?

Every time I want to use lora on a new lora equipped esp32 board for example it's a big deal to find the right upython drivers for that board, when they're ready to go in the arduino style IDE.

Post Reply