Metadata-Version: 2.4
Name: scum-programmer
Version: 0.1.2
Summary: SCuM programmer script.
Project-URL: Homepage, https://github.com/PisterLab/scum-sdk
Project-URL: Bug Tracker, https://github.com/PisterLab/scum-sdk/issues
Author-email: Alexandre Abadie <alexandre.abadie@inria.fr>
License: BSD
License-File: LICENSE.txt
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Requires-Dist: click>=8.1.7
Requires-Dist: pyserial>=3.5
Requires-Dist: rich>=14.0.0
Requires-Dist: tqdm>=4.66.5
Description-Content-Type: text/markdown

# SCuM Programmer

Use an nRF52840-DK and a Python script to program SCuM!

<p align="center">
  <img src="https://github.com/PisterLab/scum-sdk/blob/main/scum_programmer/programmer-setup.svg?raw=True" width="75%">
</p>

## Prerequisites

### Setup the nRF52840-DK

- Download `scum-programmer.hex` from the https://github.com/pisterlab/scum-sdk/releases/latest/
- Plug in your nRF52840-DK into your computer, drive "JLINK" appears
- Drag-and-drop `scum-programmer.hex` onto this drive

### Interact with SCuM's serial port

* Connect SCuM's UART to an USB-to-UART converter
* Open the serial port corresponding to your USB-to-UART converter using a
  serial terminal, using **19200 baud**.
  For example using [Socat](http://www.dest-unreach.org/socat/) on Linux:
  ```
  socat - open:/dev/ttyUSB0,b19200,echo=0,raw,cs8,parenb=0,cstopb=0
  ```

## Python script installation

The `scum-programmer` command line tool is published on PyPI:

```
pip install scum-programmer
```

## Usage

### Load code onto SCuM

The `scum-programmer` command requires a firmware input file in .bin format.
Use it as following:

```
scum-programmer path/to/scum-firmware.bin
```

On Windows, the nRF J-Link TTY port cannot be detected automatically and needs
to be set manually using the `--port` option. For example:

```
scum-programmer --port COM42 path/to/scum-firmware.bin
```

### Calibrate SCuM

If the application requires calibration, use the `--calibrate` option to trigger
the calibration after booting SCuM:

```
scum-programmer --calibrate path/to/scum-firmware.bin
```

## Build the nRF firmware

- Install SEGGER Embedded Studio for ARM
- Open `scum_programmer/scum-programmer.emProject`
- Select the `scum-programmer` project and build it (F7)
- Download it on the nRF using the `Target > Download scum-programmer` menu
