samd51: MicroPython on the Seeed Wio Terminal #9838
Replies: 10 comments 49 replies
-
Just read through the blurb on the website ... does the WiFi work on Micropython? |
Beta Was this translation helpful? Give feedback.
-
@scruss Thank you for the tutorial. It looks good and reads well. Two remarks:
Edit: |
Beta Was this translation helpful? Give feedback.
-
So I made a comparison, loading both drivers into RAM from the .py files and mounting the device, using |
Beta Was this translation helpful? Give feedback.
-
LFS1 seems to buffer data as give by the progsize parameter in the vfs constructor. |
Beta Was this translation helpful? Give feedback.
-
Quick question regarding the mount script, should the flash be mounted to "/" instead of "/flash"? When mounting at "/flash" I have to install libraries in "/flash/lib" and import using from flash.lib import mylib which doesn't seem correct, but I'm probably missing something! |
Beta Was this translation helpful? Give feedback.
-
The ili9341 micropython driver is a bit slow, would it be possible to build a c driver like https://github.com/russhughes/ili9342c_mpy into the firmware? I noticed it has been developed/tested on an esp32 but I assume if the code is c it could be also used on the samd51? |
Beta Was this translation helpful? Give feedback.
-
@scruss great article One trap for new players is that if the directory "SD" doesn't exist then the SD card will not mount and report "SD card not found", could be good to add a note in the article to create "SD" or catch the OSError: [Errno 1] EPERM error. |
Beta Was this translation helpful? Give feedback.
-
As an exercise, I made a C version of the raw flaw driver class in flashbdev.py. It's a little bit smaller than the .py version, and when operating with a hard SPI interface, file accesses are more snappy, especially the short ones. With SoftSPI, there is no noticeable difference. As next step I plan to add a QSPI flash driver, which gives hardware speed to the flash of SAMD51 devices like the WIO terminal or Adafruit SAMD51 boards. The branch is here: https://github.com/robert-hh/micropython/tree/samd_spiflash |
Beta Was this translation helpful? Give feedback.
-
The branch at https://github.com/robert-hh/micropython/tree/samd_spiflash is now extended by a C-Code QSPI flash class in machine. It is based on a Adafruit QSPI driver. That speeds up flash access on SAMD51 devices with QSPI Flash substantially. It uses the same small flashbdev.py driver as the SPI flash class. If you build the firmware yourself, this driver is included in the frozen bytecode. Otherwise, it's below.
When I was almost finished, I found Damiens spiflash.c driver in drivers/memory. It is used by the STM32 port. Not sure how to use that. It would need an interface for the hardware and to the Python API. The new SAMD drivers mostly of these interface parts, and the code in /drivers/memory would add a large layer in between. |
Beta Was this translation helpful? Give feedback.
-
I renamed the samd_spiflash branch into samd_flash. The commits are rearranged to have fewer of them, and the last commit changes the startup code _boot.py to use the board's flash drive as default drive. With SAMD51 QSPIflash, that increase the CPU speed as well. My test code pystone_lowmem.py runs about two times faster. With SAM21 devices there is no speed gain, but at least a larger file system. I moved the additional flash drivers from machine into samd. It still may be optimized. Having three different flash drivers does not look nice. |
Beta Was this translation helpful? Give feedback.
-
Thanks to robert-hh's amazing efforts — made all the more amazing when you realize he hasn't got a Wio Terminal to test this on himself — MicroPython works quite well on the Wio Terminal.
In order to get folks started, I wrote a tutorial that has working examples for all operating sensors and outputs on that board: MicroPython on the Seeed Studio Wio Terminal: it works! – We Saw a Chicken …
There are also shorter code snippets here: scruss/WioTerminal-MicroPython: short MicroPython examples for the Seeed Wio Terminal
Huge thanks to Robert for making this port work so well.
Beta Was this translation helpful? Give feedback.
All reactions