Skip to content

FEATURE: Added arduino CLI support #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
40 changes: 29 additions & 11 deletions software/clock_setup_using_arduino_code/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
# How to setup and upload code

To flash the firmware for configuring the PLL chip to compatible MCUs we will be using [Arduino-CLI](https://github.com/arduino/arduino-cli).
To flash the firmware for configuring the PLL chip to compatible MCUs we will be using the [Arduino-CLI](https://github.com/arduino/arduino-cli).

## Procedure

### Prerequisite

- Add the following line in your `.bashrc` or `.zshrc`.
```bash
export PATH=$HOME/arduino_cli/bin:$PATH
```
- Make sure to source your `.bashrc` or `.zshrc` after updating `$PATH`.

- Install `libhidapi-hidraw0` library for USB serial communication.
```bash
# Ubuntu/Debian
Expand All @@ -20,9 +14,33 @@ sudo apt install libhidapi-hidraw0
```

### Install Arduino CLI
- Move to directory `./software/clock_setup_using_arduino_code` which contains
the Makefile required for setup, compilation and uploading the sketch.
- Run `make setup-arduino-cli` which will install `arduino-cli`.
- Move to directory `./software/clock_setup_using_arduino_code` which contains the Makefile required for setup, compilation and uploading the sketch.
```bash
# install Arduino CLI
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# install Arduino CLI
# Install Arduino CLI


# NOTE: the CLI will be installed in the $PATH_INSTALL provided.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# NOTE: the CLI will be installed in the $PATH_INSTALL provided.
# NOTE: The CLI will be installed in the $PATH_INSTALL provided.

# Default path: ~/arduino_cli

make setup-arduino-cli PATH_INSTALL=<installation_path>
```
- Once installation is complete add the following line in your `.bashrc` or `.zshrc` to update the `$PATH` variable.
```bash
# When using custom install path
export PATH=<installation_path>/bin:$PATH

# When using default install path
export PATH=$HOME/arduino_cli/bin:$PATH
```
- Source your `.bashrc` or `.zshrc` after updating `$PATH`.
- Verify your installation.

```bash
# arduino CLI installation path
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# arduino CLI installation path
# Arduino CLI installation path

which arduino-cli

# arduino CLI installed version
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# arduino CLI installed version
# Arduino CLI installed version

arduino-cli version
```

### Install Board Files
- Now we need to setup and add the board support files for our CH32 EVT chips which can be found [here](https://github.com/openwch/arduino_core_ch32).
Expand All @@ -34,7 +52,7 @@ the Makefile required for setup, compilation and uploading the sketch.
# show all connected boards/chips via USB
make list-boards
```
- Make sure to check if Port value e.g. `/dev/ttyACM0` is the same as in the `Makefile`. If not, update it accordingly.
- Make sure to check if the port e.g. `/dev/ttyACM0` is the same as in the `Makefile`. If not, update it accordingly.
- To compile the sketch run:
```bash
make compile
Expand Down