Is the M5StickC Plus2 definitely an S3? I’ve been looking at these devices myself, but the only ones I can find use the ESP32-PICO-V3-02. The PICO (like the original ESP32, I believe, and the M5Stack NanoC6 (with its ESP32-C6FH4)) don’t have a native USB interface and rely on a USB to UART on the board. This means they don’t support the TinyUF2 bootloader (allowing flashing via a USB Mass Storage device), and with CircuitPython they won’t present a CIRCUITPYTHON drive to allow easy upload of CircuitPython code. With those ones, you’ve got to use esptool to flash CircuitPython, then use ampy or Thony to upload the Python code over an invisible connection to the REPL that just streams some commands and your code to the device.
I guess it’s not. I went digging and found the same as you – it’s a ESP32-PICO-V3-02.
I’ve never used MicroPython (or CircuitPython) before starting to investigate for the PicoCalc. I’ve been using the ESP32 devices I have with C++ and Ardunio, via PlatformIO, and although the platform specific code is different for each device, the rest of the code has pretty much been the same and I haven’t been bothered by which particular processor or hardware differences there were.
So it seems like it won’t do what you’re looking for. Sorry if my own ignorance in the details of these devices got your hopes up!
It absolutely got my hopes up, but no worries I’ve done some Micropython programming before but have only recently started experimenting with CircuitPython. I like the standard library and, on fully supported boards, the simple “copy code.py to /media/CIRCUITPYTHON” concept. I get enough of casting types and managing memory in my day job, so playing with Python in my spare time is pretty low stress; I spent a few years working in Python jobs and despite the crappy CPython toolchain (venvs are a crutch for bad tooling, and that’s a hill I’ll die on), Python as a language is really nice.
I work as a sysadmin/software engineer at a university, and every now and then one of the teaching staff will decide to run an entry level class or workshop on microcontrollers. and one of the biggest stumbling blocks for less experienced students is the typical MCU toolchain (“why do I need to ‘compile’ my program?”, “why does it take tens of seconds to compile and upload it?”, “why can’t I see results instantly when I save my code, like in JavaScript frameworks with hot reload?”). No to mention, maintaining the toolchains on our lab machines can be a pain. I’m thinking of recommending some cheap dev board with CircuitPython support to my academic colleagues in the future - write your code in VSCode or whatever, and save it to /media/CIRCUITPYTHON/code.py (or, more likely, D:\code.py…) and it instantly reloads and you can see the results. Great for zero friction teaching.
It’s also easier for me to support for researchers - many of them don’t have a solid C background and fumble their way through the IoT portions of their research; I’d much rather help them focus on their research goals (usually just reading some sensor data and sending it to some MQTT broker or a web API) than have them struggle with something more powerful but much less forgiving, when they really just need to write the code once and forget about it until they publish.
Personally, though, I like it just for tinkering. Making toy programs in (neo)vim, saving them to /Volumes/CIRCUITPYTHON/code.py and having them run instantly is pretty fun. As is opening a serial console to a real (Circuit)Python REPL where I can experiment live on the device.
On a similar note, I’m quite interested in the approach the presenter in this video takes for prototyping medical device software in MicroPython. He uses Jupyter Notebook with a remote MicroPython kernel. It looks like there’s a CircuityPython equivalent, too.
It sounds to me that the ESP32-S3 route might make the most usable system given the inclusion of WiFi and Bluetooth. It gets better with an m5launcher-type app which given the screen size makes the picocalc a much better product than the cardputer.
I want to run pico or pico2 with micropython, but I’m interested in ESP32, so I bought the ( ESP32-S3-Pico - Waveshare).
PicoCalc hasn’t arrived yet! ha-ha!!
I’m building a firmware for micropython, but what “st7789_mpy” are you using?
I’m able to create the firmware by freeze .py in russhughes/st7789_mpy, but I don’t have PicoCalc so I don’t really run that firmware, so please let me about st7789 driver.
Yes, I didn’t even compile the firmware myself but directly used the pre-built firmware from this repository. The picocalc uses an ILI9488 screen. Fortunately, through my testing, I found that by only modifying the ST7789 initialization commands, the same program could be used to drive the screen. You can check how I initialized the screen in this file in my repository. PICOCALC-micropython/src/utils/drivers.py at main · jd3096-mpy/PICOCALC-micropython · GitHub
If you’d like to share a firmware binary for testing, I also have the Waveshare ESP32-S3-Pico. So far I’ve just installed the Waveshare provided (old) version of MicroPython on it, and haven’t put it in my PicoCalc yet.
I just received my PicoCalc a day ago. I’d be happy to test your build in it, if you like. I haven’t gotten around to trying the Waveshare module, as I was checking out the samples it came with on the Pico, and also played around a bit with the Pico2 W that I also bought.
I totally understand if you’d rather test it yourself when your PicoCalc arrives.
Of course! Initially, I ported it to the RP2040, but since the RP2040 doesn’t have PSRAM, it may run out of memory when handling complex programs. So, I moved the system to the ESP32-S3 instead. For Python programs, you only need to modify one pin, which is very simple.
At present, it seems that none of the available RP2350 boards come with PSRAM—you have to design a custom PCB to add it. Of course, it’s possible to adapt the system for all boards, but I don’t think it’s necessary, and I don’t have the time to do it. You just need to refer to the schematic and change the pin numbers accordingly.
I tried using the official Waveshare firmware (MicroPython v1.19.1-746-gf2de289ef-dirty on 2023-03-14; ESP32-S3-Pico with ESP32S3):
copied the files from @jd3096’s github to the device
remapped the GPIO pins in all the code from the WalnutPi to the Waveshare (files jojo.py, kb_test.py, main.py, mpy_scr_tst.py)
As expected, it doesn’t contain the screen driver and gives the following error when using mpy_scr_test: ImportError: no module named 'st7789'
However, jojo.py successfully plays music through the PicoCalc speaker. And the kb_test.py shows the keycodes in the serial debug when I press keys on the keyboard.
Also, Thonny can only connect if I have the USB-C cable connected directly to the ESP32-S3-Pico. If I connect to the main PicoCalc USB-C, then I can’t get a serial connection with Thonny. Is this also how it works with the WalnutPi? Not really important, I guess, but it was interesting the passthrough didn’t work like it does on the actual Pico modules.
@BlackPointBeta, exactly how did you build the firmware with the screen driver? Did you follow the instructions at that repo (GitHub - russhughes/st7789_mpy: Fast MicroPython driver for ST7789 display module written in C) or did you customize it in any way? I didn’t see anything on the Waveshare website that included source code. They only posted the binary for MicroPython (which is what I used in this testing), but I’m not sure what they actually used to build it. I didn’t understand your reference to “freeze.py”. I’ve never built MicroPython before, so I’m not sure what, if anything might need to be changed for the Waveshare module during building. Or maybe everything is handled in python afterward, like the pin mappings?
I’m not sure what I was doing wrong before (I might have just been tired!), but I’ve successfuly flashed my Waveshare ESP32-S3-Pico with the same firmware @jd3096 used on the WalnutPi Pico.
I forked the repository and updated mine with the Waveshare pinouts (and a comment to that effect in the readme):
The device successfully boots up, shows the logo, and gets me to a repl prompt. The keyboard works, jojo plays music, etc.
I tried to set up WebREPL, but it seems to conflict and deny connections because of the repl running on the device. I was hoping to be able to connect to it over wifi and not only be able to use the keybaord on the PicoCalc. Using Thonny with the USB-C connected directly to the Waveshare (not the main PicoCalc USB-C) works with the device running on batteries. But when using the serial connection repl in Thonny, the PicoCalc screen fills with text and the keybaord becomes unusable. Scripts still rung though, and I could show the logo, etc.
I couldn’t get some of the scripts to work, but I’m guessing they are just a work in progress? For instance, run.py gives me an error.