Link Search Menu Expand Document

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.

  1. Download the latest .hex release from here 📁

  2. You’ll need a J-Link compatible programmer and the J-Link software installed

  3. Make sure you have the nRF command line tools installed

  4. Flash the binary using the command

     nrfjprog --program micropython-s1-*.hex --chiperase -f nrf52 --verify -r
    
  5. Access MicroPython wirelessly using our Web REPL


First steps

  1. Click Connect and you’ll see your S1 device appear. Select it and click Pair

    Animation of the S1 Web REPL connecting

  2. Press Ctrl-B to enter the friendly REPL mode

  3. All of the S1 related functions are located inside the machine module. Import it using the command

     import machine
    
  4. To see what’s contained inside machine, you can use the help() function

     help(machine)
    
  5. You can import any class contained within machine, and use them directly without having to specify machine before the class name

     from machine import Pin
    
     myPin = Pin(Pin.PIN_A1, pull=Pin.PULL_DOWN)
     myPin() # Reads the pin value
    
  6. 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!


Table of contents