Difference between revisions of "Raspberry Pi Pico"

From Land Boards Wiki
Jump to navigation Jump to search
 
(145 intermediate revisions by the same user not shown)
Line 6: Line 6:
  
 
* RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom
 
* RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom
* Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz
+
** Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz
* 264KB of SRAM, and 2MB of on-board Flash memory
+
** 264KB of SRAM
 +
** 2MB of on-board Flash memory
 
* Castellated module allows soldering direct to carrier boards
 
* Castellated module allows soldering direct to carrier boards
 
* USB 1.1 with device and host support
 
* USB 1.1 with device and host support
Line 18: Line 19:
 
* Accelerated floating-point libraries on-chip
 
* Accelerated floating-point libraries on-chip
 
* 8 × Programmable I/O (PIO) state machines for custom peripheral support
 
* 8 × Programmable I/O (PIO) state machines for custom peripheral support
 +
 +
== Repositories ==
 +
 +
* [https://github.com/land-boards/RasPiPico My Raspberry Pi Pico GitHub repository] - Home
 +
** [https://github.com/land-boards/RasPiPico/tree/main/MicroPython My MicroPython GitHub repository]
 +
** [https://github.com/land-boards/RasPiPico/tree/main/CircuitPython My CircuitPython GitHub repository]
  
 
== Pinout ==
 
== Pinout ==
Line 34: Line 41:
 
== Adapter Cards ==
 
== Adapter Cards ==
  
=== In Small Plastic Box ===
+
<video type="youtube">n8hFKrUk1DM</video>
 +
 
 +
* There are three versions of this card
 +
** [[PiPicoMite01]] (this version)
 +
*** Has 16-bit port I/O expander
 +
*** 120x70mm with (4) 6-32 mounting holes
 +
** [[PiPicoMite02]]
 +
*** Has 32-bit port I/O expander(s)
 +
*** 95x95mm with (4) 6-32 mounting holes
 +
** [[PiPicoMite03]]
 +
*** 99.5x69.5mm - Fits into extruded Aluminum Enclosure
 +
*** Fully functional, reduced cost
 +
 
 +
=== PiPicoMite01 ===
 +
 
 +
* [[PiPicoMite01]]
 +
 
 +
[[file:PiPicoMite01_P18182_720px.jpg]]
 +
 
 +
=== PiPicoMite02 ===
 +
 
 +
[[PiPicoMite02]]
 +
 
 +
[[file:PiPicoMite-02_P18268_720px.jpg]]
 +
 
 +
=== PiPicoMite03 ===
 +
 
 +
[[PiPicoMite03]]
 +
 
 +
[[file:PiPicoMite03_P18408-720px.jpg]]
 +
 
 +
=== PicoVGA01 ===
 +
 
 +
[[PicoVGA01 ]]
 +
 
 +
[[file:PicoVGA01_P1080468-720px.jpg]]
 +
 
 +
=== In Small Plastic Project Box ===
  
 
* [https://circuitsetup.us/product/solderable-breadboard-pcb-for-arduino-esp8266-esp32-prototyping-3-78x2-2-96x56mm-5-pack/ CircuitSetup Breadboard]
 
* [https://circuitsetup.us/product/solderable-breadboard-pcb-for-arduino-esp8266-esp32-prototyping-3-78x2-2-96x56mm-5-pack/ CircuitSetup Breadboard]
* Fits in 100x60x25mm Project Box
+
 
 +
[[file:Pico_Plastic_Box_P18136_720px.jpg]]
 +
 
 +
* Fits in [https://www.ebay.com/sch/i.html?_from=R40&_trksid=p2380057.m570.l1313&_nkw=100x60x25mm+Project+Box&_sacat=0 100x60x25mm Project Box]
 +
* Socketed Raspberry Pi Pico
 
* All Pico pins brought to Male Header pins
 
* All Pico pins brought to Male Header pins
 
* Power/Ground distribution
 
* Power/Ground distribution
 
* 5V jack
 
* 5V jack
 +
** VSYS connection with Schottky diode
 +
* Can by Mounted on ODAS Adapter card
  
=== PiPico-01 Card ===
+
==== Cut Etch / Add wires ====
  
* [[PiPico-01]] Card - Our design
+
* Cut etch from + near jack to board side + connections
 +
* Verify cut with jumper (center pin power jack to + on both sides)
  
== Interesting Applications ==
+
[[file:CircuitSetuo_Breadboard_EtchCut.PNG]]
  
=== Running RP2040 Doom ===
+
* Add TIE - jumper to ties grounds on both sides together
  
* [https://kilograham.github.io/rp2040-doom/ RP2040 Doom]
+
[[file:CircuitSetuo_Breadboard_TieMinus.PNG]]
 +
 
 +
* Add Power jumper between the two sides
 +
 
 +
[[file:CircuitSetuo_Breadboard_JumpPower.PNG]]
 +
 
 +
* Add Ground connection Pico pin 38 to - hole near strip
 +
* Add 3.3V Power connection Pico pin 36 to + hole near strip on other side
 +
 
 +
==== Schematic Symbol ====
 +
 
 +
[[File:PiPicoMite01_J4-5_PiPico.PNG]]
 +
 
 +
==== Pin Table ====
 +
 
 +
{| class="wikitable"
 +
! Pico Pin
 +
! BB Pin
 +
! Signal
 +
!
 +
! Pico Pin
 +
! BB Pin
 +
! Signal
 +
|-
 +
| 1
 +
| 30
 +
| GP0
 +
|
 +
| 40
 +
| 30
 +
| VUSB
 +
|-
 +
| 2
 +
| 29
 +
| GP1
 +
|
 +
| 39
 +
| 29
 +
| VSYS
 +
|-
 +
| 3
 +
| 28
 +
| GND
 +
|
 +
| 38
 +
| 28
 +
| GND
 +
|-
 +
| 4
 +
| 27
 +
| GP2
 +
|
 +
| 37
 +
| 27
 +
| 3V3EN
 +
|-
 +
| 5
 +
| 26
 +
| GP3
 +
|
 +
| 36
 +
| 26
 +
| 3V3OUT
 +
|-
 +
| 6
 +
| 25
 +
| GP4
 +
|
 +
| 35
 +
| 25
 +
| ADCVREF
 +
|-
 +
| 7
 +
| 24
 +
| GP5
 +
|
 +
| 34
 +
| 24
 +
| GP28
 +
|-
 +
| 8
 +
| 23
 +
| GND
 +
|
 +
| 33
 +
| 23
 +
| GND
 +
|-
 +
| 9
 +
| 22
 +
| GP6
 +
|
 +
| 32
 +
| 22
 +
| GP27
 +
|-
 +
| 10
 +
| 21
 +
| GP7
 +
|
 +
| 31
 +
| 21
 +
| GP26
 +
|-
 +
| 11
 +
| 20
 +
| GP8
 +
|
 +
| 30
 +
| 20
 +
| RUN
 +
|-
 +
| 12
 +
| 19
 +
| GP9
 +
|
 +
| 29
 +
| 19
 +
| GP22
 +
|-
 +
| 13
 +
| 18
 +
| GND
 +
|
 +
| 28
 +
| 18
 +
| GND
 +
|-
 +
| 14
 +
| 17
 +
| GP10
 +
|
 +
| 27
 +
| 17
 +
| GP21
 +
|-
 +
| 15
 +
| 16
 +
| GP11
 +
|
 +
| 26
 +
| 16
 +
| GP20
 +
|-
 +
| 16
 +
| 15
 +
| GP12
 +
|
 +
| 25
 +
| 15
 +
| GP19
 +
|-
 +
| 17
 +
| 14
 +
| GP13
 +
|
 +
| 24
 +
| 14
 +
| GP18
 +
|-
 +
| 18
 +
| 13
 +
| GND
 +
|
 +
| 23
 +
| 13
 +
| GND
 +
|-
 +
| 19
 +
| 12
 +
| GP14
 +
|
 +
| 22
 +
| 12
 +
| GP17
 +
|-
 +
| 20
 +
| 11
 +
| GP15
 +
|
 +
| 21
 +
| 11
 +
| GP16
 +
|-
 +
|}
 +
 
 +
== Software Development ==
 +
 
 +
* C/C++
 +
* Forth
 +
* MicroPython
 +
* CircuitPython
 +
 
 +
=== C/C++ ===
 +
 
 +
==== C/C++ SDK ====
 +
 
 +
* [https://shawnhymel.com/2096/how-to-set-up-raspberry-pi-pico-c-c-toolchain-on-windows-with-vs-code/ SDK Easier Install] - working following instructions and comments after...
 +
 
 +
==== Mbed library with Arduino IDE ====
 +
 
 +
* [https://community.element14.com/products/raspberry-pi/b/blog/posts/program-rpi-pico-using-mbed-library-with-arduino-ide Program RPi Pico using Mbed library with Arduino IDE]
 +
* [https://www.cnx-software.com/2021/04/12/arduino-core-mbed-2-0-supports-raspberry-pi-pico-arduino-nano-rp2040-connect/ Arduino Core mbed 2.0 supports Raspberry Pi Pico]
 +
 
 +
=== Forth ===
  
<video type="youtube">eDVazQVycP4</video>
+
* [https://github.com/tabemann/zeptoforth zeptoforth]
 +
** zeptoforth is a Cortex-M Forth, targeted at the Raspberry Pi Pico
 +
** [https://github.com/tabemann/zeptoforth/wiki zeptoforth Wiki page]
 +
* zeptoforth includes the following features:
 +
** A priority-scheduled preemptive multitasker
 +
** Semaphores
 +
** Locks, with priority inversion handling
 +
** Message-oriented queue channels
 +
** Message-oriented rendezvous channels, aka "fchannels"
 +
** Message-oriented bidirectional synchronous reply channels, aka "rchannels"
 +
** Byte-oriented streams
 +
** Interrupt service handler-safe channels, aka "schannels"
 +
** Task notifications
 +
** Action scheduler support
 +
** Multicore support (on the Raspberry Pi Pico)
 +
** Double cell and fixed point numeric support
 +
** Lambda/quotation expressions
 +
** A disassembler
 +
** SysTick support
 +
** User-reconfigurable processor exception vector support
 +
** Interrupt-driven serial IO
 +
** GPIO support (including EXTI support on STM32 microcontrollers)
 +
** Maps, including counted string and integer-keyed maps
 +
** Heap allocators
 +
** Memory pool allocators
 +
** Task pool allocators
 +
** Action pool allocators
 +
** Temporary storage allocators (used to provide immediate string constants)
 +
** A line editor
 +
** LED drivers
 +
** Quad SPI flash storage support (on the STM32F746 DISCOVERY board and the Raspberry Pi Pico)
 +
** A block editor (on the STM32F746 DISCOVERY board and the Raspberry Pi Pico)
 +
** Random number generator support
 +
** Pseudorandom number generator support (using the TinyMT32 PRNG)
 +
** Programmable input/output support (on the Raspberry Pi Pico)
 +
** Optional swdcom support
  
 
=== Running MicroPython ===
 
=== Running MicroPython ===
Line 61: Line 351:
 
* [https://docs.micropython.org/en/latest/rp2/quickref.html Quick MicroPython reference for the RP2]
 
* [https://docs.micropython.org/en/latest/rp2/quickref.html Quick MicroPython reference for the RP2]
 
* [https://docs.micropython.org/en/latest/library/rp2.html RP2 Python Library Modules]
 
* [https://docs.micropython.org/en/latest/library/rp2.html RP2 Python Library Modules]
 +
* Card has 264KB of SRAM
 +
* Free memory under MicroPython plus various module sizes
 +
<pre>
 +
>>> import gc
 +
>>> gc.mem_free()
 +
182624
 +
>>> import time
 +
>>> gc.mem_free()
 +
178544
 +
>>> import machine
 +
>>> gc.mem_free()
 +
174304
 +
>>> </pre>
 +
* To compare [[QT Py]] on the SAMD21 has 19KB free
 +
* QT Py on XAIO RP2040 has 208,128 free
 +
 +
==== Python File System ====
 +
 +
<video type="youtube">G06tPDjZ3zM</video>
 +
 +
* Internal Flash File System
 +
** Little FS
 +
** 1.44MB space
 +
** Blocks are 4KB
 +
** 352 Blocks on Internal File System
 +
* os functions
 +
<pre>
 +
import os
 +
os.[TAB]
 +
os.dir()
 +
os.mkdir("newdir")
 +
os.getcwd()
 +
os.mkdir("newdir")
 +
os.chdir('..')
 +
os.listdir()
 +
os.statvfs('/')
 +
os.uname()
 +
os.remove('file2remove')
 +
os.rename('old','new')
 +
</pre>
 +
* Using files
 +
<pre>
 +
f = open('filename','w')
 +
f.write('data to add')
 +
f.read()
 +
f.close()
 +
</pre>
 +
 +
==== I2C Scanner ====
 +
 +
import machine
  
<video type="youtube">zlKJ5hvfs6s</video>
+
<pre>
 +
# Create I2C object
 +
i2c = machine.I2C(0, scl=machine.Pin(17), sda=machine.Pin(16))
 +
 
 +
# Print out any addresses found
 +
devices = i2c.scan()
 +
 
 +
if devices:
 +
    for d in devices:
 +
        print(hex(d))
 +
</pre>
 +
 
 +
== Running PicoMite (MaxiMite) BASIC ==
 +
 
 +
* Two versions
 +
** PicoMiteVGA, PS/2 version
 +
** PicoMite USB-Serial with SD Card
 +
 
 +
=== Running PicoMite (MaxiMite) BASIC (VGA, PS/2) ===
 +
 
 +
<video type="youtube">5dcnrLDzjdU</video>
 +
 
 +
The PicoMiteVGA boots straight into the MMBasic prompt. At which point you can enter, edit and save the program, test BASIC commands and run the program. MMBasic is a Microsoft BASIC compatible implementation of the BASIC language. It is full featured with floating point, 64-bit integers and string variables, long variable names, arrays of floats, integers or strings with multiple dimensions, extensive string handling and user defined subroutines and functions. Typically it will execute a program up to 100,000 lines per second. Embedded compiled C programs can be used for even higher performance.
 +
 
 +
The PicoMiteVGA is a Raspberry Pi Pico with VGA output, PS2 keyboard input, SD card storage and running the free MMBasic interpreter.
 +
 
 +
The PicoMiteVGA firmware reserves eight program storage "slots" in the Raspberry Pi Pico flash memory. Programs can be saved and retreived from these without the need for any additional storage.
 +
 
 +
You can draw grapics in 16 different colours, show text in multiple fonts and save your programs to an SD card. For more storage SD cards can be connected with full support for these built into MMBasic including the ability to open files for reading, writing or random access and loading and saving programs. SD cards connect directly to the Raspberry Pi Pico and the firmware will work with cards up to 32GB formatted in FAT16 or FAT32. The files created can be read and written on personal computers running Windows, Linux or the Mac operating system.
 +
 
 +
The PicoMiteVGA boots straight into the MMBasic prompt. At which point you can enter, edit and save the program, test BASIC commands and run the program.
 +
 
 +
The [https://geoffg.net/Downloads/picomite/PicoMiteVGA_User_Manual.pdf User Manual] is a comprehensive description of the PicoMiteVGA including circuits for interfacing the VGA monitor, keyboard and SD card.
 +
 
 +
<pre>
 +
> memory
 +
Program:
 +
  13K (10%) Program (485 lines)
 +
  95K (90%) Free
 +
 
 +
RAM:
 +
  0K ( 0%) 0 Variables
 +
  0K ( 0%) General
 +
140K (100%) Free
 +
</pre>
 +
 
 +
==== PiPicoMite01 Card ====
 +
 
 +
* [[PiPicoMite01]]
 +
 
 +
[[file:PiPicoMite01_P18182_720px.jpg]]
 +
 
 +
===== Configuration =====
 +
 
 +
<pre>
 +
OPTION KEYBOARD US
 +
OPTION SDCARD GP13, GP10, GP11, GP12
 +
OPTION AUDIO GP6, GP7
 +
OPTION COLOURCODE ON
 +
</pre>
 +
 
 +
==== PiPicoMite02 Card ====
 +
 
 +
* [[PiPicoMite02]]
 +
 
 +
[[file:PiPicoMite-02_P18268_720px.jpg]]
 +
 
 +
===== Configuration =====
 +
 
 +
<pre>
 +
> OPTION LIST
 +
OPTION COLOURCODE ON
 +
OPTION KEYBOARD US
 +
OPTION SDCARD GP13, GP10, GP11, GP12
 +
OPTION AUDIO GP6, GP7
 +
option system i2c gp0, gp1
 +
</pre>
 +
 
 +
==== PiPicoMite03 Card ====
 +
 
 +
* [[PiPicoMite03]]
 +
 
 +
[[file:PiPicoMite03_P18397-720px.jpg]]
 +
 
 +
===== Configuration =====
 +
 
 +
<pre>
 +
> OPTION LIST
 +
OPTION COLOURCODE ON
 +
OPTION KEYBOARD US
 +
OPTION SDCARD GP13, GP10, GP11, GP12
 +
OPTION AUDIO GP6, GP7
 +
OPTION SYSTEM I2C2 GP14, GP15
 +
</pre>
 +
 
 +
=== Running PicoMite (MaxiMite) BASIC (USB-Serial) ===
 +
 
 +
* Incompatible connections to SD Card from VGA version
 +
** VGA version does everything this version does since it can be run via the USB console
 +
* [https://geoffg.net/picomitevga.html "Boot to MM BASIC" on the Raspberry Pi Pico] with VGA
 +
* [https://geoffg.net/picomite.html BASIC Interpreter for the Raspberry Pi Pico] - USB
 +
* SD Card Connections
 +
 
 +
==== PicoMite SD Card Wiring ====
 +
 
 +
* Install NO5V jumper
 +
 
 +
{| class="wikitable"
 +
! SD_Socket
 +
! PIN
 +
! SD-J1
 +
! Pi-Pico
 +
! Pico-Pin
 +
! Colour
 +
|-
 +
| 3
 +
| GND
 +
| 1
 +
| GND
 +
| GND
 +
| BLK
 +
|-
 +
| 7
 +
| MISO
 +
| 2
 +
| GPIO16
 +
| 21
 +
| BRN
 +
|-
 +
| 5
 +
| SCLK
 +
| 3
 +
| GPIO18
 +
| 24
 +
| ORA
 +
|-
 +
| 2
 +
| MOSI
 +
| 4
 +
| GPIO19
 +
| 25
 +
| YEL
 +
|-
 +
| 1
 +
| SLV SEL
 +
| 5
 +
| GPIO22
 +
| 29
 +
| WHT
 +
|-
 +
| 4
 +
| VCC
 +
| 7
 +
| 3.3V
 +
| N/C
 +
|
 +
|-
 +
| 6
 +
| GND
 +
| N/C
 +
| GND
 +
|
 +
|
 +
|-
 +
|}
  
=== Running MM BASIC ===
+
=== MMBASIC vs MicroPython Performance ===
  
* [https://geoffg.net/picomitevga.html "Boot to MM BASIC" on the Raspberry Pi Pico]
+
<video type="youtube">VFdXTYLX6PU</video>
  
 
<video type="youtube">Cxmjy1nz6MM</video>
 
<video type="youtube">Cxmjy1nz6MM</video>
  
=== Running VGA ===
+
== PicoVGA ==
 +
 
 +
* [[PicoVGA01]]
 +
 
 +
== Running RP2040 Doom ==
 +
 
 +
* [https://kilograham.github.io/rp2040-doom/ RP2040 Doom]
 +
 
 +
<video type="youtube">eDVazQVycP4</video>
 +
 
 +
== Running VGA ==
  
 
Hardware Design Guide Section 3.2
 
Hardware Design Guide Section 3.2
Line 78: Line 593:
 
<video type="youtube">yjW6tPw4anw</video>
 
<video type="youtube">yjW6tPw4anw</video>
  
<video type="youtube">wX1IPa3Q0LU</video>
+
<video type="youtube">wFxldIa4hpc</video>
 +
 
 +
<video type="youtube">zlKJ5hvfs6s</video>
 +
 
 +
== Raspberry Pi Pico Software Repositories ==
 +
 
 +
* [https://github.com/search?q=org%3Araspberrypi+Pico Raspberry Pi Pico Foundation Files]
 +
* [https://github.com/earlephilhower/arduino-pico Arduino Pico]
 +
** [https://arduino-pico.readthedocs.io/en/latest/ Arduino Pico Docs]

Latest revision as of 18:40, 6 August 2022

RasPiPico 720px.jpg

Raspberry Pi Pico Features

Raspberry Pi Pico is a low-cost, high-performance microcontroller board with flexible digital interfaces. Key features include:

  • RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom
    • Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz
    • 264KB of SRAM
    • 2MB of on-board Flash memory
  • Castellated module allows soldering direct to carrier boards
  • USB 1.1 with device and host support
  • Low-power sleep and dormant modes
  • Drag-and-drop programming using mass storage over USB
  • 26 × multi-function GPIO pins
  • 2 × SPI, 2 × I2C, 2 × UART, 3 × 12-bit ADC, 16 × controllable PWM channels
  • Accurate clock and timer on-chip
  • Temperature sensor
  • Accelerated floating-point libraries on-chip
  • 8 × Programmable I/O (PIO) state machines for custom peripheral support

Repositories

Pinout

PiPico Pins.PNG

Reference Documents

Adapter Cards

  • There are three versions of this card
    • PiPicoMite01 (this version)
      • Has 16-bit port I/O expander
      • 120x70mm with (4) 6-32 mounting holes
    • PiPicoMite02
      • Has 32-bit port I/O expander(s)
      • 95x95mm with (4) 6-32 mounting holes
    • PiPicoMite03
      • 99.5x69.5mm - Fits into extruded Aluminum Enclosure
      • Fully functional, reduced cost

PiPicoMite01

PiPicoMite01 P18182 720px.jpg

PiPicoMite02

PiPicoMite02

PiPicoMite-02 P18268 720px.jpg

PiPicoMite03

PiPicoMite03

PiPicoMite03 P18408-720px.jpg

PicoVGA01

PicoVGA01

PicoVGA01 P1080468-720px.jpg

In Small Plastic Project Box

Pico Plastic Box P18136 720px.jpg

  • Fits in 100x60x25mm Project Box
  • Socketed Raspberry Pi Pico
  • All Pico pins brought to Male Header pins
  • Power/Ground distribution
  • 5V jack
    • VSYS connection with Schottky diode
  • Can by Mounted on ODAS Adapter card

Cut Etch / Add wires

  • Cut etch from + near jack to board side + connections
  • Verify cut with jumper (center pin power jack to + on both sides)

CircuitSetuo Breadboard EtchCut.PNG

  • Add TIE - jumper to ties grounds on both sides together

CircuitSetuo Breadboard TieMinus.PNG

  • Add Power jumper between the two sides

CircuitSetuo Breadboard JumpPower.PNG

  • Add Ground connection Pico pin 38 to - hole near strip
  • Add 3.3V Power connection Pico pin 36 to + hole near strip on other side

Schematic Symbol

PiPicoMite01 J4-5 PiPico.PNG

Pin Table

Pico Pin BB Pin Signal Pico Pin BB Pin Signal
1 30 GP0 40 30 VUSB
2 29 GP1 39 29 VSYS
3 28 GND 38 28 GND
4 27 GP2 37 27 3V3EN
5 26 GP3 36 26 3V3OUT
6 25 GP4 35 25 ADCVREF
7 24 GP5 34 24 GP28
8 23 GND 33 23 GND
9 22 GP6 32 22 GP27
10 21 GP7 31 21 GP26
11 20 GP8 30 20 RUN
12 19 GP9 29 19 GP22
13 18 GND 28 18 GND
14 17 GP10 27 17 GP21
15 16 GP11 26 16 GP20
16 15 GP12 25 15 GP19
17 14 GP13 24 14 GP18
18 13 GND 23 13 GND
19 12 GP14 22 12 GP17
20 11 GP15 21 11 GP16

Software Development

  • C/C++
  • Forth
  • MicroPython
  • CircuitPython

C/C++

C/C++ SDK

Mbed library with Arduino IDE

Forth

  • zeptoforth
  • zeptoforth includes the following features:
    • A priority-scheduled preemptive multitasker
    • Semaphores
    • Locks, with priority inversion handling
    • Message-oriented queue channels
    • Message-oriented rendezvous channels, aka "fchannels"
    • Message-oriented bidirectional synchronous reply channels, aka "rchannels"
    • Byte-oriented streams
    • Interrupt service handler-safe channels, aka "schannels"
    • Task notifications
    • Action scheduler support
    • Multicore support (on the Raspberry Pi Pico)
    • Double cell and fixed point numeric support
    • Lambda/quotation expressions
    • A disassembler
    • SysTick support
    • User-reconfigurable processor exception vector support
    • Interrupt-driven serial IO
    • GPIO support (including EXTI support on STM32 microcontrollers)
    • Maps, including counted string and integer-keyed maps
    • Heap allocators
    • Memory pool allocators
    • Task pool allocators
    • Action pool allocators
    • Temporary storage allocators (used to provide immediate string constants)
    • A line editor
    • LED drivers
    • Quad SPI flash storage support (on the STM32F746 DISCOVERY board and the Raspberry Pi Pico)
    • A block editor (on the STM32F746 DISCOVERY board and the Raspberry Pi Pico)
    • Random number generator support
    • Pseudorandom number generator support (using the TinyMT32 PRNG)
    • Programmable input/output support (on the Raspberry Pi Pico)
    • Optional swdcom support

Running MicroPython

>>> import gc
>>> gc.mem_free()
182624
>>> import time
>>> gc.mem_free()
178544
>>> import machine
>>> gc.mem_free()
174304
>>> 
  • To compare QT Py on the SAMD21 has 19KB free
  • QT Py on XAIO RP2040 has 208,128 free

Python File System

  • Internal Flash File System
    • Little FS
    • 1.44MB space
    • Blocks are 4KB
    • 352 Blocks on Internal File System
  • os functions
import os
os.[TAB]
os.dir()
os.mkdir("newdir")
os.getcwd()
os.mkdir("newdir")
os.chdir('..')
os.listdir()
os.statvfs('/')
os.uname()
os.remove('file2remove')
os.rename('old','new')
  • Using files
f = open('filename','w')
f.write('data to add')
f.read()
f.close()

I2C Scanner

import machine

# Create I2C object
i2c = machine.I2C(0, scl=machine.Pin(17), sda=machine.Pin(16))

# Print out any addresses found
devices = i2c.scan()

if devices:
    for d in devices:
        print(hex(d))

Running PicoMite (MaxiMite) BASIC

  • Two versions
    • PicoMiteVGA, PS/2 version
    • PicoMite USB-Serial with SD Card

Running PicoMite (MaxiMite) BASIC (VGA, PS/2)

The PicoMiteVGA boots straight into the MMBasic prompt. At which point you can enter, edit and save the program, test BASIC commands and run the program. MMBasic is a Microsoft BASIC compatible implementation of the BASIC language. It is full featured with floating point, 64-bit integers and string variables, long variable names, arrays of floats, integers or strings with multiple dimensions, extensive string handling and user defined subroutines and functions. Typically it will execute a program up to 100,000 lines per second. Embedded compiled C programs can be used for even higher performance.

The PicoMiteVGA is a Raspberry Pi Pico with VGA output, PS2 keyboard input, SD card storage and running the free MMBasic interpreter.

The PicoMiteVGA firmware reserves eight program storage "slots" in the Raspberry Pi Pico flash memory. Programs can be saved and retreived from these without the need for any additional storage.

You can draw grapics in 16 different colours, show text in multiple fonts and save your programs to an SD card. For more storage SD cards can be connected with full support for these built into MMBasic including the ability to open files for reading, writing or random access and loading and saving programs. SD cards connect directly to the Raspberry Pi Pico and the firmware will work with cards up to 32GB formatted in FAT16 or FAT32. The files created can be read and written on personal computers running Windows, Linux or the Mac operating system.

The PicoMiteVGA boots straight into the MMBasic prompt. At which point you can enter, edit and save the program, test BASIC commands and run the program.

The User Manual is a comprehensive description of the PicoMiteVGA including circuits for interfacing the VGA monitor, keyboard and SD card.

> memory
Program:
  13K (10%) Program (485 lines)
  95K (90%) Free

RAM:
   0K ( 0%) 0 Variables
   0K ( 0%) General
 140K (100%) Free

PiPicoMite01 Card

PiPicoMite01 P18182 720px.jpg

Configuration
OPTION KEYBOARD US
OPTION SDCARD GP13, GP10, GP11, GP12
OPTION AUDIO GP6, GP7
OPTION COLOURCODE ON

PiPicoMite02 Card

PiPicoMite-02 P18268 720px.jpg

Configuration
> OPTION LIST
OPTION COLOURCODE ON
OPTION KEYBOARD US
OPTION SDCARD GP13, GP10, GP11, GP12
OPTION AUDIO GP6, GP7
option system i2c gp0, gp1

PiPicoMite03 Card

PiPicoMite03 P18397-720px.jpg

Configuration
> OPTION LIST
OPTION COLOURCODE ON
OPTION KEYBOARD US
OPTION SDCARD GP13, GP10, GP11, GP12
OPTION AUDIO GP6, GP7
OPTION SYSTEM I2C2 GP14, GP15

Running PicoMite (MaxiMite) BASIC (USB-Serial)

PicoMite SD Card Wiring

  • Install NO5V jumper
SD_Socket PIN SD-J1 Pi-Pico Pico-Pin Colour
3 GND 1 GND GND BLK
7 MISO 2 GPIO16 21 BRN
5 SCLK 3 GPIO18 24 ORA
2 MOSI 4 GPIO19 25 YEL
1 SLV SEL 5 GPIO22 29 WHT
4 VCC 7 3.3V N/C
6 GND N/C GND

MMBASIC vs MicroPython Performance

PicoVGA

Running RP2040 Doom

Running VGA

Hardware Design Guide Section 3.2

Raspberry Pi Pico Software Repositories