You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
246: Add readme documentation for demos r=thejpster a=ninjasource
Hi, I've recently worked through all the demos and took notes as I was going. I thought it may be useful to add those notes to this repo if appropriate. I'm not sure if this is the correct place to put them but adding a `README.md` file to the examples folder confuses cargo builds for some reason. I hope that this will be useful as I was not familiar with all the acronyms in the project and I think that newcomers will find this quick reference useful too.
Co-authored-by: David Haig <[email protected]>
Co-authored-by: David Haig <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+46Lines changed: 46 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,3 +51,49 @@ at your option.
51
51
Unless you explicitly state otherwise, any contribution intentionally submitted
52
52
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
53
53
dual licensed as above, without any additional terms or conditions.
54
+
55
+
## Summary of the Examples
56
+
57
+
Here follows a brief description of each demo for quick reference. For a more in-depth explanation on how the peripherals work please refer to the device reference manuals linked above, the readme for each demo and the comments in the demo code itself.
Each demo readme should contain instructions on how to run it. However, the information below describes the technologies used and can be used to troubleshoot your system setup. Run the demos from within their respective project directories. E.g. to run `ccm-demo`, you must be in the `nrf-hal/examples/ccm-demo/` directory.
84
+
> Since the demos are stand-alone projects you would **NOT** typically run them with `cargo run --example xyz-demo` like some cargo projects are configured to do.
85
+
86
+
### Once Off System Setup
87
+
88
+
Install the cross compilation toolchain to target your device. You would typically pass the target as a parameter to cargo or explicitly set it in your cargo config file. If you get compilation errors about `eh_personality` then you have not set the target correctly. Here is an example of the target for a nRF52840 chip:
89
+
```console
90
+
$ rustup target add thumbv7em-none-eabihf
91
+
```
92
+
Install the tools to flash the device.
93
+
```console
94
+
$ cargo install cargo-embed
95
+
```
96
+
97
+
### For Every Project (optional)
98
+
99
+
Setup the `Cargo.toml` file to use the correct features. Features allow for conditional compilation which is essential for a library like this that supports multiple different devices. Under the `[features]` section add the following line `default = ["52840"]` for the nRF52840-DK device or whatever other feature is applicable for your device. This is optional but it will allow you to simply call `cargo run` and `cargo build` instead of `cargo run --features 52840` and `cargo build --features 52840` respectively. Note that some demo projects do not have features so this step may not be necessary. If you get a whole bunch of compilation errors or plugins like rust-analyzer are not working then check that you have set the chip features correctly.
Copy file name to clipboardExpand all lines: examples/ccm-demo/README.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,8 @@
1
-
# AES-CCM demo
1
+
# CCM encryption demo
2
+
3
+
This CCM (cipher block chaining) encryption demo initialises a text message of the maximum size of 251 bytes and encrypts and decrypts it, measuring the time it takes. It then repeats the process with smaller and smaller chunks of data to demonstrate how long smaller packets take to process.
4
+
5
+
## How to run
2
6
3
7
Choose the microcontroller with one of the following features:
This demo uses the Comparator (comp) peripheral to compare the differential voltages between two pins. If the voltage on Pin 30 is higher than Pin 31 (reference voltage) the built in LED will switch off otherwise it will switch on. The demo uses `nrf52840-hal` but this can be swapped out with an alternative if required.
Copy file name to clipboardExpand all lines: examples/ecb-demo/README.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,8 @@
1
-
# AES electronic codebook mode encryption demo
1
+
# ECB encryption demo
2
+
3
+
The AES electronic codebook mode (ECB) demo demonstrates a blocking 128-bit AES encryption of 16 bytes of data using a 16 byte key. Encryption only, no decryption.
4
+
5
+
## How to run
2
6
3
7
Choose the microcontroller with one of the following features:
The General-Purpose Input Output Tasks and Events (gpiote) module demo targets the nRF52840-DK in particular because of the 4 available hardware buttons on the board itself. The demo shows how you can use the `cortex-m-rtic` crate to easily debounce some buttons without blocking the CPU. GPIO pin state changes fire events which can be used to carry out tasks. This showcases the PPI (programmable peripheral interconnect) system for which there is also a dedicated demo.
The Inter-IC Sound interface (I2S) controller mode (aka master mode) demo. This demo generates Morse code audio signals from text received over UART and plays them back over I2S. Tested with nRF52840-DK and a UDA1334a DAC.
The Inter-IC Sound interface (I2S) peripheral mode (aka slave mode) demo. This demonstrates full duplex communication between a controller and peripheral mode I2S peripheral using the EasyDMA capabilities of the chip. This targets the nrf52840 family of devices.
This low power voltage comparator (lpcomp) demo shows how you would keep the device in low power mode and power it up when an analog voltage on a pin changes with respect to a voltage on a reference pin. This targets the nrf52840 family of devices.
Copy file name to clipboardExpand all lines: examples/ppi-demo/README.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,8 @@
1
-
# Programmable peripheral interconnect demo
1
+
# PPI demo
2
+
3
+
The Programmable Peripheral Interconnect (PPI) allows peripherals to interact with each other without having to go through the CPU. Note that you need to choose a chip feature in order for this demo to build. See above. This demo uses the Bluetooth RADIO peripheral as an example but does nothing special with Bluetooth itself so this is not the demo to learn about that capability.
4
+
5
+
## How to run
2
6
3
7
Choose the microcontroller with one of the following features:
0 commit comments