I recently upgraded my ageing iPad to a new iPad Pro 11. This has a USB C port, and I immediately wondered if I could use this to connect a USB C equipped Raspberry Pi RP2040-based device like the Adafruit Feather RP2040, and do development on the iPad rather than a Mac. The answer is a cautious ‘yes’, provided you can work to a very specific limitation: your RP2040-side application environment has to be CircuitPython.
CircuitPython is designed to always present a mountable drive,
CIRCUITPY, and you can access this in the Files app. Files supports zip files, so it’s very easy to, say, download a CircuitPython library and/or application code from GitHub, unpack the zip file, select the expanded files you want and then copy them to
By the same logic, you ought to be able to connect other RP2040-based devices, such as the Pico, which are not running CircuitPython but have been set to mount as a UF2 drive by holding down the
BOOTSEL button first. A UF2 drive is basically just a FAT16 disk, and iOS is supposed to be able to support that. However, when I tried it with either of the two different adaptors, I didn’t have much joy. The time between the RP2040 starting up and presenting the UF2 drive to the host is sufficient for iOS to ignore the drive.
I had the same experience with a SparkFun Pro Micro RP2040, which has two benefits over the Pico: a USB C port and a way of triggering a UF2 mount without simultaneously holding down a button and powering the unit. It’s less fiddly and ensures the device is always powered. Doesn’t help with the iPad though.
Back to CircuitPython then. I already have Pythonista installed, so opening
CIRCUITPY and tapping on the
code.py file opens in that app ready for editing. There’s no explicit save, so you have to stop work and let iOS’ auto-save facility kick in when you’re working on the drive directly. It’s probably easier to edit an iPad-side copy of the file, and copy it to
CIRCUITPY when you’re ready.
Pythonista is not essential, since you’ll be running your code on the device, not the iPad. Without Pythonista, you should be able to open
code.py in any other iPad text editor.
If your code is good, you’ll see it run on the RP2040, either because your device has a display of some kind or, in the case of the Feather RP2040, the onboard LED is green.
Now we come to the truly problematic part. If your code contains errors, there’s not yet a way to debug them directly because there’s no way to gain serial access to the device. On a Mac, I run
minicom at the command line to talk to CircuitPython — or MicroPython — via the RP2040’s built-in USB-to-serial bridge. The iPad, you won’t be surprised to hear, is not so flexible. Its Unix device list is locked down, so you can’t access it with something like
minicom or Python’s serial module.
This of course eliminates working with MicroPython, which is designed to be accessed through a serial line not a mounted drive. But since CircuitPython is derived from MicroPython, you can use the former instead, so only true MicroPython purists will be left out.
Coding in C or C++ requires the ARM cross compiler to generate the
.uf2 file you can copy to the mounted RP2040. The iPad app iSH provides a Linux file system and has a package manager, but this doesn’t provide the ARM cross-compiler. However, the iPad Pro’s M1 chip is the same (surely) as the M1 in my MacBook Pro, so it ought to be possible to copy the installed files from the Mac to the iPad. iSH’s filesystem is conveniently accessible through the Files app too.
This I may try, but to be honest, it feels like an exercise in advanced masochism. I will probably stick with CircuitPython.
A third option is to use Termius to SSH into a Raspberry Pi or similar to which the RP2040-based doohickey has been connected. For a GUI, so that you can run VSCode, use VNC. But that still seems like an excessive effort just to be able to work through an iPad.
But I’ll continue to see how I can gain debug access to the connected device. And I can certainly continue to write Python code on the iPad and install it directly onto the target CircuitPython device.