MicroPython on the S1 Module
v1.18-387
MicroPython on the S1 lets you quickly prototype and test your algorithms without having to get deep into C development. You can easily test FPGA binaries, read or write data, and control all module features over the air.
No programmer needed
MicroPython also functions as an excellent network stack. Allowing you to interface to a mobile app, or Bluetooth gateway, using simple strings.
from machine import RTC
from machine import FPGA
FPGA.run() # Boot the FPGA application
processedData = bytearray(100) # Data from the FPGA will be stored here
while True:
FPGA.read(processData) # Read 100 bytes over SPI
processedData # Print out the data
RTC.sleep_ms(1000) # Repeat again every second
Installing MicroPython on the S1 Module
MicroPython works great on all of our S1 products.
Download the latest
.hex
release from here 📁You’ll need a J-Link compatible programmer and the J-Link software installed
Make sure you have the nRF command line tools installed
Flash the binary using the command
nrfjprog --program micropython-s1-*.hex --chiperase -f nrf52 --verify -r
Access MicroPython wirelessly using our Web REPL
First steps
Click Connect and you’ll see your S1 device appear. Select it and click Pair
Press Ctrl-B to enter the friendly REPL mode
All of the S1 related functions are located inside the
machine
module. Import it using the commandimport machine
To see what’s contained inside
machine
, you can use thehelp()
functionhelp(machine)
You can import any class contained within
machine
, and use them directly without having to specifymachine
before the class namefrom machine import Pin myPin = Pin(Pin.PIN_A1, pull=Pin.PULL_DOWN) myPin() # Reads the pin value
You can also call help on these inner classes to see the functions contained within
from machine import Pin help(Pin)
Improvements
Spotted something? Feel free to report any bugs you find, or suggest improvements. We’re always willing to improve things.
Submit an issue to our GitHub or contact us if something is unclear.
That’s it! For the full list of classes and functions, check out the pages below. Happy tinkering!