From 16bdf8daf2dd21f0c4fb9755af6897dd23218045 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Tue, 14 Nov 2023 20:25:30 +0100 Subject: [PATCH 01/43] Fix typos in README and verify.rs --- README.md | 2 +- src/lm_ots/verify.rs | 4 ++-- src/lms/verify.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bbd9514d..7f0a2f32 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This demo application can be used in the console as follows: ``` # Key generation -# Generates `mykey.priv`, `mykey.pub` with merkle tree height 10 and winternitz parameter 2 +# Generates `mykey.prv`, `mykey.pub` with merkle tree height 10 and winternitz parameter 2 cargo run --release --example lms-demo -- genkey mykey 10/2 --seed 0123456701234567012345670123456701234567012345670123456701234567 # Signing diff --git a/src/lm_ots/verify.rs b/src/lm_ots/verify.rs index c74002ae..4e1866b6 100644 --- a/src/lm_ots/verify.rs +++ b/src/lm_ots/verify.rs @@ -78,7 +78,7 @@ pub fn verify_signature_inmemory( return false; } - let public_key_candidate = generate_public_key_candiate( + let public_key_candidate = generate_public_key_candidate( signature, &public_key.lms_tree_identifier, u32::from_be_bytes(public_key.lms_leaf_identifier), @@ -88,7 +88,7 @@ pub fn verify_signature_inmemory( public_key_candidate == public_key.key } -pub fn generate_public_key_candiate( +pub fn generate_public_key_candidate( signature: &InMemoryLmotsSignature<'_, H>, lms_tree_identifier: &[u8], lms_leaf_identifier: u32, diff --git a/src/lms/verify.rs b/src/lms/verify.rs index 47383610..9dfbcf9e 100644 --- a/src/lms/verify.rs +++ b/src/lms/verify.rs @@ -19,7 +19,7 @@ pub fn verify<'a, H: HashChain>( return Err(()); } - let public_key_canditate = generate_public_key_candiate(signature, public_key, message)?; + let public_key_canditate = generate_public_key_candidate(signature, public_key, message)?; if public_key_canditate.as_slice() == public_key.key { Ok(()) @@ -28,7 +28,7 @@ pub fn verify<'a, H: HashChain>( } } -fn generate_public_key_candiate<'a, H: HashChain>( +fn generate_public_key_candidate<'a, H: HashChain>( signature: &InMemoryLmsSignature<'a, H>, public_key: &InMemoryLmsPublicKey<'a, H>, message: &[u8], @@ -40,7 +40,7 @@ fn generate_public_key_candiate<'a, H: HashChain>( return Err(()); } - let ots_public_key_canditate = lm_ots::verify::generate_public_key_candiate( + let ots_public_key_canditate = lm_ots::verify::generate_public_key_candidate( &signature.lmots_signature, public_key.lms_tree_identifier, signature.lms_leaf_identifier, From 769c951d09ed44cf662bff36b86b19540af51a90 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Wed, 15 Nov 2023 10:28:55 +0100 Subject: [PATCH 02/43] rustc: fix compile error for PhantomData::default() --- src/hss/reference_impl_private_key.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hss/reference_impl_private_key.rs b/src/hss/reference_impl_private_key.rs index f72d9851..6956b8bb 100644 --- a/src/hss/reference_impl_private_key.rs +++ b/src/hss/reference_impl_private_key.rs @@ -39,7 +39,7 @@ impl From<[u8; MAX_SEED_LEN]> for Seed { fn from(data: [u8; MAX_SEED_LEN]) -> Self { Seed { data: ArrayVecZeroize(ArrayVec::from_array_len(data, MAX_SEED_LEN)), - phantom: PhantomData::default(), + phantom: PhantomData, } } } @@ -51,7 +51,7 @@ impl TryFrom> for Seed { if value.len() == H::OUTPUT_SIZE as usize { Ok(Seed { data: ArrayVecZeroize(value), - phantom: PhantomData::default(), + phantom: PhantomData, }) } else { Err("Can only construct seed from data of the HashChain output length") From 9dee57072ebf39a0506fe5ef00b22da7c7b76f6c Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Wed, 15 Nov 2023 10:29:46 +0100 Subject: [PATCH 03/43] lms.yml: remove mips cross toolchain MIPS removed by Rust due to https://github.com/rust-lang/rust/issues/115218 --- .github/workflows/lms.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/lms.yml b/.github/workflows/lms.yml index bca3fe1c..c97ff64c 100644 --- a/.github/workflows/lms.yml +++ b/.github/workflows/lms.yml @@ -137,7 +137,6 @@ jobs: - stable target: - aarch64-unknown-linux-gnu - - mips-unknown-linux-gnu features: - default From cb96433cb7456a8c7f093c5d6125b164fbce90f6 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Wed, 15 Nov 2023 13:43:53 +0100 Subject: [PATCH 04/43] lms.yml: add branch "dist_state_mgmt" for CI lms.yml action/job shall also be triggered by this branch. --- .github/workflows/lms.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lms.yml b/.github/workflows/lms.yml index c97ff64c..83592eb9 100644 --- a/.github/workflows/lms.yml +++ b/.github/workflows/lms.yml @@ -4,7 +4,7 @@ on: pull_request: branches: [ master ] push: - branches: [ master ] + branches: [ master, dist_state_mgmt ] env: MSRV: 1.57.0 From be0a82e598a8b966215a5ae0184af202fdc7db31 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Wed, 15 Nov 2023 15:15:02 +0100 Subject: [PATCH 05/43] lms.yml: replace deprecated command "set-output" See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ --- .github/workflows/lms.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lms.yml b/.github/workflows/lms.yml index 83592eb9..79b2fe89 100644 --- a/.github/workflows/lms.yml +++ b/.github/workflows/lms.yml @@ -70,7 +70,7 @@ jobs: steps: - uses: actions/checkout@v2 - id: msrv - run: echo "::set-output name=msrv::$(grep rust-version Cargo.toml | cut -d'"' -f2-2)" + run: echo "msrv::$(grep rust-version Cargo.toml | cut -d'"' -f2-2)" >> $GITHUB_OUTPUT build: needs: set-msrv From fca11a8c7e3fedc42d4e11e3943d71d87dbf757d Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Wed, 15 Nov 2023 15:46:02 +0100 Subject: [PATCH 06/43] lms.yml: revert last change; use checkout@v4 - Last change (replace "set-output" by $GITHUB_OUTPUT) caused an error. - replace checkout@v2 by checkout@v4 due to https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/ --- .github/actions/cross-tests/action.yml | 2 +- .github/workflows/lms.yml | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/actions/cross-tests/action.yml b/.github/actions/cross-tests/action.yml index 73bbefd7..83c745eb 100644 --- a/.github/actions/cross-tests/action.yml +++ b/.github/actions/cross-tests/action.yml @@ -13,7 +13,7 @@ inputs: runs: using: "composite" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal diff --git a/.github/workflows/lms.yml b/.github/workflows/lms.yml index 79b2fe89..e46389d5 100644 --- a/.github/workflows/lms.yml +++ b/.github/workflows/lms.yml @@ -15,7 +15,7 @@ jobs: rustfmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: RustCrypto/actions/cargo-cache@master - uses: actions-rs/toolchain@v1 with: @@ -30,7 +30,7 @@ jobs: clippy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: RustCrypto/actions/cargo-cache@master - uses: actions-rs/toolchain@v1 with: @@ -45,7 +45,7 @@ jobs: check-for-todos: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: make check-for-todos continue-on-error: true @@ -54,7 +54,7 @@ jobs: outputs: msrv: ${{ steps.msrv.outputs.msrv }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: RustCrypto/actions/cargo-cache@master - name: Install msrv run: cargo install cargo-msrv @@ -68,9 +68,9 @@ jobs: outputs: msrv: ${{ steps.msrv.outputs.msrv }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - id: msrv - run: echo "msrv::$(grep rust-version Cargo.toml | cut -d'"' -f2-2)" >> $GITHUB_OUTPUT + run: echo "::set-output name=msrv::$(grep rust-version Cargo.toml | cut -d'"' -f2-2)" build: needs: set-msrv @@ -84,7 +84,7 @@ jobs: - thumbv7em-none-eabi - wasm32-unknown-unknown steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: RustCrypto/actions/cargo-cache@master - uses: actions-rs/toolchain@v1 with: @@ -103,7 +103,7 @@ jobs: - ${{needs.set-msrv.outputs.msrv}} - stable steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: RustCrypto/actions/cargo-cache@master - uses: actions-rs/toolchain@v1 with: @@ -119,7 +119,7 @@ jobs: needs: set-msrv runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: RustCrypto/actions/cargo-cache@master - uses: actions-rs/toolchain@v1 with: @@ -146,7 +146,7 @@ jobs: # Cross mounts only current package, i.e. by default it ignores workspace's Cargo.toml working-directory: . steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: ./.github/actions/cross-tests with: rust: ${{ matrix.rust }} From f9071daf703bd85de01de68ef1501d681aac0978 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Wed, 15 Nov 2023 16:05:10 +0100 Subject: [PATCH 07/43] lms.yml: 2nd try: replace deprecated "set-output" See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ --- .github/workflows/lms.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lms.yml b/.github/workflows/lms.yml index e46389d5..15f4e3d3 100644 --- a/.github/workflows/lms.yml +++ b/.github/workflows/lms.yml @@ -70,7 +70,7 @@ jobs: steps: - uses: actions/checkout@v4 - id: msrv - run: echo "::set-output name=msrv::$(grep rust-version Cargo.toml | cut -d'"' -f2-2)" + run: echo "msrv=$(grep rust-version Cargo.toml | cut -d'"' -f2-2)" >> $GITHUB_OUTPUT build: needs: set-msrv From 92601d530197cc1df0f6309ab8ad2135719b59be Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Wed, 15 Nov 2023 16:41:37 +0100 Subject: [PATCH 08/43] CI *.yml: replace deprecated actions-rs Replace (as suggested in online discussions) with "dtolnay/rust-toolchain" due to deprecated node12. See: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/ https://github.com/dtolnay/rust-toolchain --- .github/actions/cross-tests/action.yml | 6 ++---- .github/workflows/lms.yml | 21 ++++++--------------- .github/workflows/security-audit.yml | 2 +- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/.github/actions/cross-tests/action.yml b/.github/actions/cross-tests/action.yml index 83c745eb..319ad014 100644 --- a/.github/actions/cross-tests/action.yml +++ b/.github/actions/cross-tests/action.yml @@ -14,12 +14,10 @@ runs: using: "composite" steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: ${{ inputs.rust }} - target: ${{ inputs.target }} - override: true + targets: ${{ inputs.target }} - uses: RustCrypto/actions/cross-install@master - run: | # cd ${{ inputs.package }} Not needed, as only a single crate is located in this repository diff --git a/.github/workflows/lms.yml b/.github/workflows/lms.yml index 15f4e3d3..9989d499 100644 --- a/.github/workflows/lms.yml +++ b/.github/workflows/lms.yml @@ -17,12 +17,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: RustCrypto/actions/cargo-cache@master - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: toolchain: stable components: rustfmt - profile: minimal - override: true - run: | cargo fmt --version cargo fmt --all -- --check @@ -32,12 +30,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: RustCrypto/actions/cargo-cache@master - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: toolchain: stable components: clippy - profile: minimal - override: true - run: | cargo clippy --version cargo clippy --lib --bins --tests --examples --all-features -- -D warnings @@ -86,12 +82,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: RustCrypto/actions/cargo-cache@master - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} - override: true + targets: ${{ matrix.target }} - run: cargo build --no-default-features --target ${{ matrix.target }} test: @@ -105,11 +99,9 @@ jobs: steps: - uses: actions/checkout@v4 - uses: RustCrypto/actions/cargo-cache@master - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: ${{ matrix.rust }} - override: true - run: cargo test - run: cargo test -- --include-ignored - run: cargo test --features fast_verify @@ -121,9 +113,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: RustCrypto/actions/cargo-cache@master - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: nightly - run: rustup run nightly cargo bench diff --git a/.github/workflows/security-audit.yml b/.github/workflows/security-audit.yml index 0d82d54b..e206b838 100644 --- a/.github/workflows/security-audit.yml +++ b/.github/workflows/security-audit.yml @@ -13,7 +13,7 @@ jobs: name: Security Audit runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Cache cargo bin uses: actions/cache@v1 with: From 44d38026804c612ea57485cb6047dad88bd1dca0 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Tue, 21 Nov 2023 18:36:29 +0100 Subject: [PATCH 09/43] Add module "sst" (SingleSubTree) and example - contains just the module structure - adapt lib.rs --- examples/sst_demo.rs | 31 +++++++++++++++++++++++++++++++ src/lib.rs | 4 ++++ src/sst/gen_key.rs | 6 ++++++ src/sst/mod.rs | 7 +++++++ src/sst/sign.rs | 6 ++++++ src/sst/verify.rs | 3 +++ 6 files changed, 57 insertions(+) create mode 100644 examples/sst_demo.rs create mode 100644 src/sst/gen_key.rs create mode 100644 src/sst/mod.rs create mode 100644 src/sst/sign.rs create mode 100644 src/sst/verify.rs diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs new file mode 100644 index 00000000..3b82dc49 --- /dev/null +++ b/examples/sst_demo.rs @@ -0,0 +1,31 @@ +//use hbs_lms::*; +use std::{ + //error::Error, + //fmt, + //fs::{read, File}, + //io::{Read, Write}, + process::exit, +}; + +// @TODO: try to use via "sst::"" + +fn main() { + // sst + let _key = match hbs_lms::gen_key::genkey() { + Ok(_) => println!("sst::gen_key OK"), + Err(error) => panic!("sst::gen_key: error {:?}", error), + }; + + let _signature = match hbs_lms::sign::sign() { + Ok(_) => println!("sst::sign OK"), + Err(error) => panic!("sst::sign {:?}", error), + }; + + if hbs_lms::verify::verify() == false { + println!("sst::verify failed"); + exit(1); + } + println!("sst::verify OK"); + + exit(0); +} \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index e2adea9c..b154bcb3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -90,6 +90,7 @@ mod hss; mod lm_ots; mod lms; mod util; +mod sst; // Re-export the `signature` crate pub use signature::{self}; @@ -116,6 +117,9 @@ pub use crate::hss::hss_sign_mut as sign_mut; pub use crate::hss::hss_verify as verify; pub use crate::hss::{SigningKey, VerifyingKey}; +// @TODO: Re-export: API for distributed state management (SST, SingleSubTree) +pub use crate::sst::*; // {gen_key, sign, verify}; + use core::convert::TryFrom; use signature::Error; use tinyvec::ArrayVec; diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs new file mode 100644 index 00000000..d2fe94f1 --- /dev/null +++ b/src/sst/gen_key.rs @@ -0,0 +1,6 @@ +use crate::signature::Error; + +pub fn genkey() -> Result<(), Error> { + // @TODO: use the Error + Ok(()) +} \ No newline at end of file diff --git a/src/sst/mod.rs b/src/sst/mod.rs new file mode 100644 index 00000000..554818fa --- /dev/null +++ b/src/sst/mod.rs @@ -0,0 +1,7 @@ +/* + * Description of the module/API + */ + +pub mod gen_key; +pub mod sign; +pub mod verify; \ No newline at end of file diff --git a/src/sst/sign.rs b/src/sst/sign.rs new file mode 100644 index 00000000..7f3adf91 --- /dev/null +++ b/src/sst/sign.rs @@ -0,0 +1,6 @@ +use crate::signature::Error; + +pub fn sign() -> Result<(), Error> { + // see + Ok(()) +} \ No newline at end of file diff --git a/src/sst/verify.rs b/src/sst/verify.rs new file mode 100644 index 00000000..c0595738 --- /dev/null +++ b/src/sst/verify.rs @@ -0,0 +1,3 @@ +pub fn verify() -> bool { + true +} \ No newline at end of file From 8b2e5ecffbb6c4c447f3b97594711ee38dbd7687 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Tue, 12 Dec 2023 17:08:17 +0100 Subject: [PATCH 10/43] Setup code structure/API --- examples/sst_demo.rs | 21 +++++++++++++++------ src/lib.rs | 2 +- src/sst/gen_key.rs | 15 +++++++++++++-- src/sst/mod.rs | 13 +++++++------ src/sst/sign.rs | 25 ++++++++++++++++++++++--- src/sst/verify.rs | 17 +++++++++++++++-- 6 files changed, 73 insertions(+), 20 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 3b82dc49..106cba9c 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -1,4 +1,3 @@ -//use hbs_lms::*; use std::{ //error::Error, //fmt, @@ -6,22 +5,32 @@ use std::{ //io::{Read, Write}, process::exit, }; +use hbs_lms::*; // @TODO: try to use via "sst::"" +type Hasher = Sha256_256; + fn main() { - // sst - let _key = match hbs_lms::gen_key::genkey() { + let message = [32; 0]; // 32 elements init. with 0 + let _hss_key = match hbs_lms::sst::gen_hss_key() { + Ok(_) => println!("sst::gen_key OK"), + Err(error) => panic!("sst::gen_key: error {:?}", error), + }; + + let _sst_pubkey = match hbs_lms::sst::gen_sst_pubkey() { Ok(_) => println!("sst::gen_key OK"), Err(error) => panic!("sst::gen_key: error {:?}", error), }; - - let _signature = match hbs_lms::sign::sign() { + + let _signature = match hbs_lms::sst::sign::(&message) { Ok(_) => println!("sst::sign OK"), Err(error) => panic!("sst::sign {:?}", error), }; - if hbs_lms::verify::verify() == false { + let signature = [32; 0]; // 32 elements init. with 0 + let public_key = [32; 0]; // 32 elements init. with 0 + if hbs_lms::sst::verify::(&message, &signature, &public_key) == false { println!("sst::verify failed"); exit(1); } diff --git a/src/lib.rs b/src/lib.rs index b154bcb3..a6305a3a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -90,7 +90,7 @@ mod hss; mod lm_ots; mod lms; mod util; -mod sst; +pub mod sst; // Re-export the `signature` crate pub use signature::{self}; diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index d2fe94f1..a3826740 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -1,6 +1,17 @@ +//use crate::{signature::Error, HssParameter, Sha256_256}; use crate::signature::Error; -pub fn genkey() -> Result<(), Error> { +pub fn gen_hss_key() -> Result<(), Error> { + // @TODO: nyi + Ok(()) +} +/// Parameters: +/// other_hss_pub_keys: HSS public keys of other signing entities +/// own_hss_pub_key: HSS public key of the calling signing entity (separate, to create entity's individual authentication path). +/// Returns the root node (public key) which comprises the authentication path -- whihch is different for every signing entity! + +pub fn gen_sst_pubkey() -> Result<(), Error> { + // @TODO: use the Error Ok(()) -} \ No newline at end of file +} diff --git a/src/sst/mod.rs b/src/sst/mod.rs index 554818fa..240023c7 100644 --- a/src/sst/mod.rs +++ b/src/sst/mod.rs @@ -1,7 +1,8 @@ -/* - * Description of the module/API - */ +//! Module sst -pub mod gen_key; -pub mod sign; -pub mod verify; \ No newline at end of file +mod gen_key; +pub use gen_key::*; +mod sign; +pub use sign::*; +mod verify; +pub use verify::*; diff --git a/src/sst/sign.rs b/src/sst/sign.rs index 7f3adf91..4ce30ae4 100644 --- a/src/sst/sign.rs +++ b/src/sst/sign.rs @@ -1,6 +1,25 @@ use crate::signature::Error; +use crate::constants::Node; +use crate::hss::signing::HssSignature; +use crate::HashChain; +use tinyvec::ArrayVec; -pub fn sign() -> Result<(), Error> { - // see +pub struct SstsSignature { + pub hss_signature: HssSignature, + // use an ArrayVec with a @TODO max size? + pub our_node: Node, + pub auth_path: ArrayVec<[Node; 32]>, // order: sort on-the-fly dep. on Node's values? +} + +pub fn sign( + _message: &[u8], +) -> Result<(), Error> { + // nyi + /* hbs_lms::sign::( + &message_data, + &private_key_data, + &mut private_key_update_function, + Some(aux_slice), + ) */ Ok(()) -} \ No newline at end of file +} diff --git a/src/sst/verify.rs b/src/sst/verify.rs index c0595738..95e9cbcc 100644 --- a/src/sst/verify.rs +++ b/src/sst/verify.rs @@ -1,3 +1,16 @@ -pub fn verify() -> bool { +use crate::HashChain; +use crate::hss; + +pub fn verify( + message: &[u8], + signature: &[u8], + public_key: &[u8], +) -> bool { + // @TODO nyi + // - verify SST (= HSS/LMS) signature (same as for HSS/LMS) + let _hss_sig = hss::hss_verify::(&message, &signature, &public_key).is_ok(); + + // - verify ST: calc. ST key candidate (using SST pubkey and authentication path), compare with stored ST publey + true -} \ No newline at end of file +} From c09bd0f072ccddb711230d09dc0cbbcf58aeca69 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Sun, 17 Dec 2023 14:39:20 +0100 Subject: [PATCH 11/43] Import code from lms-demo.rs into sst_demo.rs --- examples/sst_demo.rs | 410 +++++++++++++++++++++++++++++++++++++++++-- src/sst/gen_key.rs | 2 +- 2 files changed, 399 insertions(+), 13 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 106cba9c..8f46d7eb 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -1,21 +1,68 @@ +use clap::{Arg, ArgMatches, Command}; +use hbs_lms::*; use std::{ - //error::Error, - //fmt, - //fs::{read, File}, - //io::{Read, Write}, + error::Error, + fmt, + fs::{read, File}, + io::{Read, Write}, process::exit, }; -use hbs_lms::*; -// @TODO: try to use via "sst::"" +const GENKEY_COMMAND: &str = "genkey"; +const VERIFY_COMMAND: &str = "verify"; +const SIGN_COMMAND: &str = "sign"; + +#[cfg(feature = "fast_verify")] +const SIGN_MUT_COMMAND: &str = "sign_mut"; + +const KEYNAME_PARAMETER: &str = "keyname"; +const MESSAGE_PARAMETER: &str = "file"; +const PARAMETER_PARAMETER: &str = "parameter"; +const SEED_PARAMETER: &str = "seed"; + +const AUX_DATA_DEFAULT_SIZE: usize = 100_000_000; + +#[derive(Debug)] +struct DemoError(String); + +impl fmt::Display for DemoError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "There is an error: {}", self.0) + } +} + +impl Error for DemoError {} + +impl DemoError { + pub fn raise(message: String) -> Result> { + Err(Box::new(Self(message))) + } +} type Hasher = Sha256_256; -fn main() { +struct GenKeyParameter { + parameter: Vec>, + aux_data: usize, +} + +impl GenKeyParameter { + pub fn new(parameter: Vec>, aux_data: Option) -> Self { + let aux_data = aux_data.unwrap_or(AUX_DATA_DEFAULT_SIZE); + Self { + parameter, + aux_data, + } + } +} + + +fn main() -> Result<(), Box> { let message = [32; 0]; // 32 elements init. with 0 - let _hss_key = match hbs_lms::sst::gen_hss_key() { - Ok(_) => println!("sst::gen_key OK"), - Err(error) => panic!("sst::gen_key: error {:?}", error), + let _hss_key = match hbs_lms::sst::gen_sst_subtree() { + // save aux data here or in gen_sst_subtree()? -> rather here, compare with lms-demo + Ok(_) => println!("sst::gen_sst_subtree OK"), + Err(error) => panic!("sst::gen_sst_subtree error {:?}", error), }; let _sst_pubkey = match hbs_lms::sst::gen_sst_pubkey() { @@ -36,5 +83,344 @@ fn main() { } println!("sst::verify OK"); - exit(0); -} \ No newline at end of file + + // ********** code from "lms-demo.rs" to steal/import parameter parsing etc. ********** + let command = Command::new("LMS Demo") + .about("Generates a LMS key pair") + .subcommand( + Command::new(GENKEY_COMMAND) + .arg(Arg::new(KEYNAME_PARAMETER).required(true)) + .arg(Arg::new(PARAMETER_PARAMETER).required(false).help( + "Specify LMS parameters (e.g. 15/4 (Treeheight 15 and Winternitz parameter 4))", + ).default_value("5/1")) + .arg(Arg::new(SEED_PARAMETER).long(SEED_PARAMETER).required(true).takes_value(true).value_name("seed")), + ) + .subcommand( + Command::new(VERIFY_COMMAND) + .arg(Arg::new(KEYNAME_PARAMETER).required(true)) + .arg(Arg::new(MESSAGE_PARAMETER).required(true).help("File to verify"))) + .subcommand( + Command::new(SIGN_COMMAND) + .arg(Arg::new(KEYNAME_PARAMETER).required(true)) + .arg(Arg::new(MESSAGE_PARAMETER).required(true)) + ); + + #[cfg(feature = "fast_verify")] + let command = command.subcommand( + Command::new(SIGN_MUT_COMMAND) + .arg(Arg::new(KEYNAME_PARAMETER).required(true)) + .arg(Arg::new(MESSAGE_PARAMETER).required(true)), + ); + + let matches = command.get_matches(); + + if let Some(args) = matches.subcommand_matches(GENKEY_COMMAND) { + genkey(args)?; + println!("Keys successful generated!"); + return Ok(()); + } + + if let Some(args) = matches.subcommand_matches(VERIFY_COMMAND) { + let result = verify(args); + if result { + println!("Successful!"); + exit(0); + } else { + println!("Wrong signature"); + exit(-1); + } + } + + if let Some(args) = matches.subcommand_matches(SIGN_COMMAND) { + sign(args)?; + println!("Signature successful generated!"); + return Ok(()); + } + + #[cfg(feature = "fast_verify")] + if let Some(args) = matches.subcommand_matches(SIGN_MUT_COMMAND) { + sign_mut(args)?; + println!("Mut signature successful generated!"); + return Ok(()); + } + + + Ok(()) +} + + + +fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { + let keyname = get_parameter(KEYNAME_PARAMETER, args); + let message_name = get_parameter(MESSAGE_PARAMETER, args); + + let private_key_name = get_private_key_name(&keyname); + let signature_name = get_signature_name(&message_name); + + let private_key_data = read_file(&private_key_name); + let message_data = read_file(&message_name); + + let aux_data_name = get_aux_name(&keyname); + let mut aux_data = read(aux_data_name).ok(); + + let mut private_key_update_function = |new_key: &[u8]| { + if write(&private_key_name, new_key).is_ok() { + return Ok(()); + } + Err(()) + }; + + let result = if let Some(aux_data) = aux_data.as_mut() { + let aux_slice = &mut &mut aux_data[..]; + hbs_lms::sign::( + &message_data, + &private_key_data, + &mut private_key_update_function, + Some(aux_slice), + ) + } else { + hbs_lms::sign::( + &message_data, + &private_key_data, + &mut private_key_update_function, + None, + ) + }; + + if result.is_err() { + println!("Could not sign message."); + exit(-1) + } + + write(&signature_name, result.unwrap().as_ref())?; + + Ok(()) +} + +#[cfg(feature = "fast_verify")] +fn sign_mut(args: &ArgMatches) -> Result<(), std::io::Error> { + let keyname = get_parameter(KEYNAME_PARAMETER, args); + let message_name = get_parameter(MESSAGE_PARAMETER, args); + + let private_key_name = get_private_key_name(&keyname); + + let signature_name_mut = get_signature_mut_name(&message_name); + let message_name_mut = get_message_mut_name(&message_name); + + let private_key_data = read_file(&private_key_name); + + let mut message_data = read_file(&message_name); + message_data.extend_from_slice(&[0u8; 32]); + + let aux_data_name = get_aux_name(&keyname); + let mut aux_data = read(aux_data_name).ok(); + + let mut private_key_update_function = |new_key: &[u8]| { + if write(&private_key_name, new_key).is_ok() { + return Ok(()); + } + Err(()) + }; + + let signature_result = if let Some(aux_data) = aux_data.as_mut() { + let aux_slice = &mut &mut aux_data[..]; + hbs_lms::sign_mut::( + &mut message_data, + &private_key_data, + &mut private_key_update_function, + Some(aux_slice), + ) + } else { + hbs_lms::sign_mut::( + &mut message_data, + &private_key_data, + &mut private_key_update_function, + None, + ) + }; + + if signature_result.is_err() { + println!("Could not sign message."); + exit(-1) + } + let signature = signature_result.unwrap(); + + write(&signature_name_mut, signature.as_ref())?; + write(&message_name_mut, &message_data)?; + + #[cfg(feature = "verbose")] + println!( + "fast_verify needed {} iterations.", + signature.hash_iterations + ); + + Ok(()) +} + +fn verify(args: &ArgMatches) -> bool { + let keyname: String = get_parameter(KEYNAME_PARAMETER, args); + let message_name: String = get_parameter(MESSAGE_PARAMETER, args); + + let public_key_name = get_public_key_name(&keyname); + let signature_name = get_signature_name(&message_name); + + let signature_data = read_file(&signature_name); + let message_data = read_file(&message_name); + let public_key_data = read_file(&public_key_name); + + hbs_lms::verify::(&message_data, &signature_data, &public_key_data).is_ok() +} + +fn get_public_key_name(keyname: &str) -> String { + keyname.to_string() + ".pub" +} + +fn get_signature_name(message_name: &str) -> String { + message_name.to_string() + ".sig" +} + +#[cfg(feature = "fast_verify")] +fn get_signature_mut_name(message_name: &str) -> String { + message_name.to_string() + "_mut.sig" +} + +#[cfg(feature = "fast_verify")] +fn get_message_mut_name(message_name: &str) -> String { + message_name.to_string() + "_mut" +} + +fn get_private_key_name(private_key: &str) -> String { + private_key.to_string() + ".prv" +} + +fn get_aux_name(keyname: &str) -> String { + keyname.to_string() + ".aux" +} + +fn get_parameter(name: &str, args: &ArgMatches) -> String { + args.value_of(name) + .expect("Parameter must be present.") + .into() +} + +fn read_file(file_name: &str) -> Vec { + let mut file = std::fs::File::open(file_name) + .unwrap_or_else(|_| panic!("Could not read data from: {}", file_name)); + + let mut data: Vec = Vec::new(); + file.read_to_end(&mut data) + .unwrap_or_else(|_| panic!("Could not read data from: {}", file_name)); + + data +} + +fn genkey(args: &ArgMatches) -> Result<(), Box> { + let keyname: String = get_parameter(KEYNAME_PARAMETER, args); + + let genkey_parameter = parse_genkey_parameter(&get_parameter(PARAMETER_PARAMETER, args)); + let parameter = genkey_parameter.parameter; + + let seed: Seed = if let Some(seed) = args.value_of(SEED_PARAMETER) { + let decoded = hex::decode(seed)?; + if decoded.len() < Hasher::OUTPUT_SIZE as usize { + let error = format!( + "Seed is too short ({} of {} required bytes)", + decoded.len(), + Hasher::OUTPUT_SIZE + ); + return DemoError::raise(error); + } + let mut seed = Seed::default(); + seed.as_mut_slice().copy_from_slice(&decoded[..]); + seed + } else { + return DemoError::raise("Seed was not given".to_string()); + }; + + let mut aux_data = vec![0u8; genkey_parameter.aux_data]; + let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; + + let (signing_key, verifying_key) = keygen(¶meter, &seed, Some(aux_slice)) + .unwrap_or_else(|_| panic!("Could not generate keys")); + + let public_key_filename = get_public_key_name(&keyname); + let private_key_filename = get_private_key_name(&keyname); + + let aux_name = get_aux_name(&keyname); + write(&aux_name, aux_slice)?; + + write(public_key_filename.as_str(), verifying_key.as_slice())?; + write(private_key_filename.as_str(), signing_key.as_slice())?; + + Ok(()) +} + +fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { + let mut result = Vec::new(); + + let mut aux_data_size: Option = None; + + let parameter = if parameter.contains(':') { + let mut splitted = parameter.split(':'); + let parameter = splitted.next().expect("Should contain parameter"); + + let aux_data = splitted.next().expect("Should contain aux data size"); + let aux_data = aux_data + .parse::() + .expect("Could not parse aux data size"); + aux_data_size = Some(aux_data); + + parameter + } else { + parameter + }; + + // "," is supposed to split several HSS levels? 10/2,10/2,10/2 for three levels with tree=10 and w=2? + let parameters = parameter.split(','); + + for parameter in parameters { + let mut splitted = parameter.split('/'); + + let height = splitted + .next() + .expect("Merkle tree height not correct specified"); + let winternitz_parameter = splitted + .next() + .expect("Winternitz parameter not correct specified"); + + let height: u8 = height + .parse() + .expect("Merkle tree height not correct specified"); + let winternitz_parameter: u8 = winternitz_parameter + .parse() + .expect("Winternitz parameter not correct specified"); + + let lm_ots = match winternitz_parameter { + 1 => LmotsAlgorithm::LmotsW1, + 2 => LmotsAlgorithm::LmotsW2, + 4 => LmotsAlgorithm::LmotsW4, + 8 => LmotsAlgorithm::LmotsW8, + _ => panic!("Wrong winternitz parameter"), + }; + + let lms = match height { + 5 => LmsAlgorithm::LmsH5, + 10 => LmsAlgorithm::LmsH10, + 15 => LmsAlgorithm::LmsH15, + 20 => LmsAlgorithm::LmsH20, + 25 => LmsAlgorithm::LmsH25, + _ => panic!("Height not supported"), + }; + + let parameter = HssParameter::new(lm_ots, lms); + result.push(parameter); + } + + GenKeyParameter::new(result, aux_data_size) +} + +fn write(filename: &str, content: &[u8]) -> Result<(), std::io::Error> { + let mut file = File::create(filename)?; + file.write_all(content)?; + Ok(()) +} diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index a3826740..82da028d 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -1,7 +1,7 @@ //use crate::{signature::Error, HssParameter, Sha256_256}; use crate::signature::Error; -pub fn gen_hss_key() -> Result<(), Error> { +pub fn gen_sst_subtree() -> Result<(), Error> { // @TODO: nyi Ok(()) } From 6aa7261396a6248d85f9d90c8106bcbbeb76cacb Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Sun, 17 Dec 2023 16:11:25 +0100 Subject: [PATCH 12/43] sst: Add some helper file & function incl. tests Add "mod helper" to sst/mod.rs to integrate/build/test new file helper.rs. --- src/sst/helper.rs | 81 +++++++++++++++++++++++++++++++++++++++++++++++ src/sst/mod.rs | 4 +++ 2 files changed, 85 insertions(+) create mode 100644 src/sst/helper.rs diff --git a/src/sst/helper.rs b/src/sst/helper.rs new file mode 100644 index 00000000..9c35f9b0 --- /dev/null +++ b/src/sst/helper.rs @@ -0,0 +1,81 @@ +// a function that provides our sub-tree top node idx within the SSTS +// we provide parameters index, total height and dividing (top/bottom) +// subtree_num counts from left-most = 1 to "number_of_leaves" dep. on top division +fn get_subtree_node_idx(subtree_num: usize, tot_height: usize, top_div: usize) -> usize { + assert!(subtree_num > 0); + assert!(subtree_num <= get_num_leaves(top_div)); // number of nodes at that level + assert!(top_div <= tot_height); + + 2usize.pow(top_div as u32) - 1 + subtree_num +} + +// how many subtrees, dep on total height and division +// -> call number_leaves(top_height) + +// number of leaves of a regular Merkle tree +fn get_num_leaves(height: usize) -> usize { + 2usize.pow(height as u32) +} + +// last_leaf_node_idx +// (2 ^ (height+1)) - 1 + + + +#[cfg(test)] +mod tests { + + use super::*; + + #[test] + fn sst_get_subtree_node_in_ssts_1() { + let subtree_node_idx = get_subtree_node_idx(1, 4, 2); + assert_eq!(4, subtree_node_idx); + } + + #[test] + fn sst_get_subtree_node_in_ssts_2() { + let subtree_node_idx = get_subtree_node_idx(2, 4, 2); + assert_eq!(5, subtree_node_idx); + } + + #[test] + fn sst_get_subtree_node_in_ssts_3() { + let subtree_node_idx = get_subtree_node_idx(1, 4, 3); + assert_eq!(8, subtree_node_idx); + } + + #[test] + fn sst_get_subtree_node_in_ssts_4() { + let subtree_node_idx = get_subtree_node_idx(2, 4, 3); + assert_eq!(9, subtree_node_idx); + } + + #[test] + fn sst_get_subtree_node_in_ssts_5() { + let subtree_node_idx = get_subtree_node_idx(1, 4, 4); + assert_eq!(16, subtree_node_idx); + } + + #[test] + fn sst_get_subtree_node_in_ssts_6() { + let subtree_node_idx = get_subtree_node_idx(9, 4, 4); + assert_eq!(24, subtree_node_idx); + } + + // one outermost "leaf" + #[test] + fn sst_get_subtree_node_in_ssts_7() { + let subtree_node_idx = get_subtree_node_idx(16, 4, 4); + assert_eq!(31, subtree_node_idx); + } + + // wrong config, subtree_node_idx too high + #[test] + #[should_panic] + fn sst_get_subtree_node_in_ssts_8() { + let _subtree_node_idx = get_subtree_node_idx(17, 4, 4); + //assert_eq!(31, subtree_node_idx); + } + +} \ No newline at end of file diff --git a/src/sst/mod.rs b/src/sst/mod.rs index 240023c7..f53f51db 100644 --- a/src/sst/mod.rs +++ b/src/sst/mod.rs @@ -2,7 +2,11 @@ mod gen_key; pub use gen_key::*; + mod sign; pub use sign::*; + mod verify; pub use verify::*; + +mod helper; From cb57ebf5165bd9175bcb01b0662dd05b7ce5f252 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Tue, 19 Dec 2023 15:58:00 +0100 Subject: [PATCH 13/43] sst: adapt parameters for "top part height" For all "HssParameter"s, only one top part height for "dividing" one tree is needed. --- examples/sst_demo.rs | 94 ++++++++++++++++++++++++++----------------- src/lib.rs | 2 + src/sst/mod.rs | 1 + src/sst/parameters.rs | 55 +++++++++++++++++++++++++ src/sst/verify.rs | 11 ++--- 5 files changed, 121 insertions(+), 42 deletions(-) create mode 100644 src/sst/parameters.rs diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 8f46d7eb..d6ac28de 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -7,6 +7,7 @@ use std::{ io::{Read, Write}, process::exit, }; +use tinyvec::ArrayVec; const GENKEY_COMMAND: &str = "genkey"; const VERIFY_COMMAND: &str = "verify"; @@ -15,10 +16,10 @@ const SIGN_COMMAND: &str = "sign"; #[cfg(feature = "fast_verify")] const SIGN_MUT_COMMAND: &str = "sign_mut"; -const KEYNAME_PARAMETER: &str = "keyname"; -const MESSAGE_PARAMETER: &str = "file"; -const PARAMETER_PARAMETER: &str = "parameter"; -const SEED_PARAMETER: &str = "seed"; +const ARG_KEYNAME: &str = "keyname"; +const ARG_MESSAGE: &str = "file"; +const ARG_SSTS_PARAMETER: &str = "parameter"; +const ARG_SEED: &str = "seed"; const AUX_DATA_DEFAULT_SIZE: usize = 100_000_000; @@ -42,12 +43,12 @@ impl DemoError { type Hasher = Sha256_256; struct GenKeyParameter { - parameter: Vec>, + parameter: SstsParameter, aux_data: usize, } impl GenKeyParameter { - pub fn new(parameter: Vec>, aux_data: Option) -> Self { + pub fn new(parameter: SstsParameter, aux_data: Option) -> Self { let aux_data = aux_data.unwrap_or(AUX_DATA_DEFAULT_SIZE); Self { parameter, @@ -58,6 +59,7 @@ impl GenKeyParameter { fn main() -> Result<(), Box> { + let message = [32; 0]; // 32 elements init. with 0 let _hss_key = match hbs_lms::sst::gen_sst_subtree() { // save aux data here or in gen_sst_subtree()? -> rather here, compare with lms-demo @@ -81,35 +83,35 @@ fn main() -> Result<(), Box> { println!("sst::verify failed"); exit(1); } + println!("sst::verify OK"); // ********** code from "lms-demo.rs" to steal/import parameter parsing etc. ********** - let command = Command::new("LMS Demo") - .about("Generates a LMS key pair") + let command = Command::new("SSTS Demo") + .about("Generates SSTS keys and uses them for signing and verifying.") .subcommand( Command::new(GENKEY_COMMAND) - .arg(Arg::new(KEYNAME_PARAMETER).required(true)) - .arg(Arg::new(PARAMETER_PARAMETER).required(false).help( - "Specify LMS parameters (e.g. 15/4 (Treeheight 15 and Winternitz parameter 4))", - ).default_value("5/1")) - .arg(Arg::new(SEED_PARAMETER).long(SEED_PARAMETER).required(true).takes_value(true).value_name("seed")), + .arg(Arg::new(ARG_KEYNAME).required(true)) + .arg(Arg::new(ARG_SSTS_PARAMETER).required(true).help( + "Specify LMS parameters (e.g. 5/4/2 (tree height 5, Winternitz parameter 4, top height 2))")) + .arg(Arg::new(ARG_SEED).long(ARG_SEED).required(true).takes_value(true).value_name("seed")), ) .subcommand( Command::new(VERIFY_COMMAND) - .arg(Arg::new(KEYNAME_PARAMETER).required(true)) - .arg(Arg::new(MESSAGE_PARAMETER).required(true).help("File to verify"))) + .arg(Arg::new(ARG_KEYNAME).required(true)) + .arg(Arg::new(ARG_MESSAGE).required(true).help("File to verify"))) .subcommand( Command::new(SIGN_COMMAND) - .arg(Arg::new(KEYNAME_PARAMETER).required(true)) - .arg(Arg::new(MESSAGE_PARAMETER).required(true)) + .arg(Arg::new(ARG_KEYNAME).required(true)) + .arg(Arg::new(ARG_MESSAGE).required(true)) ); #[cfg(feature = "fast_verify")] let command = command.subcommand( Command::new(SIGN_MUT_COMMAND) - .arg(Arg::new(KEYNAME_PARAMETER).required(true)) - .arg(Arg::new(MESSAGE_PARAMETER).required(true)), + .arg(Arg::new(ARG_KEYNAME).required(true)) + .arg(Arg::new(ARG_MESSAGE).required(true)), ); let matches = command.get_matches(); @@ -151,8 +153,8 @@ fn main() -> Result<(), Box> { fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { - let keyname = get_parameter(KEYNAME_PARAMETER, args); - let message_name = get_parameter(MESSAGE_PARAMETER, args); + let keyname = get_parameter(ARG_KEYNAME, args); + let message_name = get_parameter(ARG_MESSAGE, args); let private_key_name = get_private_key_name(&keyname); let signature_name = get_signature_name(&message_name); @@ -199,8 +201,8 @@ fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { #[cfg(feature = "fast_verify")] fn sign_mut(args: &ArgMatches) -> Result<(), std::io::Error> { - let keyname = get_parameter(KEYNAME_PARAMETER, args); - let message_name = get_parameter(MESSAGE_PARAMETER, args); + let keyname = get_parameter(ARG_KEYNAME, args); + let message_name = get_parameter(ARG_MESSAGE, args); let private_key_name = get_private_key_name(&keyname); @@ -258,8 +260,8 @@ fn sign_mut(args: &ArgMatches) -> Result<(), std::io::Error> { } fn verify(args: &ArgMatches) -> bool { - let keyname: String = get_parameter(KEYNAME_PARAMETER, args); - let message_name: String = get_parameter(MESSAGE_PARAMETER, args); + let keyname: String = get_parameter(ARG_KEYNAME, args); + let message_name: String = get_parameter(ARG_MESSAGE, args); let public_key_name = get_public_key_name(&keyname); let signature_name = get_signature_name(&message_name); @@ -315,12 +317,12 @@ fn read_file(file_name: &str) -> Vec { } fn genkey(args: &ArgMatches) -> Result<(), Box> { - let keyname: String = get_parameter(KEYNAME_PARAMETER, args); + let keyname: String = get_parameter(ARG_KEYNAME, args); - let genkey_parameter = parse_genkey_parameter(&get_parameter(PARAMETER_PARAMETER, args)); + let genkey_parameter = parse_genkey_parameter(&get_parameter(ARG_SSTS_PARAMETER, args)); let parameter = genkey_parameter.parameter; - let seed: Seed = if let Some(seed) = args.value_of(SEED_PARAMETER) { + let seed: Seed = if let Some(seed) = args.value_of(ARG_SEED) { let decoded = hex::decode(seed)?; if decoded.len() < Hasher::OUTPUT_SIZE as usize { let error = format!( @@ -340,7 +342,10 @@ fn genkey(args: &ArgMatches) -> Result<(), Box> { let mut aux_data = vec![0u8; genkey_parameter.aux_data]; let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; - let (signing_key, verifying_key) = keygen(¶meter, &seed, Some(aux_slice)) + // to fix for time being, provide HssParameter param as vector + let hss_params= parameter.get_hss_parameters(); + + let (signing_key, verifying_key) = keygen(hss_params, &seed, Some(aux_slice)) .unwrap_or_else(|_| panic!("Could not generate keys")); let public_key_filename = get_public_key_name(&keyname); @@ -356,9 +361,10 @@ fn genkey(args: &ArgMatches) -> Result<(), Box> { } fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { - let mut result = Vec::new(); + let mut vec_hss_params: ArrayVec<[_; 5]> = Default::default(); let mut aux_data_size: Option = None; + let mut top_part_height : u8 = 0; // @TODO later as option let parameter = if parameter.contains(':') { let mut splitted = parameter.split(':'); @@ -375,26 +381,38 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { parameter }; - // "," is supposed to split several HSS levels? 10/2,10/2,10/2 for three levels with tree=10 and w=2? + // "," is supposed to split several HSS levels; 10/2,10/2,10/2 for three levels with tree=10 and w=2 let parameters = parameter.split(','); for parameter in parameters { + // for now we check and abort if several HSS params provided; leave the HSS-param-loop for use in future + if vec_hss_params.len() >= 1 { + break; + } + let mut splitted = parameter.split('/'); let height = splitted .next() - .expect("Merkle tree height not correct specified"); + .expect("Merkle tree height invalid"); let winternitz_parameter = splitted .next() - .expect("Winternitz parameter not correct specified"); + .expect("Winternitz parameter invalid"); + let tmp_top_part_height = splitted + .next() + .expect("Top part height invalid"); let height: u8 = height .parse() - .expect("Merkle tree height not correct specified"); + .expect("Merkle tree height invalid"); let winternitz_parameter: u8 = winternitz_parameter .parse() .expect("Winternitz parameter not correct specified"); + top_part_height = tmp_top_part_height + .parse() + .expect("Top part height invalid"); + let lm_ots = match winternitz_parameter { 1 => LmotsAlgorithm::LmotsW1, 2 => LmotsAlgorithm::LmotsW2, @@ -412,11 +430,13 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { _ => panic!("Height not supported"), }; - let parameter = HssParameter::new(lm_ots, lms); - result.push(parameter); + let hss_parameters = HssParameter::new(lm_ots, lms); + vec_hss_params.push(hss_parameters); } - GenKeyParameter::new(result, aux_data_size) + let ssts_param = SstsParameter::new(vec_hss_params, top_part_height); + + GenKeyParameter::new(ssts_param, aux_data_size) } fn write(filename: &str, content: &[u8]) -> Result<(), std::io::Error> { diff --git a/src/lib.rs b/src/lib.rs index a6305a3a..d7a1ced0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -119,6 +119,8 @@ pub use crate::hss::{SigningKey, VerifyingKey}; // @TODO: Re-export: API for distributed state management (SST, SingleSubTree) pub use crate::sst::*; // {gen_key, sign, verify}; +pub use crate::sst::parameters::SstsParameter; + use core::convert::TryFrom; use signature::Error; diff --git a/src/sst/mod.rs b/src/sst/mod.rs index f53f51db..34a934fe 100644 --- a/src/sst/mod.rs +++ b/src/sst/mod.rs @@ -10,3 +10,4 @@ mod verify; pub use verify::*; mod helper; +pub mod parameters; diff --git a/src/sst/parameters.rs b/src/sst/parameters.rs new file mode 100644 index 00000000..531a3bb5 --- /dev/null +++ b/src/sst/parameters.rs @@ -0,0 +1,55 @@ +use crate::{ + hasher::HashChain, + hss::parameter::HssParameter, +}; + +use tinyvec::ArrayVec; + + +#[derive(Clone, PartialEq, Eq)] +pub struct SstsParameter { + hss_parameters: ArrayVec<[HssParameter; 5]>, // @TODO replace 5 with some defined constant; currently min=max=1 + top_height: u8, +} + + +// @TODO: necessary? currently apparently not +// impl Copy for SstsParameter {} + +impl SstsParameter { + pub fn new(hss_params: ArrayVec<[HssParameter; 5]>, top_height: u8) -> Self { + + SstsParameter { + hss_parameters: hss_params, + top_height, + } + } + + pub fn get_hss_parameters(&self) -> &ArrayVec<[HssParameter; 5]> { + &self.hss_parameters + } + + pub fn get_top_height(&self) -> u8 { + self.top_height + } +} + +/* +impl SstsParameter { + pub fn construct_default_parameters() -> Self { + let lmots_parameter = LmotsAlgorithm::LmotsW1; + let lms_parameter = LmsAlgorithm::LmsH5; + + SstsParameter::new(lmots_parameter, lms_parameter, 3) + } +} + +impl Default for SstsParameter { + fn default() -> Self { + let lmots_parameter = LmotsAlgorithm::LmotsW1; + let lms_parameter = LmsAlgorithm::LmsH5; + + SstsParameter::new(lmots_parameter, lms_parameter, 3) + } +} + */ diff --git a/src/sst/verify.rs b/src/sst/verify.rs index 95e9cbcc..f05e3667 100644 --- a/src/sst/verify.rs +++ b/src/sst/verify.rs @@ -1,14 +1,15 @@ use crate::HashChain; -use crate::hss; +//use crate::hss; pub fn verify( - message: &[u8], - signature: &[u8], - public_key: &[u8], + _message: &[u8], + _signature: &[u8], + _public_key: &[u8], ) -> bool { // @TODO nyi // - verify SST (= HSS/LMS) signature (same as for HSS/LMS) - let _hss_sig = hss::hss_verify::(&message, &signature, &public_key).is_ok(); + + //let _hss_sig = hss::hss_verify::(&message, &signature, &public_key).is_ok(); // - verify ST: calc. ST key candidate (using SST pubkey and authentication path), compare with stored ST publey From c227dbaf527b48bb0b19b0edce77c950eb8bcca5 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Wed, 20 Dec 2023 17:49:32 +0100 Subject: [PATCH 14/43] sst: in demo use loop, move logic to sst:gen_key --- examples/sst_demo.rs | 43 ++++++++++++++++++++++++----- src/sst/gen_key.rs | 63 +++++++++++++++++++++++++++++++++++++++---- src/sst/parameters.rs | 6 ++--- 3 files changed, 98 insertions(+), 14 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index d6ac28de..527854c6 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -43,15 +43,15 @@ impl DemoError { type Hasher = Sha256_256; struct GenKeyParameter { - parameter: SstsParameter, + ssts_param: SstsParameter, aux_data: usize, } impl GenKeyParameter { - pub fn new(parameter: SstsParameter, aux_data: Option) -> Self { + pub fn new(ssts_param: SstsParameter, aux_data: Option) -> Self { let aux_data = aux_data.unwrap_or(AUX_DATA_DEFAULT_SIZE); Self { - parameter, + ssts_param, aux_data, } } @@ -61,12 +61,13 @@ impl GenKeyParameter { fn main() -> Result<(), Box> { let message = [32; 0]; // 32 elements init. with 0 + /* let _hss_key = match hbs_lms::sst::gen_sst_subtree() { // save aux data here or in gen_sst_subtree()? -> rather here, compare with lms-demo Ok(_) => println!("sst::gen_sst_subtree OK"), Err(error) => panic!("sst::gen_sst_subtree error {:?}", error), }; - + */ let _sst_pubkey = match hbs_lms::sst::gen_sst_pubkey() { Ok(_) => println!("sst::gen_key OK"), Err(error) => panic!("sst::gen_key: error {:?}", error), @@ -320,7 +321,7 @@ fn genkey(args: &ArgMatches) -> Result<(), Box> { let keyname: String = get_parameter(ARG_KEYNAME, args); let genkey_parameter = parse_genkey_parameter(&get_parameter(ARG_SSTS_PARAMETER, args)); - let parameter = genkey_parameter.parameter; + let ssts_param = genkey_parameter.ssts_param; let seed: Seed = if let Some(seed) = args.value_of(ARG_SEED) { let decoded = hex::decode(seed)?; @@ -343,7 +344,36 @@ fn genkey(args: &ArgMatches) -> Result<(), Box> { let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; // to fix for time being, provide HssParameter param as vector - let hss_params= parameter.get_hss_parameters(); + let hss_params= ssts_param.get_hss_parameters(); + + let num_signing_entities = 2_u32.pow(genkey_parameter.ssts_param.get_top_height() as u32); + let mut signing_entities_pubkey = Vec::>::with_capacity(num_signing_entities as usize); + let mut entity_idx = 0; + for signing_entity in &mut signing_entities_pubkey { + // @TODO move nach key_gen.rs + let mut node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); + entity_idx += 1; + node_value = gen_sst_subtree(genkey_parameter.ssts_param.get_top_height(), &hss_params[0], &seed, entity_idx ); + // @TODO work: + // 1. - create key for "get_tree_element()"" with seed -- we need different seeds! + // call lms::generate_key_pair ? I think except the seed, all parameters for key-gen are irrelevant + /*let seed : SeedAndLmsTreeIdentifier, + parameter: &HssParameter, + used_leafs_index: &u32, + aux_data: &mut Option,*/ + //let mut seed_and_lms_tree_identifier = hbs_lms::SeedAndLmsTreeIdentifier::default(); + //OsRng.fill_bytes(seed_and_lms_tree_identifier.seed.as_mut_slice()); + /*let mut private_key = hbs_lms::LmsPrivateKey::new( + seed_and_lms_tree_identifier.seed.clone(), + seed_and_lms_tree_identifier.lms_tree_identifier, + 0, + LmotsAlgorithm::construct_default_parameter(), + LmsAlgorithm::construct_default_parameter(), + );*/ + + // 2. - call get_tree_element(idx, LmsPrivateKey, None) + *signing_entity = node_value; + } let (signing_key, verifying_key) = keygen(hss_params, &seed, Some(aux_slice)) .unwrap_or_else(|_| panic!("Could not generate keys")); @@ -409,6 +439,7 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { .parse() .expect("Winternitz parameter not correct specified"); + // @TODO check: invalid if "height - top_part_height < 1" top_part_height = tmp_top_part_height .parse() .expect("Top part height invalid"); diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index 82da028d..89b18fda 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -1,17 +1,70 @@ -//use crate::{signature::Error, HssParameter, Sha256_256}; -use crate::signature::Error; +use crate::{signature::Error, HssParameter, Sha256_256}; +use tinyvec::ArrayVec; +use crate::{ + constants::{ + //LmsTreeIdentifier, + MAX_HASH_SIZE, + }, + hasher::HashChain, + //hss::definitions::HssPrivateKey, //seed_derive::SeedDerive} + //LmotsAlgorithm, LmsAlgorithm, + hss::reference_impl_private_key::SeedAndLmsTreeIdentifier, + hss::reference_impl_private_key::Seed, +}; -pub fn gen_sst_subtree() -> Result<(), Error> { +// parameters +pub fn gen_sst_subtree(top_height: u8, hss_param: &HssParameter, seed: &Seed, entity_idx: u8 ) + //-> Result, Error> { + -> ArrayVec<[u8; MAX_HASH_SIZE]> { // @TODO: nyi - Ok(()) + // 1. we need an HSS SigningKey/VerifyingKey ; pretend to have a full LMS here to fulfill + // param. requirements for existing functions. + // A difference is that the different signing entities will use different seeds, + // but that shouldn't have any repercussions + // 2. get_tree_element(idx, LmsPrivateKey, aux_data) + // w/o aux data first + // - idx + // - either 1 , but that would mean we consider as a whole tree + // - or rather the correct idx in the whole SSTS/LMS; we know our "sub-tree ID"; + // then each sub-tree's seed is used as a "start a left-most leaf" seed + + let mut node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); + // @TODO work: + // 1. - create key for "get_tree_element()"" with seed -- we need different seeds! + // a) + // call lms::mod.rs::generate_key_pair() ? I think except the seed, all parameters for key-gen are irrelevant + // hss::reference_impl_private_key.rs : SeedAndLmsTreeIdentifier, + // hss::parameter.rs::HssParameter, + // used_leafs_index: &u32, + // aux_data: &mut Option,*/ + let mut seed_and_lms_tree_identifier = SeedAndLmsTreeIdentifier::::default(); + //OsRng.fill_bytes(seed_and_lms_tree_identifier.seed.as_mut_slice()); + + // b) lms::definitions.rs::LmsPrivateKey::new() + // let mut private_key = LmsPrivateKey::new( + // seed_and_lms_tree_identifier.seed.clone(), + // seed_and_lms_tree_identifier.lms_tree_identifier, + // 0, + // LmotsAlgorithm::construct_default_parameter(), + // LmsAlgorithm::construct_default_parameter(), + //); + // 2. - call get_tree_element(idx, LmsPrivateKey, None) + + //Ok(node_value) + node_value } + /// Parameters: /// other_hss_pub_keys: HSS public keys of other signing entities /// own_hss_pub_key: HSS public key of the calling signing entity (separate, to create entity's individual authentication path). /// Returns the root node (public key) which comprises the authentication path -- whihch is different for every signing entity! - pub fn gen_sst_pubkey() -> Result<(), Error> { + // that's different now, because we do not generate a whole LMS based on + // one seed but on different intermediate nodes (with different seeds). + // -> Check whether there is a function that takes intermediate nodes! (e.g. function using aux data) + // because that's basically what we need + // @TODO: use the Error Ok(()) } diff --git a/src/sst/parameters.rs b/src/sst/parameters.rs index 531a3bb5..1c2f16f2 100644 --- a/src/sst/parameters.rs +++ b/src/sst/parameters.rs @@ -13,15 +13,15 @@ pub struct SstsParameter { } -// @TODO: necessary? currently apparently not -// impl Copy for SstsParameter {} +impl Copy for SstsParameter {} impl SstsParameter { pub fn new(hss_params: ArrayVec<[HssParameter; 5]>, top_height: u8) -> Self { SstsParameter { hss_parameters: hss_params, - top_height, + top_height, // e.g. LMS height of 5 and top_height 3, we divide 3/3 (we consider one node as part of both tree parts) + // would give us 2^3 = 8 signing entities } } From 41937cdeb5406bf07688b657c6c488adb31e8510 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Wed, 20 Dec 2023 18:52:29 +0100 Subject: [PATCH 15/43] sst: sst_demo: remove key_gen() loop Leave it to "sst_demo"-caller to provide different seeds. --- examples/sst_demo.rs | 69 +++++++++++++++++++++++-------------------- src/sst/gen_key.rs | 2 +- src/sst/parameters.rs | 8 ++++- 3 files changed, 45 insertions(+), 34 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 527854c6..548bf9c5 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -346,34 +346,29 @@ fn genkey(args: &ArgMatches) -> Result<(), Box> { // to fix for time being, provide HssParameter param as vector let hss_params= ssts_param.get_hss_parameters(); - let num_signing_entities = 2_u32.pow(genkey_parameter.ssts_param.get_top_height() as u32); - let mut signing_entities_pubkey = Vec::>::with_capacity(num_signing_entities as usize); - let mut entity_idx = 0; - for signing_entity in &mut signing_entities_pubkey { - // @TODO move nach key_gen.rs - let mut node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); - entity_idx += 1; - node_value = gen_sst_subtree(genkey_parameter.ssts_param.get_top_height(), &hss_params[0], &seed, entity_idx ); - // @TODO work: - // 1. - create key for "get_tree_element()"" with seed -- we need different seeds! - // call lms::generate_key_pair ? I think except the seed, all parameters for key-gen are irrelevant - /*let seed : SeedAndLmsTreeIdentifier, - parameter: &HssParameter, - used_leafs_index: &u32, - aux_data: &mut Option,*/ - //let mut seed_and_lms_tree_identifier = hbs_lms::SeedAndLmsTreeIdentifier::default(); - //OsRng.fill_bytes(seed_and_lms_tree_identifier.seed.as_mut_slice()); - /*let mut private_key = hbs_lms::LmsPrivateKey::new( - seed_and_lms_tree_identifier.seed.clone(), - seed_and_lms_tree_identifier.lms_tree_identifier, - 0, - LmotsAlgorithm::construct_default_parameter(), - LmsAlgorithm::construct_default_parameter(), - );*/ - - // 2. - call get_tree_element(idx, LmsPrivateKey, None) - *signing_entity = node_value; - } + //let num_signing_entities = 2_u32.pow(genkey_parameter.ssts_param.get_top_height() as u32); + + let mut node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); + node_value = gen_sst_subtree(genkey_parameter.ssts_param.get_top_height(), genkey_parameter.ssts_param.get_entity_idx(), &hss_params[0], &seed); + // @TODO work: + // 1. - create key for "get_tree_element()"" with seed -- we need different seeds! + // call lms::generate_key_pair ? I think except the seed, all parameters for key-gen are irrelevant + /*let seed : SeedAndLmsTreeIdentifier, + parameter: &HssParameter, + used_leafs_index: &u32, + aux_data: &mut Option,*/ + //let mut seed_and_lms_tree_identifier = hbs_lms::SeedAndLmsTreeIdentifier::default(); + //OsRng.fill_bytes(seed_and_lms_tree_identifier.seed.as_mut_slice()); + /*let mut private_key = hbs_lms::LmsPrivateKey::new( + seed_and_lms_tree_identifier.seed.clone(), + seed_and_lms_tree_identifier.lms_tree_identifier, + 0, + LmotsAlgorithm::construct_default_parameter(), + LmsAlgorithm::construct_default_parameter(), + );*/ + + // 2. - call get_tree_element(idx, LmsPrivateKey, None) + let (signing_key, verifying_key) = keygen(hss_params, &seed, Some(aux_slice)) .unwrap_or_else(|_| panic!("Could not generate keys")); @@ -395,6 +390,7 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { let mut aux_data_size: Option = None; let mut top_part_height : u8 = 0; // @TODO later as option + let mut entity_idx : u8 = 0; // @TODO later as option let parameter = if parameter.contains(':') { let mut splitted = parameter.split(':'); @@ -413,6 +409,8 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { // "," is supposed to split several HSS levels; 10/2,10/2,10/2 for three levels with tree=10 and w=2 let parameters = parameter.split(','); + let mut entity_idx: u8 = 0; + let mut top_part_height: u8 = 0; for parameter in parameters { // for now we check and abort if several HSS params provided; leave the HSS-param-loop for use in future @@ -428,7 +426,10 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { let winternitz_parameter = splitted .next() .expect("Winternitz parameter invalid"); - let tmp_top_part_height = splitted + let s_top_part_height = splitted + .next() + .expect("Top part height invalid"); + let s_entity_idx = splitted .next() .expect("Top part height invalid"); @@ -438,11 +439,15 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { let winternitz_parameter: u8 = winternitz_parameter .parse() .expect("Winternitz parameter not correct specified"); - + // @TODO check: only optional, and only in first loop // @TODO check: invalid if "height - top_part_height < 1" - top_part_height = tmp_top_part_height + top_part_height = s_top_part_height .parse() .expect("Top part height invalid"); + // @TODO check: invalid if ... + entity_idx = s_entity_idx + .parse() + .expect("Signing entity index invalid"); let lm_ots = match winternitz_parameter { 1 => LmotsAlgorithm::LmotsW1, @@ -465,7 +470,7 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { vec_hss_params.push(hss_parameters); } - let ssts_param = SstsParameter::new(vec_hss_params, top_part_height); + let ssts_param = SstsParameter::new(vec_hss_params, top_part_height, entity_idx); GenKeyParameter::new(ssts_param, aux_data_size) } diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index 89b18fda..4af9d54a 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -13,7 +13,7 @@ use crate::{ }; // parameters -pub fn gen_sst_subtree(top_height: u8, hss_param: &HssParameter, seed: &Seed, entity_idx: u8 ) +pub fn gen_sst_subtree(top_height: u8, entity_idx: u8, hss_param: &HssParameter, seed: &Seed) //-> Result, Error> { -> ArrayVec<[u8; MAX_HASH_SIZE]> { // @TODO: nyi diff --git a/src/sst/parameters.rs b/src/sst/parameters.rs index 1c2f16f2..3e65caf6 100644 --- a/src/sst/parameters.rs +++ b/src/sst/parameters.rs @@ -10,18 +10,20 @@ use tinyvec::ArrayVec; pub struct SstsParameter { hss_parameters: ArrayVec<[HssParameter; 5]>, // @TODO replace 5 with some defined constant; currently min=max=1 top_height: u8, + entity_idx: u8, // starting with 1 } impl Copy for SstsParameter {} impl SstsParameter { - pub fn new(hss_params: ArrayVec<[HssParameter; 5]>, top_height: u8) -> Self { + pub fn new(hss_params: ArrayVec<[HssParameter; 5]>, top_height: u8, entity_idx: u8) -> Self { SstsParameter { hss_parameters: hss_params, top_height, // e.g. LMS height of 5 and top_height 3, we divide 3/3 (we consider one node as part of both tree parts) // would give us 2^3 = 8 signing entities + entity_idx, } } @@ -32,6 +34,10 @@ impl SstsParameter { pub fn get_top_height(&self) -> u8 { self.top_height } + + pub fn get_entity_idx(&self) -> u8 { + self.entity_idx + } } /* From 402d1b78a47b8579e6cc4737a125daa046ddb9a9 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Thu, 21 Dec 2023 16:13:37 +0100 Subject: [PATCH 16/43] sst: demo: use available constant; add argument - Use "REF_IMPL_MAX_ALLOWED_HSS_LEVELS" instead of magic number for max HSS size. - Add new call argument for demo (two-step key generation) --- examples/sst_demo.rs | 78 +++++++++++++++++++++++-------------------- src/lib.rs | 2 ++ src/sst/parameters.rs | 7 ++-- 3 files changed, 47 insertions(+), 40 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 548bf9c5..fbb4afc3 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -9,7 +9,8 @@ use std::{ }; use tinyvec::ArrayVec; -const GENKEY_COMMAND: &str = "genkey"; +const GENSUBTREE_COMMAND: &str = "gensubtree"; +const GENSSTS_COMMAND: &str = "genssts"; const VERIFY_COMMAND: &str = "verify"; const SIGN_COMMAND: &str = "sign"; @@ -92,12 +93,16 @@ fn main() -> Result<(), Box> { let command = Command::new("SSTS Demo") .about("Generates SSTS keys and uses them for signing and verifying.") .subcommand( - Command::new(GENKEY_COMMAND) + Command::new(GENSUBTREE_COMMAND) .arg(Arg::new(ARG_KEYNAME).required(true)) .arg(Arg::new(ARG_SSTS_PARAMETER).required(true).help( - "Specify LMS parameters (e.g. 5/4/2 (tree height 5, Winternitz parameter 4, top height 2))")) + "Specify LMS parameters (e.g. 5/4/2/1 (tree height = 5, Winternitz parameter = 4, top height = 2, signing entity = 1))")) .arg(Arg::new(ARG_SEED).long(ARG_SEED).required(true).takes_value(true).value_name("seed")), ) + .subcommand( + Command::new(GENSSTS_COMMAND) + .arg(Arg::new(ARG_KEYNAME).required(true)) + .arg(Arg::new(ARG_MESSAGE).required(true).help("Configuration file for SSTS generation"))) .subcommand( Command::new(VERIFY_COMMAND) .arg(Arg::new(ARG_KEYNAME).required(true)) @@ -117,16 +122,28 @@ fn main() -> Result<(), Box> { let matches = command.get_matches(); - if let Some(args) = matches.subcommand_matches(GENKEY_COMMAND) { - genkey(args)?; - println!("Keys successful generated!"); + if let Some(args) = matches.subcommand_matches(GENSUBTREE_COMMAND) { + gen_key_subtree(args)?; + println!("Subtree successfully generated!"); + return Ok(()); + } + + if let Some(args) = matches.subcommand_matches(GENSUBTREE_COMMAND) { + gen_key_ssts(args)?; + println!("Single-subtree-structure successfully generated!"); + return Ok(()); + } + + if let Some(args) = matches.subcommand_matches(SIGN_COMMAND) { + sign(args)?; + println!("Signature successfully generated!"); return Ok(()); } if let Some(args) = matches.subcommand_matches(VERIFY_COMMAND) { let result = verify(args); if result { - println!("Successful!"); + println!("Verification successful!"); exit(0); } else { println!("Wrong signature"); @@ -134,12 +151,6 @@ fn main() -> Result<(), Box> { } } - if let Some(args) = matches.subcommand_matches(SIGN_COMMAND) { - sign(args)?; - println!("Signature successful generated!"); - return Ok(()); - } - #[cfg(feature = "fast_verify")] if let Some(args) = matches.subcommand_matches(SIGN_MUT_COMMAND) { sign_mut(args)?; @@ -147,12 +158,10 @@ fn main() -> Result<(), Box> { return Ok(()); } - Ok(()) } - fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { let keyname = get_parameter(ARG_KEYNAME, args); let message_name = get_parameter(ARG_MESSAGE, args); @@ -317,7 +326,7 @@ fn read_file(file_name: &str) -> Vec { data } -fn genkey(args: &ArgMatches) -> Result<(), Box> { +fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> { let keyname: String = get_parameter(ARG_KEYNAME, args); let genkey_parameter = parse_genkey_parameter(&get_parameter(ARG_SSTS_PARAMETER, args)); @@ -349,26 +358,11 @@ fn genkey(args: &ArgMatches) -> Result<(), Box> { //let num_signing_entities = 2_u32.pow(genkey_parameter.ssts_param.get_top_height() as u32); let mut node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); - node_value = gen_sst_subtree(genkey_parameter.ssts_param.get_top_height(), genkey_parameter.ssts_param.get_entity_idx(), &hss_params[0], &seed); - // @TODO work: - // 1. - create key for "get_tree_element()"" with seed -- we need different seeds! - // call lms::generate_key_pair ? I think except the seed, all parameters for key-gen are irrelevant - /*let seed : SeedAndLmsTreeIdentifier, - parameter: &HssParameter, - used_leafs_index: &u32, - aux_data: &mut Option,*/ - //let mut seed_and_lms_tree_identifier = hbs_lms::SeedAndLmsTreeIdentifier::default(); - //OsRng.fill_bytes(seed_and_lms_tree_identifier.seed.as_mut_slice()); - /*let mut private_key = hbs_lms::LmsPrivateKey::new( - seed_and_lms_tree_identifier.seed.clone(), - seed_and_lms_tree_identifier.lms_tree_identifier, - 0, - LmotsAlgorithm::construct_default_parameter(), - LmsAlgorithm::construct_default_parameter(), - );*/ - - // 2. - call get_tree_element(idx, LmsPrivateKey, None) + node_value = gen_sst_subtree(genkey_parameter.ssts_param.get_top_height(), genkey_parameter.ssts_param.get_entity_idx(), &hss_params[0], &seed) + .unwrap_or_else(|_| panic!("Could not generate keys")); + + // we have to break here to get the params for the key generation second step (i.e. whole tree generation) let (signing_key, verifying_key) = keygen(hss_params, &seed, Some(aux_slice)) .unwrap_or_else(|_| panic!("Could not generate keys")); @@ -385,8 +379,12 @@ fn genkey(args: &ArgMatches) -> Result<(), Box> { Ok(()) } +fn gen_key_ssts(args: &ArgMatches) -> Result<(), Box> { + Ok(()) +} + fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { - let mut vec_hss_params: ArrayVec<[_; 5]> = Default::default(); + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); let mut aux_data_size: Option = None; let mut top_part_height : u8 = 0; // @TODO later as option @@ -444,7 +442,7 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { top_part_height = s_top_part_height .parse() .expect("Top part height invalid"); - // @TODO check: invalid if ... + // @TODO check: invalid if ...dep. on height and top_part_height entity_idx = s_entity_idx .parse() .expect("Signing entity index invalid"); @@ -470,8 +468,14 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { vec_hss_params.push(hss_parameters); } + // @TODO how do I know whether this "vec_hss_params" is a move, and if not, how to achieve (avoid implicit "Copy")? + // ArrayVec implements trait "Clone", but I'm not sure about "Copy" (implicit) let ssts_param = SstsParameter::new(vec_hss_params, top_part_height, entity_idx); + // this here shouldn't be possible in case of "move", because then we don't have ownership anymore: + //let vec_hss_param_test: HssParameter = HssParameter::new(LmotsAlgorithm::LmotsW1, LmsAlgorithm::LmsH5); + //vec_hss_params.push(vec_hss_param_test); + // same here: move or copy? GenKeyParameter::new(ssts_param, aux_data_size) } diff --git a/src/lib.rs b/src/lib.rs index d7a1ced0..12a19247 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -127,6 +127,8 @@ use signature::Error; use tinyvec::ArrayVec; use constants::MAX_HSS_SIGNATURE_LENGTH; +// @TODO review: okay in API? +pub use crate::constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS; /** * Implementation of [`signature::Signature`]. diff --git a/src/sst/parameters.rs b/src/sst/parameters.rs index 3e65caf6..8810d770 100644 --- a/src/sst/parameters.rs +++ b/src/sst/parameters.rs @@ -1,6 +1,7 @@ use crate::{ hasher::HashChain, hss::parameter::HssParameter, + constants, }; use tinyvec::ArrayVec; @@ -8,7 +9,7 @@ use tinyvec::ArrayVec; #[derive(Clone, PartialEq, Eq)] pub struct SstsParameter { - hss_parameters: ArrayVec<[HssParameter; 5]>, // @TODO replace 5 with some defined constant; currently min=max=1 + hss_parameters: ArrayVec<[HssParameter; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]>, top_height: u8, entity_idx: u8, // starting with 1 } @@ -17,7 +18,7 @@ pub struct SstsParameter { impl Copy for SstsParameter {} impl SstsParameter { - pub fn new(hss_params: ArrayVec<[HssParameter; 5]>, top_height: u8, entity_idx: u8) -> Self { + pub fn new(hss_params: ArrayVec<[HssParameter; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]>, top_height: u8, entity_idx: u8) -> Self { SstsParameter { hss_parameters: hss_params, @@ -27,7 +28,7 @@ impl SstsParameter { } } - pub fn get_hss_parameters(&self) -> &ArrayVec<[HssParameter; 5]> { + pub fn get_hss_parameters(&self) -> &ArrayVec<[HssParameter; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> { &self.hss_parameters } From 8f61a6df72357d95a2eaac0d6b197a12dd6c6f40 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Thu, 21 Dec 2023 18:30:05 +0100 Subject: [PATCH 17/43] sst: LMS: Extend LmsPrivateKey Adapt LmsPrivateKey so the restricted number of leaves and instance number can be considered. --- src/hss/definitions.rs | 3 ++- src/lms/definitions.rs | 14 ++++++++++++++ src/lms/mod.rs | 1 + src/lms/signing.rs | 1 + src/lms/verify.rs | 1 + 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index cdcae158..4ba2c51c 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -10,7 +10,7 @@ use crate::{ }, lms::{ self, - definitions::{InMemoryLmsPublicKey, LmsPrivateKey, LmsPublicKey}, + definitions::{InMemoryLmsPublicKey, LmsPrivateKey, LmsPublicKey, SstExtension}, generate_key_pair, parameters::LmsParameter, }, @@ -54,6 +54,7 @@ impl HssPrivateKey { lmots_parameter: *parameters[0].get_lmots_parameter(), lms_parameter: *parameters[0].get_lms_parameter(), used_leafs_index: used_leafs_indexes[0], + sst_ext: None }; hss_private_key.private_key.push(lms_private_key); diff --git a/src/lms/definitions.rs b/src/lms/definitions.rs index 1db5f144..ffaf75a8 100644 --- a/src/lms/definitions.rs +++ b/src/lms/definitions.rs @@ -14,6 +14,15 @@ use zeroize::{Zeroize, ZeroizeOnDrop}; use super::parameters::LmsParameter; +#[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] +pub struct SstExtension { + // for using only a part of the whole LMS's leaves, we need + // - our subtree height -> number of leaves! (total height + ) + // - our instance number to calc. starting leaf -> put into "used_leafs_index" !! + pub signing_instance: u8, // @TODO review: assuming we won't have > 128 + pub top_tree_height: u8, // TODO if used often to calc. num of leaves or similar, then use calculated value +} + #[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] pub struct LmsPrivateKey { pub lms_tree_identifier: LmsTreeIdentifier, @@ -23,6 +32,7 @@ pub struct LmsPrivateKey { pub lmots_parameter: LmotsParameter, #[zeroize(skip)] pub lms_parameter: LmsParameter, + pub sst_ext: Option, } impl LmsPrivateKey { @@ -32,13 +42,16 @@ impl LmsPrivateKey { used_leafs_index: u32, lmots_parameter: LmotsParameter, lms_parameter: LmsParameter, + sst_ext: Option ) -> Self { + //let tmp_sst_ext = sst_ext.unwrap_or_else(|| SstExtension { signing_instance: 0, top_tree_height: 0 }); LmsPrivateKey { seed, lms_tree_identifier, used_leafs_index, lmots_parameter, lms_parameter, + sst_ext } } @@ -172,6 +185,7 @@ mod tests { 0, LmotsAlgorithm::construct_default_parameter(), LmsAlgorithm::construct_default_parameter(), + None ); let public_key = LmsPublicKey::new(&private_key, &mut None); diff --git a/src/lms/mod.rs b/src/lms/mod.rs index 5434d186..010f025e 100644 --- a/src/lms/mod.rs +++ b/src/lms/mod.rs @@ -31,6 +31,7 @@ pub fn generate_key_pair( *used_leafs_index, *lmots_parameter, *lms_parameter, + None, ); let public_key = LmsPublicKey::new(&private_key, aux_data); diff --git a/src/lms/signing.rs b/src/lms/signing.rs index 96fa0dfd..e79508e3 100644 --- a/src/lms/signing.rs +++ b/src/lms/signing.rs @@ -233,6 +233,7 @@ mod tests { 0, LmotsAlgorithm::construct_default_parameter(), LmsAlgorithm::construct_default_parameter(), + None, ); let message = "Hi, what up?".as_bytes(); diff --git a/src/lms/verify.rs b/src/lms/verify.rs index 9dfbcf9e..58eb5b63 100644 --- a/src/lms/verify.rs +++ b/src/lms/verify.rs @@ -108,6 +108,7 @@ mod tests { 0, LmotsAlgorithm::construct_default_parameter(), LmsAlgorithm::construct_default_parameter(), + None ); let public_key = LmsPublicKey::new(&private_key, &mut None).to_binary_representation(); From 3ef5b36e2c0be3d3bd088a375f8275c9b7de5bde Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Fri, 22 Dec 2023 14:23:43 +0100 Subject: [PATCH 18/43] sst: LMS: Initialze LmsPrivateKey with SST bounds Dep. on signing entity, tree height and division, calc. and set first and last LMS leaf to limited values. --- src/lms/definitions.rs | 29 ++++++--- src/sst/gen_key.rs | 6 +- src/sst/helper.rs | 139 +++++++++++++++++++++++++++++++---------- src/sst/mod.rs | 5 +- 4 files changed, 132 insertions(+), 47 deletions(-) diff --git a/src/lms/definitions.rs b/src/lms/definitions.rs index ffaf75a8..46c1e097 100644 --- a/src/lms/definitions.rs +++ b/src/lms/definitions.rs @@ -7,6 +7,8 @@ use crate::lms::parameters::LmsAlgorithm; use crate::lms::MutableExpandedAuxData; use crate::util::helper::read_and_advance; use crate::{lm_ots, Seed}; +use crate::sst::helper::get_sst_first_leaf_idx; +use crate::sst::helper::get_sst_last_leaf_idx; use core::convert::TryInto; use tinyvec::ArrayVec; @@ -16,11 +18,8 @@ use super::parameters::LmsParameter; #[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] pub struct SstExtension { - // for using only a part of the whole LMS's leaves, we need - // - our subtree height -> number of leaves! (total height + ) - // - our instance number to calc. starting leaf -> put into "used_leafs_index" !! pub signing_instance: u8, // @TODO review: assuming we won't have > 128 - pub top_tree_height: u8, // TODO if used often to calc. num of leaves or similar, then use calculated value + pub top_tree_height: u8, } #[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] @@ -44,11 +43,16 @@ impl LmsPrivateKey { lms_parameter: LmsParameter, sst_ext: Option ) -> Self { - //let tmp_sst_ext = sst_ext.unwrap_or_else(|| SstExtension { signing_instance: 0, top_tree_height: 0 }); + let mut my_used_leafs_index = used_leafs_index; + if let Some(my_sst_ext) = &sst_ext { + assert_eq!(used_leafs_index, 0); // make sure we are getting initialized + my_used_leafs_index = get_sst_first_leaf_idx(my_sst_ext.signing_instance, lms_parameter.get_tree_height(), my_sst_ext.top_tree_height) + } + LmsPrivateKey { seed, lms_tree_identifier, - used_leafs_index, + used_leafs_index: my_used_leafs_index, lmots_parameter, lms_parameter, sst_ext @@ -56,9 +60,16 @@ impl LmsPrivateKey { } pub fn use_lmots_private_key(&mut self) -> Result, ()> { - let number_of_lm_ots_keys = self.lms_parameter.number_of_lm_ots_keys(); - - if self.used_leafs_index as usize >= number_of_lm_ots_keys { + let number_of_lm_ots_keys = { + if let Some(my_sst_ext) = &self.sst_ext { + get_sst_last_leaf_idx(my_sst_ext.signing_instance, self.lms_parameter.get_tree_height(), my_sst_ext.top_tree_height) + } + else { + self.lms_parameter.number_of_lm_ots_keys() as u32 + } + }; + + if self.used_leafs_index >= number_of_lm_ots_keys { return Err(()); } diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index 4af9d54a..cd8e8766 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -14,8 +14,7 @@ use crate::{ // parameters pub fn gen_sst_subtree(top_height: u8, entity_idx: u8, hss_param: &HssParameter, seed: &Seed) - //-> Result, Error> { - -> ArrayVec<[u8; MAX_HASH_SIZE]> { + -> Result, Error> { // @TODO: nyi // 1. we need an HSS SigningKey/VerifyingKey ; pretend to have a full LMS here to fulfill // param. requirements for existing functions. @@ -50,8 +49,7 @@ pub fn gen_sst_subtree(top_height: u8, entity_idx: u8, hss_param: //); // 2. - call get_tree_element(idx, LmsPrivateKey, None) - //Ok(node_value) - node_value + Ok(node_value) } /// Parameters: diff --git a/src/sst/helper.rs b/src/sst/helper.rs index 9c35f9b0..7fc2d9a5 100644 --- a/src/sst/helper.rs +++ b/src/sst/helper.rs @@ -1,25 +1,38 @@ // a function that provides our sub-tree top node idx within the SSTS -// we provide parameters index, total height and dividing (top/bottom) -// subtree_num counts from left-most = 1 to "number_of_leaves" dep. on top division -fn get_subtree_node_idx(subtree_num: usize, tot_height: usize, top_div: usize) -> usize { - assert!(subtree_num > 0); - assert!(subtree_num <= get_num_leaves(top_div)); // number of nodes at that level - assert!(top_div <= tot_height); - - 2usize.pow(top_div as u32) - 1 + subtree_num +// subtree_num counts from left-most = 1 to top part's "number_of_leaves" +fn _get_subtree_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { + assert!(signing_entity_idx > 0); + assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level + assert!(top_div <= total_height); + 2u32.pow(top_div as u32) - 1 + (signing_entity_idx as u32) } -// how many subtrees, dep on total height and division -// -> call number_leaves(top_height) +fn get_num_leaves_in_sst(total_height: u8, top_div: u8) -> u32 { + 2u32.pow((total_height - top_div) as u32) +} -// number of leaves of a regular Merkle tree -fn get_num_leaves(height: usize) -> usize { - 2usize.pow(height as u32) +// For a subtree, depending on whole SSTS and division, get first leaf idx on whole SSTS +pub fn get_sst_first_leaf_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { + assert!(signing_entity_idx > 0); + assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level + 2u32.pow(total_height as u32) + (((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div)) as u32 } -// last_leaf_node_idx -// (2 ^ (height+1)) - 1 +// For a subtree, depending on whole SSTS and division, get first leaf idx on whole SSTS +pub fn get_sst_last_leaf_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { + assert!(signing_entity_idx > 0); + assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level + get_sst_first_leaf_idx(signing_entity_idx, total_height, top_div) - 1 + get_num_leaves_in_sst(total_height, top_div) +} +// number of leaves of a Merkle tree +fn _get_num_leaves(height: u8) -> u32 { + 2u32.pow(height as u32) +} + +fn _get_last_leaf_node_idx(height: u8) -> u32 { + 2u32.pow(height as u32 + 1) - 1 +} #[cfg(test)] @@ -28,54 +41,114 @@ mod tests { use super::*; #[test] - fn sst_get_subtree_node_in_ssts_1() { - let subtree_node_idx = get_subtree_node_idx(1, 4, 2); + fn test_get_subtree_node_in_ssts_1() { + let subtree_node_idx = _get_subtree_node_idx(1, 4, 2); assert_eq!(4, subtree_node_idx); } #[test] - fn sst_get_subtree_node_in_ssts_2() { - let subtree_node_idx = get_subtree_node_idx(2, 4, 2); + fn test_get_subtree_node_in_ssts_2() { + let subtree_node_idx = _get_subtree_node_idx(2, 4, 2); assert_eq!(5, subtree_node_idx); } #[test] - fn sst_get_subtree_node_in_ssts_3() { - let subtree_node_idx = get_subtree_node_idx(1, 4, 3); + fn test_get_subtree_node_in_ssts_3() { + let subtree_node_idx = _get_subtree_node_idx(1, 4, 3); assert_eq!(8, subtree_node_idx); } #[test] - fn sst_get_subtree_node_in_ssts_4() { - let subtree_node_idx = get_subtree_node_idx(2, 4, 3); + fn test_get_subtree_node_in_ssts_4() { + let subtree_node_idx = _get_subtree_node_idx(2, 4, 3); assert_eq!(9, subtree_node_idx); } #[test] - fn sst_get_subtree_node_in_ssts_5() { - let subtree_node_idx = get_subtree_node_idx(1, 4, 4); + fn test_get_subtree_node_in_ssts_5() { + let subtree_node_idx = _get_subtree_node_idx(1, 4, 4); assert_eq!(16, subtree_node_idx); } #[test] - fn sst_get_subtree_node_in_ssts_6() { - let subtree_node_idx = get_subtree_node_idx(9, 4, 4); + fn test_get_subtree_node_in_ssts_6() { + let subtree_node_idx = _get_subtree_node_idx(9, 4, 4); assert_eq!(24, subtree_node_idx); } // one outermost "leaf" #[test] - fn sst_get_subtree_node_in_ssts_7() { - let subtree_node_idx = get_subtree_node_idx(16, 4, 4); + fn test_get_subtree_node_in_ssts_7() { + let subtree_node_idx = _get_subtree_node_idx(16, 4, 4); assert_eq!(31, subtree_node_idx); } // wrong config, subtree_node_idx too high #[test] #[should_panic] - fn sst_get_subtree_node_in_ssts_8() { - let _subtree_node_idx = get_subtree_node_idx(17, 4, 4); - //assert_eq!(31, subtree_node_idx); + fn test_get_subtree_node_in_ssts_8() { + let _subtree_node_idx = _get_subtree_node_idx(17, 4, 4); + } + + #[test] + fn test_get_last_leaf_node_idx() { + let last_idx = _get_last_leaf_node_idx(5); + assert_eq!(63, last_idx); + } + + + /* + fn get_sst_first_leaf_idx(signing_entity_idx: usize, total_height: usize, top_div: usize) -> usize { + 2usize.pow(total_height as u32) - 1 + ((signing_entity_idx - 1) * 2usize.pow((total_height - top_div) as u32)) + } + + // For a subtree, depending on whole SSTS and division, get first leaf idx on whole SSTS + fn get_sst_last_leaf_idx(signing_entity_idx: usize, total_height: usize, top_div: usize) -> usize { + get_sst_first_leaf_idx(signing_entity_idx, total_height, top_div) - 1 + 2usize.pow((total_height - top_div) as u32) + } + */ + + #[test] + fn test_get_sst_first_leaf_idx_1() { + let first_leaf_idx = get_sst_first_leaf_idx(1, 5, 3); + assert_eq!(32, first_leaf_idx); + } + + #[test] + fn test_get_sst_first_leaf_idx_2() { + let first_leaf_idx = get_sst_first_leaf_idx(3, 5, 3); + assert_eq!(40, first_leaf_idx); + } + + #[test] + fn test_get_sst_first_leaf_idx_3() { + let first_leaf_idx = get_sst_first_leaf_idx(8, 5, 3); + assert_eq!(60, first_leaf_idx); + } + + #[test] + fn test_get_sst_last_leaf_idx_1() { + let last_leaf_idx = get_sst_last_leaf_idx(1, 5, 3); + assert_eq!(35, last_leaf_idx); + } + + #[test] + fn test_get_sst_last_leaf_idx_2() { + let last_leaf_idx = get_sst_last_leaf_idx(3, 5, 3); + assert_eq!(43, last_leaf_idx); + } + + #[test] + fn test_get_sst_last_leaf_idx_3() { + let last_leaf_idx = get_sst_last_leaf_idx(8, 5, 3); + assert_eq!(63, last_leaf_idx); + } + + #[test] + #[should_panic] + fn test_get_sst_last_leaf_idx_4() { + let last_leaf_idx = get_sst_last_leaf_idx(9, 5, 3); + assert_eq!(63, last_leaf_idx); } -} \ No newline at end of file +} diff --git a/src/sst/mod.rs b/src/sst/mod.rs index 34a934fe..b87b82d5 100644 --- a/src/sst/mod.rs +++ b/src/sst/mod.rs @@ -9,5 +9,8 @@ pub use sign::*; mod verify; pub use verify::*; -mod helper; +// @TODO how to allow "helper" for "lms", but not in API? +pub mod helper; +pub use helper::*; + pub mod parameters; From 40fc3b7c59afc616b9472949bd684a3596700e92 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Fri, 22 Dec 2023 17:23:13 +0100 Subject: [PATCH 19/43] sst: demo: read arguments for HSS and SST First set of arguments can optionally have top_height and entity_number. If one is provided, the other is mandatory. If not provided, behaviour is as previously (HSS). --- examples/sst_demo.rs | 47 +++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index fbb4afc3..f3bd49b7 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -357,8 +357,8 @@ fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> //let num_signing_entities = 2_u32.pow(genkey_parameter.ssts_param.get_top_height() as u32); - let mut node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); - node_value = gen_sst_subtree(genkey_parameter.ssts_param.get_top_height(), genkey_parameter.ssts_param.get_entity_idx(), &hss_params[0], &seed) + let mut _node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); + _node_value = gen_sst_subtree(genkey_parameter.ssts_param.get_top_height(), genkey_parameter.ssts_param.get_entity_idx(), &hss_params[0], &seed) .unwrap_or_else(|_| panic!("Could not generate keys")); @@ -379,7 +379,7 @@ fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> Ok(()) } -fn gen_key_ssts(args: &ArgMatches) -> Result<(), Box> { +fn gen_key_ssts(_args: &ArgMatches) -> Result<(), Box> { Ok(()) } @@ -387,8 +387,6 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); let mut aux_data_size: Option = None; - let mut top_part_height : u8 = 0; // @TODO later as option - let mut entity_idx : u8 = 0; // @TODO later as option let parameter = if parameter.contains(':') { let mut splitted = parameter.split(':'); @@ -405,16 +403,12 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { parameter }; - // "," is supposed to split several HSS levels; 10/2,10/2,10/2 for three levels with tree=10 and w=2 let parameters = parameter.split(','); let mut entity_idx: u8 = 0; let mut top_part_height: u8 = 0; + let mut is_first_loop = true; for parameter in parameters { - // for now we check and abort if several HSS params provided; leave the HSS-param-loop for use in future - if vec_hss_params.len() >= 1 { - break; - } let mut splitted = parameter.split('/'); @@ -424,12 +418,6 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { let winternitz_parameter = splitted .next() .expect("Winternitz parameter invalid"); - let s_top_part_height = splitted - .next() - .expect("Top part height invalid"); - let s_entity_idx = splitted - .next() - .expect("Top part height invalid"); let height: u8 = height .parse() @@ -437,15 +425,24 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { let winternitz_parameter: u8 = winternitz_parameter .parse() .expect("Winternitz parameter not correct specified"); - // @TODO check: only optional, and only in first loop - // @TODO check: invalid if "height - top_part_height < 1" - top_part_height = s_top_part_height - .parse() - .expect("Top part height invalid"); - // @TODO check: invalid if ...dep. on height and top_part_height - entity_idx = s_entity_idx - .parse() - .expect("Signing entity index invalid"); + + if true == is_first_loop { + is_first_loop = false; + if let Some(s_top_part_height) = splitted.next() { + // if we have a top_part_height, we also need an entity idx + let s_entity_idx = splitted + .next() + .expect("Top part height provided, but signing entity number missing."); + // @TODO check: invalid if "height - top_part_height < 1" + top_part_height = s_top_part_height + .parse() + .expect("Top part height invalid"); + // @TODO check: invalid if ...dep. on height and top_part_height + entity_idx = s_entity_idx + .parse() + .expect("Signing entity index invalid"); + } + } let lm_ots = match winternitz_parameter { 1 => LmotsAlgorithm::LmotsW1, From 2ab2b57b4a1d8c439183ca7ff8082a424b9d15d4 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Thu, 4 Jan 2024 18:04:51 +0100 Subject: [PATCH 20/43] sst: extend priv. key data types & tests for SSTS - extension not written to file yet - keys are used as before - tests are still working --- benches/mod.rs | 62 +++++++++++++++---------- examples/lms-demo.rs | 14 +++--- examples/sst_demo.rs | 15 +++--- src/hss/aux.rs | 11 ++++- src/hss/definitions.rs | 44 ++++++++++-------- src/hss/mod.rs | 67 +++++++++++++++++---------- src/hss/reference_impl_private_key.rs | 62 +++++++++++++++++++------ src/hss/signing.rs | 24 ++++++---- src/hss/verify.rs | 17 +++++-- src/lib.rs | 35 ++++++++------ src/lms/definitions.rs | 8 ++-- src/sst/gen_key.rs | 50 ++++++++++++++------ src/sst/parameters.rs | 10 +++- tests/reference_implementation.rs | 21 ++++++--- 14 files changed, 285 insertions(+), 155 deletions(-) diff --git a/benches/mod.rs b/benches/mod.rs index 7ede62d2..ac82a07f 100644 --- a/benches/mod.rs +++ b/benches/mod.rs @@ -5,12 +5,14 @@ extern crate test; mod tests { use rand::{rngs::OsRng, RngCore}; use test::Bencher; + use tinyvec::ArrayVec; use hbs_lms::{keygen, HssParameter, LmotsAlgorithm, LmsAlgorithm, Seed, Sha256_256}; use hbs_lms::{ signature::{SignerMut, Verifier}, Signature, SigningKey, VerifierSignature, VerifyingKey, }; + use hbs_lms::sst::parameters::SstsParameter; const MESSAGE: [u8; 17] = [ 32u8, 48, 2, 1, 48, 58, 20, 57, 9, 83, 99, 255, 0, 34, 2, 1, 0, @@ -23,7 +25,14 @@ mod tests { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); - let (signing_key, _) = keygen::(hss_parameter, &seed, aux_data).unwrap(); + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + for i in 0..hss_parameter.len() { + vec_hss_params.push(hss_parameter[i]); + } + + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); + + let (signing_key, _) = keygen::(&sst_param, &seed, aux_data).unwrap(); signing_key } @@ -31,11 +40,13 @@ mod tests { fn generate_verifying_key_and_signature() -> (VerifyingKey, Signature) { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); + + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); + let (mut signing_key, verifying_key) = keygen::( - &[HssParameter::new( - LmotsAlgorithm::LmotsW2, - LmsAlgorithm::LmsH5, - )], + &sst_param, &seed, None, ) @@ -50,13 +61,12 @@ mod tests { fn keygen_h5w2(b: &mut Bencher) { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); - let hss_parameter = [HssParameter::new( - LmotsAlgorithm::LmotsW2, - LmsAlgorithm::LmsH5, - )]; + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); b.iter(|| { - let _ = keygen::(&hss_parameter, &seed, None); + let _ = keygen::(&sst_param, &seed, None); }); } @@ -64,16 +74,16 @@ mod tests { fn keygen_with_aux_h5w2(b: &mut Bencher) { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); - let hss_parameter = [HssParameter::new( - LmotsAlgorithm::LmotsW2, - LmsAlgorithm::LmsH5, - )]; + + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); b.iter(|| { let mut aux_data = vec![0u8; 100_000]; let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; - let _ = keygen::(&hss_parameter, &seed, Some(aux_slice)); + let _ = keygen::(&sst_param, &seed, Some(aux_slice)); }); } @@ -81,13 +91,14 @@ mod tests { fn keygen_h5w2_h5w2(b: &mut Bencher) { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); - let hss_parameter = [ - HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5), - HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5), - ]; + + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); b.iter(|| { - let _ = keygen::(&hss_parameter, &seed, None); + let _ = keygen::(&sst_param, &seed, None); }); } @@ -95,16 +106,17 @@ mod tests { fn keygen_with_aux_h5w2_h5w2(b: &mut Bencher) { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); - let hss_parameter = [ - HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5), - HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5), - ]; + + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); b.iter(|| { let mut aux_data = vec![0u8; 100_000]; let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; - let _ = keygen::(&hss_parameter, &seed, Some(aux_slice)); + let _ = keygen::(&sst_param, &seed, Some(aux_slice)); }); } diff --git a/examples/lms-demo.rs b/examples/lms-demo.rs index 2ce61599..50de2987 100644 --- a/examples/lms-demo.rs +++ b/examples/lms-demo.rs @@ -7,6 +7,7 @@ use std::{ io::{Read, Write}, process::exit, }; +use tinyvec::ArrayVec; const GENKEY_COMMAND: &str = "genkey"; const VERIFY_COMMAND: &str = "verify"; @@ -42,15 +43,15 @@ impl DemoError { type Hasher = Sha256_256; struct GenKeyParameter { - parameter: Vec>, + ssts_param: SstsParameter, aux_data: usize, } impl GenKeyParameter { - pub fn new(parameter: Vec>, aux_data: Option) -> Self { + pub fn new(ssts_param: SstsParameter, aux_data: Option) -> Self { let aux_data = aux_data.unwrap_or(AUX_DATA_DEFAULT_SIZE); Self { - parameter, + ssts_param, aux_data, } } @@ -287,7 +288,7 @@ fn genkey(args: &ArgMatches) -> Result<(), Box> { let keyname: String = get_parameter(KEYNAME_PARAMETER, args); let genkey_parameter = parse_genkey_parameter(&get_parameter(PARAMETER_PARAMETER, args)); - let parameter = genkey_parameter.parameter; + let parameter = genkey_parameter.ssts_param; let seed: Seed = if let Some(seed) = args.value_of(SEED_PARAMETER) { let decoded = hex::decode(seed)?; @@ -325,7 +326,7 @@ fn genkey(args: &ArgMatches) -> Result<(), Box> { } fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { - let mut result = Vec::new(); + let mut result: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); let mut aux_data_size: Option = None; @@ -384,7 +385,8 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { result.push(parameter); } - GenKeyParameter::new(result, aux_data_size) + let ssts_param = SstsParameter::new(result, 0, 0); + GenKeyParameter::new(ssts_param, aux_data_size) } fn write(filename: &str, content: &[u8]) -> Result<(), std::io::Error> { diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index f3bd49b7..a364fa25 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -352,20 +352,17 @@ fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> let mut aux_data = vec![0u8; genkey_parameter.aux_data]; let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; - // to fix for time being, provide HssParameter param as vector - let hss_params= ssts_param.get_hss_parameters(); - - //let num_signing_entities = 2_u32.pow(genkey_parameter.ssts_param.get_top_height() as u32); - - let mut _node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); - _node_value = gen_sst_subtree(genkey_parameter.ssts_param.get_top_height(), genkey_parameter.ssts_param.get_entity_idx(), &hss_params[0], &seed) + // TODO get the subtree node value + let (signing_key, verifying_key) = gen_sst_subtree(&ssts_param, &seed, Some(aux_slice)) .unwrap_or_else(|_| panic!("Could not generate keys")); - // we have to break here to get the params for the key generation second step (i.e. whole tree generation) - let (signing_key, verifying_key) = keygen(hss_params, &seed, Some(aux_slice)) + /* + let mut _node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); + _node_value = gen_sst_subtree(genkey_parameter.ssts_param.get_top_height(), genkey_parameter.ssts_param.get_entity_idx(), &hss_params[0], &seed) .unwrap_or_else(|_| panic!("Could not generate keys")); + */ let public_key_filename = get_public_key_name(&keyname); let private_key_filename = get_private_key_name(&keyname); diff --git a/src/hss/aux.rs b/src/hss/aux.rs index 81e83a42..beef1cd5 100644 --- a/src/hss/aux.rs +++ b/src/hss/aux.rs @@ -264,11 +264,14 @@ fn compute_hmac(key: &[u8], data: &[u8]) -> ArrayVec<[u8; MAX_HASH mod tests { use crate::hasher::sha256::Sha256_256; use crate::util::helper::test_helper::gen_random_seed; + use crate::constants; + use crate::SstsParameter; use crate::{ constants::MAX_HASH_SIZE, hss::{aux::hss_expand_aux_data, hss_keygen}, HssParameter, LmotsAlgorithm, LmsAlgorithm, }; + use tinyvec::ArrayVec; #[test] #[should_panic(expected = "expand_aux_data should return None!")] @@ -278,13 +281,17 @@ mod tests { let lmots = LmotsAlgorithm::LmotsW2; let lms = LmsAlgorithm::LmsH5; - let parameters = [HssParameter::new(lmots, lms), HssParameter::new(lmots, lms)]; + + let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(lmots, lms)); + vec_hss_params.push(HssParameter::new(lmots, lms)); + let sst_param = SstsParameter::new(vec_hss_params, 0, 0); let mut aux_data = [0u8; 1_000]; let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; let _ = - hss_keygen::(¶meters, &seed, Some(aux_slice)).expect("Should generate HSS keys"); + hss_keygen::(&sst_param, &seed, Some(aux_slice)).expect("Should generate HSS keys"); aux_slice[2 * MAX_HASH_SIZE - 1] ^= 1; diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index 4ba2c51c..6565553e 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -10,7 +10,7 @@ use crate::{ }, lms::{ self, - definitions::{InMemoryLmsPublicKey, LmsPrivateKey, LmsPublicKey, SstExtension}, + definitions::{InMemoryLmsPublicKey, LmsPrivateKey, LmsPublicKey}, generate_key_pair, parameters::LmsParameter, }, @@ -227,17 +227,20 @@ impl<'a, H: HashChain> InMemoryHssPublicKey<'a, H> { mod tests { use rand::{rngs::OsRng, RngCore}; + use crate::SstsParameter; use crate::util::helper::test_helper::gen_random_seed; use crate::{ hasher::sha256::Sha256_256, hss::{ definitions::InMemoryHssPublicKey, reference_impl_private_key::{ReferenceImplPrivateKey, SeedAndLmsTreeIdentifier}, - HashChain, HssParameter, + HashChain }, - lms, LmotsAlgorithm, LmsAlgorithm, + lms, LmotsAlgorithm, LmsAlgorithm, HssParameter, }; + use tinyvec::ArrayVec; + use crate::constants; use super::{HssPrivateKey, HssPublicKey}; #[test] @@ -307,14 +310,14 @@ mod tests { ) -> (HssPrivateKey, HssPrivateKey) { let lmots = LmotsAlgorithm::LmotsW4; let lms = LmsAlgorithm::LmsH2; - let parameters = [ - HssParameter::::new(lmots, lms), - HssParameter::::new(lmots, lms), - HssParameter::::new(lmots, lms), - ]; + let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::::new(lmots, lms)); + vec_hss_params.push(HssParameter::::new(lmots, lms)); + vec_hss_params.push(HssParameter::::new(lmots, lms)); + let sst_param = SstsParameter::new(vec_hss_params, 0, 0); let seed = gen_random_seed::(); - let mut rfc_key = ReferenceImplPrivateKey::generate(¶meters, &seed).unwrap(); + let mut rfc_key = ReferenceImplPrivateKey::generate(&sst_param, &seed).unwrap(); let hss_key_before = HssPrivateKey::from(&rfc_key, &mut None).unwrap(); @@ -333,14 +336,15 @@ mod tests { let lmots = LmotsAlgorithm::LmotsW4; let lms = LmsAlgorithm::LmsH2; - let parameters = [ - HssParameter::::new(lmots, lms), - HssParameter::::new(lmots, lms), - HssParameter::::new(lmots, lms), - ]; + + let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::::new(lmots, lms)); + vec_hss_params.push(HssParameter::::new(lmots, lms)); + vec_hss_params.push(HssParameter::::new(lmots, lms)); + let sst_param = SstsParameter::new(vec_hss_params, 0, 0); let seed = gen_random_seed::(); - let mut private_key = ReferenceImplPrivateKey::generate(¶meters, &seed).unwrap(); + let mut private_key = ReferenceImplPrivateKey::generate(&sst_param, &seed).unwrap(); let hss_key = HssPrivateKey::from(&private_key, &mut None).unwrap(); let tree_heights = hss_key @@ -369,13 +373,13 @@ mod tests { let lmots = LmotsAlgorithm::LmotsW4; let lms = LmsAlgorithm::LmsH2; - let parameters = [ - HssParameter::::new(lmots, lms), - HssParameter::::new(lmots, lms), - ]; + let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::::new(lmots, lms)); + vec_hss_params.push(HssParameter::::new(lmots, lms)); + let sst_param = SstsParameter::new(vec_hss_params, 0, 0); let seed = gen_random_seed::(); - let private_key = ReferenceImplPrivateKey::generate(¶meters, &seed).unwrap(); + let private_key = ReferenceImplPrivateKey::generate(&sst_param, &seed).unwrap(); let hss_key = HssPrivateKey::from(&private_key, &mut None).unwrap(); let hss_key_second = HssPrivateKey::from(&private_key, &mut None).unwrap(); diff --git a/src/hss/mod.rs b/src/hss/mod.rs index f542b9ef..91f51b9e 100644 --- a/src/hss/mod.rs +++ b/src/hss/mod.rs @@ -6,9 +6,12 @@ mod seed_derive; pub mod signing; pub mod verify; + use core::{convert::TryFrom, marker::PhantomData}; use tinyvec::ArrayVec; +use super::parameters::SstsParameter; + use crate::{ constants::{MAX_HSS_PUBLIC_KEY_LENGTH, REF_IMPL_MAX_PRIVATE_KEY_SIZE}, hss::{aux::hss_is_aux_data_used, reference_impl_private_key::Seed}, @@ -18,7 +21,6 @@ use crate::{ use self::{ definitions::{HssPrivateKey, HssPublicKey, InMemoryHssPublicKey}, - parameter::HssParameter, reference_impl_private_key::ReferenceImplPrivateKey, signing::{HssSignature, InMemoryHssSignature}, }; @@ -259,23 +261,22 @@ fn hss_sign_core( * ``` * use rand::{rngs::OsRng, RngCore}; * use tinyvec::ArrayVec; - * use hbs_lms::{keygen, HssParameter, LmotsAlgorithm, LmsAlgorithm, Sha256_256, HashChain, Seed}; - * - * let parameters = [ - * HssParameter::new(LmotsAlgorithm::LmotsW4, LmsAlgorithm::LmsH5), - * HssParameter::new(LmotsAlgorithm::LmotsW1, LmsAlgorithm::LmsH5), - * ]; + * use hbs_lms::{keygen, HssParameter, SstsParameter, LmotsAlgorithm, LmsAlgorithm, Sha256_256, HashChain, Seed}; + * let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + * vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW4, LmsAlgorithm::LmsH5)); + * vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW1, LmsAlgorithm::LmsH5)); + * let sst_param = SstsParameter::new(vec_hss_params, 0, 0); * let mut aux_data = vec![0u8; 10_000]; * let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; * let mut seed = Seed::default(); * OsRng.fill_bytes(seed.as_mut_slice()); * * let (signing_key, verifying_key) = - * keygen::(¶meters, &seed, Some(aux_slice)).unwrap(); + * keygen::(&sst_param, &seed, Some(aux_slice)).unwrap(); * ``` */ pub fn hss_keygen( - parameters: &[HssParameter], + parameters: &SstsParameter, seed: &Seed, aux_data: Option<&mut &mut [u8]>, ) -> Result<(SigningKey, VerifyingKey), Error> { @@ -293,7 +294,7 @@ pub fn hss_keygen( mod tests { use crate::util::helper::test_helper::gen_random_seed; use crate::{ - constants::{LMS_LEAF_IDENTIFIERS_SIZE, MAX_HASH_SIZE}, + constants::{LMS_LEAF_IDENTIFIERS_SIZE, MAX_HASH_SIZE, REF_IMPL_MAX_ALLOWED_HSS_LEVELS}, hasher::{ sha256::{Sha256_128, Sha256_192, Sha256_256}, shake256::{Shake256_128, Shake256_192, Shake256_256}, @@ -301,6 +302,7 @@ mod tests { }, LmotsAlgorithm, LmsAlgorithm, }; + use super::parameter::HssParameter; use super::*; @@ -314,10 +316,12 @@ mod tests { let lmots = LmotsAlgorithm::LmotsW4; let lms = LmsAlgorithm::LmsH5; - let parameters = [HssParameter::new(lmots, lms)]; + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(lmots, lms)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); let (mut signing_key, verifying_key) = - hss_keygen::(¶meters, &seed, None).expect("Should generate HSS keys"); + hss_keygen::(&sst_param, &seed, None).expect("Should generate HSS keys"); let signing_key_const = signing_key.clone(); @@ -353,10 +357,14 @@ mod tests { let lmots = LmotsAlgorithm::LmotsW2; let lms = LmsAlgorithm::LmsH2; - let parameters = [HssParameter::new(lmots, lms), HssParameter::new(lmots, lms)]; + + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(lmots, lms)); + vec_hss_params.push(HssParameter::new(lmots, lms)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); let (mut signing_key, verifying_key) = - hss_keygen::(¶meters, &seed, None).expect("Should generate HSS keys"); + hss_keygen::(&sst_param, &seed, None).expect("Should generate HSS keys"); let keypair_lifetime = signing_key.get_lifetime().unwrap(); assert_ne!( @@ -410,10 +418,14 @@ mod tests { let lmots = LmotsAlgorithm::LmotsW2; let lms = LmsAlgorithm::LmsH2; - let parameters = [HssParameter::new(lmots, lms), HssParameter::new(lmots, lms)]; + + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(lmots, lms)); + vec_hss_params.push(HssParameter::new(lmots, lms)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); let (mut signing_key, verifying_key) = - hss_keygen::(¶meters, &seed, None).expect("Should generate HSS keys"); + hss_keygen::(&sst_param, &seed, None).expect("Should generate HSS keys"); let keypair_lifetime = signing_key.get_lifetime().unwrap(); for index in 0..(1u64 + keypair_lifetime) { @@ -452,18 +464,22 @@ mod tests { let lmots = LmotsAlgorithm::LmotsW2; let lms = LmsAlgorithm::LmsH5; - let parameters = [HssParameter::new(lmots, lms), HssParameter::new(lmots, lms)]; + + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(lmots, lms)); + vec_hss_params.push(HssParameter::new(lmots, lms)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); let mut aux_data = [0u8; 1_000]; let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; let (sk1, vk1) = - hss_keygen::(¶meters, &seed, Some(aux_slice)).expect("Should generate HSS keys"); + hss_keygen::(&sst_param, &seed, Some(aux_slice)).expect("Should generate HSS keys"); aux_slice[2 * MAX_HASH_SIZE - 1] ^= 0x1; let (sk2, vk2) = - hss_keygen::(¶meters, &seed, Some(aux_slice)).expect("Should generate HSS keys"); + hss_keygen::(&sst_param, &seed, Some(aux_slice)).expect("Should generate HSS keys"); assert_eq!(sk1, sk2); assert_eq!(vk1, vk2); @@ -501,12 +517,15 @@ mod tests { fn test_signing_core() { let seed = gen_random_seed::(); + + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::construct_default_parameters()); + vec_hss_params.push(HssParameter::construct_default_parameters()); + vec_hss_params.push(HssParameter::construct_default_parameters()); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); + let (mut signing_key, verifying_key) = hss_keygen::( - &[ - HssParameter::construct_default_parameters(), - HssParameter::construct_default_parameters(), - HssParameter::construct_default_parameters(), - ], + &sst_param, &seed, None, ) diff --git a/src/hss/reference_impl_private_key.rs b/src/hss/reference_impl_private_key.rs index 6956b8bb..e0d5c6b4 100644 --- a/src/hss/reference_impl_private_key.rs +++ b/src/hss/reference_impl_private_key.rs @@ -8,6 +8,10 @@ use crate::{ hss::{definitions::HssPrivateKey, seed_derive::SeedDerive}, util::{helper::read_and_advance, ArrayVecZeroize}, HssParameter, LmotsAlgorithm, LmsAlgorithm, + sst::{ + helper, + parameters::{SstExtension, SstsParameter}, + } }; use core::{convert::TryFrom, convert::TryInto, marker::PhantomData}; @@ -86,6 +90,7 @@ impl SeedAndLmsTreeIdentifier { pub struct ReferenceImplPrivateKey { pub compressed_used_leafs_indexes: CompressedUsedLeafsIndexes, pub compressed_parameter: CompressedParameterSet, + pub sst_ext: SstExtension, pub seed: Seed, } @@ -96,10 +101,28 @@ impl ReferenceImplPrivateKey { self.compressed_used_leafs_indexes = CompressedUsedLeafsIndexes::new(0); } - pub fn generate(parameters: &[HssParameter], seed: &Seed) -> Result { + pub fn generate(parameters: &SstsParameter, seed: &Seed) -> Result { + + let sst_ext = SstExtension { + signing_instance: parameters.get_entity_idx(), + top_tree_height: parameters.get_top_height(), + }; + + let hss_params = parameters.get_hss_parameters(); + let top_lms_parameter = hss_params[0].get_lms_parameter(); + + let mut used_leafs_index = 0; + if parameters.get_top_height() != 0 { + used_leafs_index = helper::get_sst_first_leaf_idx( + sst_ext.signing_instance, + top_lms_parameter.get_tree_height(), + sst_ext.top_tree_height); + } + let private_key: ReferenceImplPrivateKey = ReferenceImplPrivateKey { - compressed_used_leafs_indexes: CompressedUsedLeafsIndexes::new(0), - compressed_parameter: CompressedParameterSet::from(parameters)?, + compressed_used_leafs_indexes: CompressedUsedLeafsIndexes::new(used_leafs_index as u64), + compressed_parameter: CompressedParameterSet::from(parameters.get_hss_parameters())?, + sst_ext, seed: seed.clone(), }; @@ -333,10 +356,12 @@ impl CompressedUsedLeafsIndexes { mod tests { use super::{CompressedParameterSet, ReferenceImplPrivateKey}; use crate::{ - constants::MAX_ALLOWED_HSS_LEVELS, hss::definitions::HssPrivateKey, HssParameter, + constants::MAX_ALLOWED_HSS_LEVELS, + constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS, + hss::definitions::HssPrivateKey, HssParameter, LmotsAlgorithm, LmsAlgorithm, Sha256_256, }; - + use crate::SstsParameter; use crate::util::helper::test_helper::gen_random_seed; use tinyvec::ArrayVec; @@ -346,16 +371,20 @@ mod tests { fn exhaust_state() { let lmots = LmotsAlgorithm::LmotsW4; let lms = LmsAlgorithm::LmsH5; - let parameters = [HssParameter::::new(lmots, lms)]; + + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(lmots, lms)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); let seed = gen_random_seed::(); - let mut rfc_private_key = ReferenceImplPrivateKey::generate(¶meters, &seed).unwrap(); + let mut rfc_private_key = ReferenceImplPrivateKey::generate(&sst_param, &seed).unwrap(); let hss_private_key = HssPrivateKey::from(&rfc_private_key, &mut None).unwrap(); let seed = rfc_private_key.seed.clone(); - let tree_heights = parameters + let hss_params = sst_param.get_hss_parameters(); + let tree_heights = hss_params .iter() .map(|parameter| parameter.get_lms_parameter().get_tree_height()) .collect::>(); @@ -373,10 +402,12 @@ mod tests { fn parse_exhausted_state() { let lmots = LmotsAlgorithm::LmotsW4; let lms = LmsAlgorithm::LmsH5; - let parameters = [HssParameter::::new(lmots, lms)]; + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(lmots, lms)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); let seed = gen_random_seed::(); - let mut rfc_private_key = ReferenceImplPrivateKey::generate(¶meters, &seed).unwrap(); + let mut rfc_private_key = ReferenceImplPrivateKey::generate(&sst_param, &seed).unwrap(); let hss_private_key = HssPrivateKey::from(&rfc_private_key, &mut None).unwrap(); let keypair_lifetime = hss_private_key.get_lifetime(); @@ -419,13 +450,14 @@ mod tests { #[test] fn test_binary_representation_rfc_private_key() { - let parameters = [ - HssParameter::construct_default_parameters(), - HssParameter::construct_default_parameters(), - ]; + + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::construct_default_parameters()); + vec_hss_params.push(HssParameter::construct_default_parameters()); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); let seed = gen_random_seed::(); - let key = ReferenceImplPrivateKey::generate(¶meters, &seed).unwrap(); + let key = ReferenceImplPrivateKey::generate(&sst_param, &seed).unwrap(); let binary_representation = key.to_binary_representation(); let deserialized = ReferenceImplPrivateKey::::from_binary_representation( diff --git a/src/hss/signing.rs b/src/hss/signing.rs index b973554a..ce103a97 100644 --- a/src/hss/signing.rs +++ b/src/hss/signing.rs @@ -260,8 +260,10 @@ mod tests { use crate::{HashChain, HssParameter}; use super::{HssPrivateKey, HssSignature, HssSignedPublicKey}; + use crate::sst::parameters::SstsParameter; use crate::constants::LmsTreeIdentifier; + use crate::constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS; use crate::util::helper::test_helper::gen_random_seed; use rand::{rngs::OsRng, RngCore}; use tinyvec::ArrayVec; @@ -272,11 +274,14 @@ mod tests { #[should_panic(expected = "Signing should panic!")] fn reuse_loaded_keypair() { let seed = gen_random_seed::(); + + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::construct_default_parameters()); + vec_hss_params.push(HssParameter::construct_default_parameters()); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); + let private_key = ReferenceImplPrivateKey::::generate( - &[ - HssParameter::construct_default_parameters(), - HssParameter::construct_default_parameters(), - ], + &sst_param, &seed, ) .unwrap(); @@ -332,11 +337,14 @@ mod tests { #[test] fn test_hss_signature_binary_representation() { let seed = gen_random_seed::(); + + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::construct_default_parameters()); + vec_hss_params.push(HssParameter::construct_default_parameters()); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); + let private_key = ReferenceImplPrivateKey::::generate( - &[ - HssParameter::construct_default_parameters(), - HssParameter::construct_default_parameters(), - ], + &sst_param, &seed, ) .unwrap(); diff --git a/src/hss/verify.rs b/src/hss/verify.rs index 25652ee2..b2aca256 100644 --- a/src/hss/verify.rs +++ b/src/hss/verify.rs @@ -38,20 +38,27 @@ mod tests { signing::{HssSignature, InMemoryHssSignature}, verify::verify, }, + sst::parameters::SstsParameter, HssParameter, }; - + use crate::constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS; use crate::util::helper::test_helper::gen_random_seed; + use tinyvec::ArrayVec; + #[test] fn test_hss_verify() { type H = Sha256_256; let seed = gen_random_seed::(); + + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::construct_default_parameters()); + vec_hss_params.push(HssParameter::construct_default_parameters()); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); + + let rfc_key = ReferenceImplPrivateKey::::generate( - &[ - HssParameter::construct_default_parameters(), - HssParameter::construct_default_parameters(), - ], + &sst_param, &seed, ) .unwrap(); diff --git a/src/lib.rs b/src/lib.rs index 12a19247..a3d17b51 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,21 +18,23 @@ //! Signature, signature::{SignerMut, Verifier}, //! Sha256_256, HashChain, Seed, //! }; +//! use hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS; +//! use hbs_lms::SstsParameter; //! //! let message: [u8; 7] = [42, 84, 34, 12, 64, 34, 32]; //! //! // Generate keys for a 2-level HSS system (RootTree W1/H5, ChildTree W2/H5) -//! let hss_parameter = [ -//! HssParameter::::new(LmotsAlgorithm::LmotsW1, LmsAlgorithm::LmsH5), -//! HssParameter::::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5), -//! ]; +//! let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); +//! vec_hss_params.push(HssParameter::::new(LmotsAlgorithm::LmotsW1, LmsAlgorithm::LmsH5)); +//! vec_hss_params.push(HssParameter::::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); +//! let sst_param = SstsParameter::new(vec_hss_params, 0, 0); //! //! let mut seed = Seed::default(); //! OsRng.fill_bytes(seed.as_mut_slice()); //! let aux_data = None; //! //! let (mut signing_key, verifying_key) = -//! hbs_lms::keygen::(&hss_parameter, &seed, aux_data).unwrap(); +//! hbs_lms::keygen::(&sst_param, &seed, aux_data).unwrap(); //! //! let signature = signing_key.try_sign(&message).unwrap(); //! @@ -198,20 +200,23 @@ mod tests { use crate::{ signature::{SignerMut, Verifier}, SigningKey, VerifierSignature, VerifyingKey, + sst::parameters::SstsParameter, }; - + use crate::constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS; use crate::util::helper::test_helper::gen_random_seed; + use tinyvec::ArrayVec; #[test] fn get_signing_and_verifying_key() { type H = Sha256_256; let seed = gen_random_seed::(); + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); + let (signing_key, verifying_key) = keygen::( - &[HssParameter::new( - LmotsAlgorithm::LmotsW2, - LmsAlgorithm::LmsH5, - )], + &sst_param, &seed, None, ) @@ -229,11 +234,13 @@ mod tests { type H = Sha256_256; let seed = gen_random_seed::(); + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); + let (mut signing_key, verifying_key) = keygen::( - &[ - HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5), - HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5), - ], + &sst_param, &seed, None, ) diff --git a/src/lms/definitions.rs b/src/lms/definitions.rs index 46c1e097..073f9261 100644 --- a/src/lms/definitions.rs +++ b/src/lms/definitions.rs @@ -9,6 +9,7 @@ use crate::util::helper::read_and_advance; use crate::{lm_ots, Seed}; use crate::sst::helper::get_sst_first_leaf_idx; use crate::sst::helper::get_sst_last_leaf_idx; +use crate::sst::parameters::SstExtension; use core::convert::TryInto; use tinyvec::ArrayVec; @@ -16,11 +17,8 @@ use zeroize::{Zeroize, ZeroizeOnDrop}; use super::parameters::LmsParameter; -#[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] -pub struct SstExtension { - pub signing_instance: u8, // @TODO review: assuming we won't have > 128 - pub top_tree_height: u8, -} + + #[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] pub struct LmsPrivateKey { diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index cd8e8766..bfb5a4f9 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -1,19 +1,38 @@ -use crate::{signature::Error, HssParameter, Sha256_256}; -use tinyvec::ArrayVec; +use crate::signature::Error; use crate::{ - constants::{ - //LmsTreeIdentifier, - MAX_HASH_SIZE, - }, hasher::HashChain, - //hss::definitions::HssPrivateKey, //seed_derive::SeedDerive} - //LmotsAlgorithm, LmsAlgorithm, - hss::reference_impl_private_key::SeedAndLmsTreeIdentifier, - hss::reference_impl_private_key::Seed, + hss::{ + reference_impl_private_key::{Seed, ReferenceImplPrivateKey}, + definitions::HssPublicKey, + SigningKey, + VerifyingKey, + } }; +use super::parameters::SstsParameter; -// parameters -pub fn gen_sst_subtree(top_height: u8, entity_idx: u8, hss_param: &HssParameter, seed: &Seed) + +pub fn gen_sst_subtree( + parameters: &SstsParameter, + seed: &Seed, + aux_data: Option<&mut &mut [u8]>, +) -> Result<(SigningKey, VerifyingKey), Error> { + println!("sst_keygen"); + + // private keys + let private_key = + ReferenceImplPrivateKey::generate(parameters, seed).map_err(|_| Error::new())?; + let signing_key = SigningKey::from_bytes(&private_key.to_binary_representation())?; + + // public keys -> gen_sst_pubkey + let hss_public_key = HssPublicKey::from(&private_key, aux_data).map_err(|_| Error::new())?; + let verifying_key = VerifyingKey::from_bytes(&hss_public_key.to_binary_representation())?; + + Ok((signing_key, verifying_key)) +} + +/* +// -> shall be replaced by "sst_keygen()" +pub fn gen_sst_subtree(_top_height: u8, _entity_idx: u8, _hss_param: &HssParameter, _seed: &Seed) -> Result, Error> { // @TODO: nyi // 1. we need an HSS SigningKey/VerifyingKey ; pretend to have a full LMS here to fulfill @@ -27,7 +46,7 @@ pub fn gen_sst_subtree(top_height: u8, entity_idx: u8, hss_param: // - or rather the correct idx in the whole SSTS/LMS; we know our "sub-tree ID"; // then each sub-tree's seed is used as a "start a left-most leaf" seed - let mut node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); + let node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); // @TODO work: // 1. - create key for "get_tree_element()"" with seed -- we need different seeds! // a) @@ -35,8 +54,8 @@ pub fn gen_sst_subtree(top_height: u8, entity_idx: u8, hss_param: // hss::reference_impl_private_key.rs : SeedAndLmsTreeIdentifier, // hss::parameter.rs::HssParameter, // used_leafs_index: &u32, - // aux_data: &mut Option,*/ - let mut seed_and_lms_tree_identifier = SeedAndLmsTreeIdentifier::::default(); + // aux_data: &mut Option, + let _seed_and_lms_tree_identifier = SeedAndLmsTreeIdentifier::::default(); //OsRng.fill_bytes(seed_and_lms_tree_identifier.seed.as_mut_slice()); // b) lms::definitions.rs::LmsPrivateKey::new() @@ -51,6 +70,7 @@ pub fn gen_sst_subtree(top_height: u8, entity_idx: u8, hss_param: Ok(node_value) } +*/ /// Parameters: /// other_hss_pub_keys: HSS public keys of other signing entities diff --git a/src/sst/parameters.rs b/src/sst/parameters.rs index 8810d770..81a027ce 100644 --- a/src/sst/parameters.rs +++ b/src/sst/parameters.rs @@ -5,7 +5,7 @@ use crate::{ }; use tinyvec::ArrayVec; - +use zeroize::{Zeroize, ZeroizeOnDrop}; #[derive(Clone, PartialEq, Eq)] pub struct SstsParameter { @@ -60,3 +60,11 @@ impl Default for SstsParameter { } } */ + + + +#[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] +pub struct SstExtension { + pub signing_instance: u8, // @TODO review: assuming we won't have > 128 + pub top_tree_height: u8, +} \ No newline at end of file diff --git a/tests/reference_implementation.rs b/tests/reference_implementation.rs index 96f601d1..fcabd149 100644 --- a/tests/reference_implementation.rs +++ b/tests/reference_implementation.rs @@ -4,8 +4,9 @@ use std::{ path::{Path, PathBuf}, process::Command, }; +use tinyvec::ArrayVec; -use hbs_lms::{HssParameter, LmotsAlgorithm, LmsAlgorithm, Seed, Sha256_256}; +use hbs_lms::{HssParameter, LmotsAlgorithm, LmsAlgorithm, Seed, Sha256_256, REF_IMPL_MAX_ALLOWED_HSS_LEVELS, SstsParameter}; use tempfile::TempDir; const MESSAGE_FILE_NAME: &str = "message.txt"; @@ -51,11 +52,14 @@ fn create_signature_with_own_implementation() { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); + + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::construct_default_parameters()); + vec_hss_params.push(HssParameter::construct_default_parameters()); + let sst_param = SstsParameter::new(vec_hss_params, 0, 0); + let (mut signing_key, verifying_key) = hbs_lms::keygen::( - &[ - HssParameter::construct_default_parameters(), - HssParameter::construct_default_parameters(), - ], + &sst_param, &seed, Some(aux_slice), ) @@ -120,7 +124,12 @@ fn should_produce_same_private_key() { let parameters = HssParameter::::new(LmotsAlgorithm::LmotsW1, LmsAlgorithm::LmsH5); - let (sk, vk) = hbs_lms::keygen(&[parameters, parameters], &seed, None).unwrap(); + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(parameters); + vec_hss_params.push(parameters); + let sst_param = SstsParameter::new(vec_hss_params, 0, 0); + + let (sk, vk) = hbs_lms::keygen(&sst_param, &seed, None).unwrap(); let ref_signing_key = read_private_key(path); let ref_verifying_key = read_public_key(path); From 1cbb1cd09a0400eb862a91b93ffbe44f13f3692d Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Sat, 6 Jan 2024 13:54:29 +0100 Subject: [PATCH 21/43] sst: impl., store & read sst ext. to/from file - 2 Bytes used for top_height and signing_entity - calling with parameters 0/0 for those values results in same behaviour as before --- README.md | 4 +-- src/constants.rs | 3 ++- src/hss/definitions.rs | 26 +++++++++++++++++--- src/hss/reference_impl_private_key.rs | 6 +++++ src/hss/signing.rs | 1 + src/lms/definitions.rs | 12 +++------ src/lms/mod.rs | 10 +++++--- src/sst/helper.rs | 35 +++++++++++++++++++-------- src/sst/parameters.rs | 23 +++++++++++++++--- 9 files changed, 87 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 7f0a2f32..4d437198 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ This demo application can be used in the console as follows: ``` # Key generation -# Generates `mykey.prv`, `mykey.pub` with merkle tree height 10 and winternitz parameter 2 -cargo run --release --example lms-demo -- genkey mykey 10/2 --seed 0123456701234567012345670123456701234567012345670123456701234567 +# Generates `mykey.prv`, `mykey.pub` with merkle tree height = 10, winternitz parameter = 2, top tree height = 3, signing instance = 2 +cargo run --release --example lms-demo -- genkey mykey 10/2/3/2 --seed 0123456701234567012345670123456701234567012345670123456701234567 # Signing # Generates `message.txt.sig` diff --git a/src/constants.rs b/src/constants.rs index bacea1a3..c5e9d13f 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -41,8 +41,9 @@ pub const fn prng_len(seed_len: usize) -> usize { pub const LMS_LEAF_IDENTIFIERS_SIZE: usize = 8; pub const REF_IMPL_MAX_ALLOWED_HSS_LEVELS: usize = 8; +pub const REF_IMPL_SSTS_EXT_SIZE: usize = 2; pub const REF_IMPL_MAX_PRIVATE_KEY_SIZE: usize = - LMS_LEAF_IDENTIFIERS_SIZE + REF_IMPL_MAX_ALLOWED_HSS_LEVELS + MAX_SEED_LEN; + REF_IMPL_SSTS_EXT_SIZE + LMS_LEAF_IDENTIFIERS_SIZE + REF_IMPL_MAX_ALLOWED_HSS_LEVELS + MAX_SEED_LEN; pub const MAX_HASH_SIZE: usize = 32; pub const MAX_HASH_BLOCK_SIZE: usize = 64; diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index 6565553e..5ab5068b 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -14,7 +14,7 @@ use crate::{ generate_key_pair, parameters::LmsParameter, }, - util::helper::read_and_advance, + util::helper::read_and_advance, parameters::SstExtension, }; use crate::{hss::aux::hss_get_aux_data_len, lms::signing::LmsSignature}; @@ -48,13 +48,22 @@ impl HssPrivateKey { let parameters = private_key.compressed_parameter.to::()?; let used_leafs_indexes = private_key.compressed_used_leafs_indexes.to(¶meters); + let mut sst_ext_option = None; + let sst_ext = SstExtension { + signing_instance: private_key.sst_ext.signing_instance, + top_tree_height: private_key.sst_ext.top_tree_height, + }; + if private_key.sst_ext.signing_instance != 0 { + sst_ext_option = Some(sst_ext); + } + let lms_private_key = LmsPrivateKey { seed: current_seed.seed.clone(), lms_tree_identifier: current_seed.lms_tree_identifier, lmots_parameter: *parameters[0].get_lmots_parameter(), lms_parameter: *parameters[0].get_lms_parameter(), used_leafs_index: used_leafs_indexes[0], - sst_ext: None + sst_ext: sst_ext_option, }; hss_private_key.private_key.push(lms_private_key); @@ -69,7 +78,7 @@ impl HssPrivateKey { generate_signature_randomizer::(¤t_seed, &parent_used_leafs_index); let lms_keypair = - generate_key_pair(¤t_seed, parameter, &used_leafs_indexes[i], &mut None); + generate_key_pair(¤t_seed, parameter, &used_leafs_indexes[i], &mut None, None); let signature = lms::signing::LmsSignature::sign( &mut hss_private_key.private_key[i - 1], @@ -177,11 +186,21 @@ impl HssPublicKey { let current_seed = private_key.generate_root_seed_and_lms_tree_identifier(); + let mut sst_ext_option = None; + let sst_ext = SstExtension { + signing_instance: private_key.sst_ext.signing_instance, + top_tree_height: private_key.sst_ext.top_tree_height, + }; + if private_key.sst_ext.signing_instance != 0 { + sst_ext_option = Some(sst_ext); + } + let lms_keypair = generate_key_pair( ¤t_seed, ¶meters[0], &used_leafs_indexes[0], &mut expanded_aux_data, + sst_ext_option ); if let Some(expanded_aux_data) = expanded_aux_data.as_mut() { @@ -395,6 +414,7 @@ mod tests { &HssParameter::construct_default_parameters(), &0, &mut None, + None ); let public_key: HssPublicKey = HssPublicKey { level: 18, diff --git a/src/hss/reference_impl_private_key.rs b/src/hss/reference_impl_private_key.rs index e0d5c6b4..47e2e7c7 100644 --- a/src/hss/reference_impl_private_key.rs +++ b/src/hss/reference_impl_private_key.rs @@ -3,6 +3,7 @@ use crate::{ LmsTreeIdentifier, D_TOPSEED, ILEN, LMS_LEAF_IDENTIFIERS_SIZE, MAX_ALLOWED_HSS_LEVELS, MAX_HASH_SIZE, MAX_SEED_LEN, REF_IMPL_MAX_PRIVATE_KEY_SIZE, SEED_CHILD_SEED, SEED_SIGNATURE_RANDOMIZER_SEED, TOPSEED_D, TOPSEED_LEN, TOPSEED_SEED, TOPSEED_WHICH, + REF_IMPL_SSTS_EXT_SIZE, }, hasher::HashChain, hss::{definitions::HssPrivateKey, seed_derive::SeedDerive}, @@ -132,6 +133,8 @@ impl ReferenceImplPrivateKey { pub fn to_binary_representation(&self) -> ArrayVec<[u8; REF_IMPL_MAX_PRIVATE_KEY_SIZE]> { let mut result = ArrayVec::new(); + result.extend_from_slice(&self.sst_ext.signing_instance.to_be_bytes()); + result.extend_from_slice(&self.sst_ext.top_tree_height.to_be_bytes()); result.extend_from_slice(&self.compressed_used_leafs_indexes.count.to_be_bytes()); result.extend_from_slice(&self.compressed_parameter.0); result.extend_from_slice(self.seed.as_slice()); @@ -147,6 +150,9 @@ impl ReferenceImplPrivateKey { let mut result = Self::default(); let mut index = 0; + let ssts_ext = read_and_advance(data, REF_IMPL_SSTS_EXT_SIZE, &mut index); + result.sst_ext = SstExtension::from_slice(ssts_ext)?; + let compressed_used_leafs_indexes = read_and_advance(data, LMS_LEAF_IDENTIFIERS_SIZE, &mut index); result.compressed_used_leafs_indexes = diff --git a/src/hss/signing.rs b/src/hss/signing.rs index ce103a97..d5eed969 100644 --- a/src/hss/signing.rs +++ b/src/hss/signing.rs @@ -308,6 +308,7 @@ mod tests { &HssParameter::construct_default_parameters(), &0, &mut None, + None ); let message = [3, 54, 32, 45, 67, 32, 12, 58, 29, 49]; diff --git a/src/lms/definitions.rs b/src/lms/definitions.rs index 073f9261..bc78c714 100644 --- a/src/lms/definitions.rs +++ b/src/lms/definitions.rs @@ -7,7 +7,6 @@ use crate::lms::parameters::LmsAlgorithm; use crate::lms::MutableExpandedAuxData; use crate::util::helper::read_and_advance; use crate::{lm_ots, Seed}; -use crate::sst::helper::get_sst_first_leaf_idx; use crate::sst::helper::get_sst_last_leaf_idx; use crate::sst::parameters::SstExtension; @@ -41,16 +40,10 @@ impl LmsPrivateKey { lms_parameter: LmsParameter, sst_ext: Option ) -> Self { - let mut my_used_leafs_index = used_leafs_index; - if let Some(my_sst_ext) = &sst_ext { - assert_eq!(used_leafs_index, 0); // make sure we are getting initialized - my_used_leafs_index = get_sst_first_leaf_idx(my_sst_ext.signing_instance, lms_parameter.get_tree_height(), my_sst_ext.top_tree_height) - } - LmsPrivateKey { seed, lms_tree_identifier, - used_leafs_index: my_used_leafs_index, + used_leafs_index, lmots_parameter, lms_parameter, sst_ext @@ -60,7 +53,8 @@ impl LmsPrivateKey { pub fn use_lmots_private_key(&mut self) -> Result, ()> { let number_of_lm_ots_keys = { if let Some(my_sst_ext) = &self.sst_ext { - get_sst_last_leaf_idx(my_sst_ext.signing_instance, self.lms_parameter.get_tree_height(), my_sst_ext.top_tree_height) + // our last leafs function returns 0..total_num-1, but here we need 1..total_num + 1 + get_sst_last_leaf_idx(my_sst_ext.signing_instance, self.lms_parameter.get_tree_height(), my_sst_ext.top_tree_height) } else { self.lms_parameter.number_of_lm_ots_keys() as u32 diff --git a/src/lms/mod.rs b/src/lms/mod.rs index 010f025e..b1f80775 100644 --- a/src/lms/mod.rs +++ b/src/lms/mod.rs @@ -1,6 +1,7 @@ use crate::hasher::HashChain; use crate::hss::aux::MutableExpandedAuxData; use crate::hss::parameter::HssParameter; +use crate::parameters::SstExtension; use crate::hss::reference_impl_private_key::SeedAndLmsTreeIdentifier; use crate::lms::definitions::LmsPrivateKey; use crate::lms::definitions::LmsPublicKey; @@ -18,12 +19,13 @@ pub struct LmsKeyPair { pub fn generate_key_pair( seed: &SeedAndLmsTreeIdentifier, - parameter: &HssParameter, + hss_param: &HssParameter, used_leafs_index: &u32, aux_data: &mut Option, + sst_ext: Option, ) -> LmsKeyPair { - let lmots_parameter = parameter.get_lmots_parameter(); - let lms_parameter = parameter.get_lms_parameter(); + let lmots_parameter = hss_param.get_lmots_parameter(); + let lms_parameter = hss_param.get_lms_parameter(); let private_key = LmsPrivateKey::new( seed.seed.clone(), @@ -31,7 +33,7 @@ pub fn generate_key_pair( *used_leafs_index, *lmots_parameter, *lms_parameter, - None, + sst_ext, ); let public_key = LmsPublicKey::new(&private_key, aux_data); diff --git a/src/sst/helper.rs b/src/sst/helper.rs index 7fc2d9a5..8d53fcb2 100644 --- a/src/sst/helper.rs +++ b/src/sst/helper.rs @@ -11,20 +11,35 @@ fn get_num_leaves_in_sst(total_height: u8, top_div: u8) -> u32 { 2u32.pow((total_height - top_div) as u32) } -// For a subtree, depending on whole SSTS and division, get first leaf idx on whole SSTS +// For a subtree, depending on whole SSTS and division, get first leaf idx where leafs start with 0 pub fn get_sst_first_leaf_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level - 2u32.pow(total_height as u32) + (((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div)) as u32 + (((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div)) as u32 } -// For a subtree, depending on whole SSTS and division, get first leaf idx on whole SSTS +// For a subtree, depending on whole SSTS and division, get last leaf idx where leafs start with 0 pub fn get_sst_last_leaf_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level get_sst_first_leaf_idx(signing_entity_idx, total_height, top_div) - 1 + get_num_leaves_in_sst(total_height, top_div) } + +// For a subtree, depending on whole SSTS and division, get first leaf idx on whole SSTS +pub fn get_sst_first_leaf_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { + assert!(signing_entity_idx > 0); + assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level + 2u32.pow(total_height as u32) + (((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div)) as u32 +} + +// For a subtree, depending on whole SSTS and division, get last leaf idx on whole SSTS +pub fn get_sst_last_leaf_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { + assert!(signing_entity_idx > 0); + assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level + get_sst_first_leaf_node_idx(signing_entity_idx, total_height, top_div) - 1 + get_num_leaves_in_sst(total_height, top_div) +} + // number of leaves of a Merkle tree fn _get_num_leaves(height: u8) -> u32 { 2u32.pow(height as u32) @@ -110,44 +125,44 @@ mod tests { #[test] fn test_get_sst_first_leaf_idx_1() { - let first_leaf_idx = get_sst_first_leaf_idx(1, 5, 3); + let first_leaf_idx = get_sst_first_leaf_node_idx(1, 5, 3); assert_eq!(32, first_leaf_idx); } #[test] fn test_get_sst_first_leaf_idx_2() { - let first_leaf_idx = get_sst_first_leaf_idx(3, 5, 3); + let first_leaf_idx = get_sst_first_leaf_node_idx(3, 5, 3); assert_eq!(40, first_leaf_idx); } #[test] fn test_get_sst_first_leaf_idx_3() { - let first_leaf_idx = get_sst_first_leaf_idx(8, 5, 3); + let first_leaf_idx = get_sst_first_leaf_node_idx(8, 5, 3); assert_eq!(60, first_leaf_idx); } #[test] fn test_get_sst_last_leaf_idx_1() { - let last_leaf_idx = get_sst_last_leaf_idx(1, 5, 3); + let last_leaf_idx = get_sst_last_leaf_node_idx(1, 5, 3); assert_eq!(35, last_leaf_idx); } #[test] fn test_get_sst_last_leaf_idx_2() { - let last_leaf_idx = get_sst_last_leaf_idx(3, 5, 3); + let last_leaf_idx = get_sst_last_leaf_node_idx(3, 5, 3); assert_eq!(43, last_leaf_idx); } #[test] fn test_get_sst_last_leaf_idx_3() { - let last_leaf_idx = get_sst_last_leaf_idx(8, 5, 3); + let last_leaf_idx = get_sst_last_leaf_node_idx(8, 5, 3); assert_eq!(63, last_leaf_idx); } #[test] #[should_panic] fn test_get_sst_last_leaf_idx_4() { - let last_leaf_idx = get_sst_last_leaf_idx(9, 5, 3); + let last_leaf_idx = get_sst_last_leaf_node_idx(9, 5, 3); assert_eq!(63, last_leaf_idx); } diff --git a/src/sst/parameters.rs b/src/sst/parameters.rs index 81a027ce..5822e1df 100644 --- a/src/sst/parameters.rs +++ b/src/sst/parameters.rs @@ -6,6 +6,7 @@ use crate::{ use tinyvec::ArrayVec; use zeroize::{Zeroize, ZeroizeOnDrop}; +use core::convert::TryInto; #[derive(Clone, PartialEq, Eq)] pub struct SstsParameter { @@ -22,8 +23,7 @@ impl SstsParameter { SstsParameter { hss_parameters: hss_params, - top_height, // e.g. LMS height of 5 and top_height 3, we divide 3/3 (we consider one node as part of both tree parts) - // would give us 2^3 = 8 signing entities + top_height, // e.g. LMS height of 5 and top_height 3: division top/bottom is 3/2 which would result in 2^3 = 8 signing entities entity_idx, } } @@ -62,9 +62,24 @@ impl Default for SstsParameter { */ - #[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] pub struct SstExtension { - pub signing_instance: u8, // @TODO review: assuming we won't have > 128 + pub signing_instance: u8, pub top_tree_height: u8, +} + +impl SstExtension { + pub fn from_slice(data: &[u8]) -> Result { + if data.len() != constants::REF_IMPL_SSTS_EXT_SIZE { + return Err(()); + } + + let tmp: u16 = u16::from_be_bytes(data.try_into().unwrap()); + let sst_ext = SstExtension { + signing_instance: (tmp >> 8 ) as u8, // TODO correct? + top_tree_height: tmp as u8, + }; + + Ok(sst_ext) + } } \ No newline at end of file From f4c3531c25d39e87b50211ad15328cdfe7306976 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Tue, 9 Jan 2024 15:37:25 +0100 Subject: [PATCH 22/43] sst: calc. and save intermediate SST node value - "node value" is the hash value calc. via get_tree_element() depending in the root node of the signing instance's single-sub-tree --- examples/sst_demo.rs | 64 +++++++++++++++------- src/lms/mod.rs | 2 +- src/sst/gen_key.rs | 123 +++++++++++++++++++++++++++++++----------- src/sst/helper.rs | 18 +++---- src/sst/parameters.rs | 6 +-- 5 files changed, 149 insertions(+), 64 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index a364fa25..a4f3c534 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -3,7 +3,7 @@ use hbs_lms::*; use std::{ error::Error, fmt, - fs::{read, File}, + fs::{read, File, OpenOptions}, io::{Read, Write}, process::exit, }; @@ -69,10 +69,12 @@ fn main() -> Result<(), Box> { Err(error) => panic!("sst::gen_sst_subtree error {:?}", error), }; */ + /* let _sst_pubkey = match hbs_lms::sst::gen_sst_pubkey() { Ok(_) => println!("sst::gen_key OK"), Err(error) => panic!("sst::gen_key: error {:?}", error), }; + */ let _signature = match hbs_lms::sst::sign::(&message) { Ok(_) => println!("sst::sign OK"), @@ -349,34 +351,56 @@ fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> return DemoError::raise("Seed was not given".to_string()); }; - let mut aux_data = vec![0u8; genkey_parameter.aux_data]; - let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; - - // TODO get the subtree node value - let (signing_key, verifying_key) = gen_sst_subtree(&ssts_param, &seed, Some(aux_slice)) + // TODO should we generate aux data here onr in next step -- or in both? + // create our private key + let (signing_key, node_pubkey) = gen_sst_subtree(&ssts_param, &seed) .unwrap_or_else(|_| panic!("Could not generate keys")); + println!("sst_demo::gen_key_subtree(): node value: {:?}", node_pubkey); + let private_key_filename = get_private_key_name(&keyname); + write(private_key_filename.as_str(), signing_key.as_slice())?; + + // write own node value and signing instance to file + // TODO maybe also HSS/LMS/LM-OTS parameters, to ensure that we got the same parameters among all signing instances + let interm_node_filename = + String::from("node_si") + &(ssts_param.get_entity_idx().to_string()) + &String::from(".bin"); + + // if file exists, overwrite + write(interm_node_filename.as_str(), &ssts_param.get_entity_idx().to_be_bytes())?; + // append + let mut interm_node_file = OpenOptions::new() + .create(true) + .write(true) + .append(true) + .open(interm_node_filename.as_str()) + .unwrap(); + interm_node_file.write_all(node_pubkey.as_slice())?; + + Ok(()) +} + + +fn gen_key_ssts(args: &ArgMatches) -> Result<(), Box> { + + // TODO 2nd call for verifying key! -> move to dofferent function! // we have to break here to get the params for the key generation second step (i.e. whole tree generation) - /* - let mut _node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); - _node_value = gen_sst_subtree(genkey_parameter.ssts_param.get_top_height(), genkey_parameter.ssts_param.get_entity_idx(), &hss_params[0], &seed) - .unwrap_or_else(|_| panic!("Could not generate keys")); - */ + //let public_key_filename = get_public_key_name(&keyname); - let public_key_filename = get_public_key_name(&keyname); - let private_key_filename = get_private_key_name(&keyname); + let keyname = get_parameter(ARG_KEYNAME, args); + let private_key_name = get_private_key_name(&keyname); + let private_key_data = read_file(&private_key_name); - let aux_name = get_aux_name(&keyname); - write(&aux_name, aux_slice)?; + let aux_data_name = get_aux_name(&keyname); + let mut aux_data = read(aux_data_name).ok(); + //let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; - write(public_key_filename.as_str(), verifying_key.as_slice())?; - write(private_key_filename.as_str(), signing_key.as_slice())?; + // retrieve PrivateKey private_key: &ReferenceImplPrivateKey + //gen_sst_pubkey(&private_key_data, Some(aux_slice)); + + //write(public_key_filename.as_str(), verifying_key.as_slice())?; - Ok(()) -} -fn gen_key_ssts(_args: &ArgMatches) -> Result<(), Box> { Ok(()) } diff --git a/src/lms/mod.rs b/src/lms/mod.rs index b1f80775..dae57411 100644 --- a/src/lms/mod.rs +++ b/src/lms/mod.rs @@ -7,7 +7,7 @@ use crate::lms::definitions::LmsPrivateKey; use crate::lms::definitions::LmsPublicKey; pub mod definitions; -mod helper; +pub mod helper; // TODO review -> pub! pub mod parameters; pub mod signing; pub mod verify; diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index bfb5a4f9..331bf833 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -1,39 +1,115 @@ use crate::signature::Error; use crate::{ + sst::{ + helper, + parameters::SstsParameter, + parameters::SstExtension, + helper::get_subtree_node_idx + }, hasher::HashChain, hss::{ reference_impl_private_key::{Seed, ReferenceImplPrivateKey}, definitions::HssPublicKey, SigningKey, - VerifyingKey, - } + //VerifyingKey, + }, + lms::helper::get_tree_element, + lms::definitions::LmsPrivateKey, + constants::MAX_HASH_SIZE, }; -use super::parameters::SstsParameter; + +use tinyvec::ArrayVec; pub fn gen_sst_subtree( - parameters: &SstsParameter, + sst_param: &SstsParameter, seed: &Seed, - aux_data: Option<&mut &mut [u8]>, -) -> Result<(SigningKey, VerifyingKey), Error> { - println!("sst_keygen"); +) -> Result<(SigningKey, ArrayVec<[u8; MAX_HASH_SIZE]>), Error> { + println!("gen_sst_subtree"); // private keys let private_key = - ReferenceImplPrivateKey::generate(parameters, seed).map_err(|_| Error::new())?; + ReferenceImplPrivateKey::generate(sst_param, seed).map_err(|_| Error::new())?; let signing_key = SigningKey::from_bytes(&private_key.to_binary_representation())?; - // public keys -> gen_sst_pubkey - let hss_public_key = HssPublicKey::from(&private_key, aux_data).map_err(|_| Error::new())?; - let verifying_key = VerifyingKey::from_bytes(&hss_public_key.to_binary_representation())?; + // TODO review: redundant...used leafs calculation + let mut used_leafs_index = 0; + if sst_param.get_top_height() != 0 { // TODO: is there a better (Rust-idiomatic) approach? + used_leafs_index = helper::get_sst_first_leaf_idx( + sst_param.get_entity_idx(), + sst_param.get_hss_parameters()[0].get_lms_parameter().get_tree_height(), + sst_param.get_top_height()); + } + + // our intermediate node value + // TODO: review! not elegant to create an LmsPrivateKey and SeedAndLmsTreeIdentifier + + let seed_and_lms_tree_ident = private_key.generate_root_seed_and_lms_tree_identifier(); + + let sst_ext = SstExtension { + signing_instance: private_key.sst_ext.signing_instance, + top_tree_height: private_key.sst_ext.top_tree_height, + }; + + let mut sst_ext_option = None; + let mut our_node_index = 0; + + if private_key.sst_ext.signing_instance != 0 { + sst_ext_option = Some(sst_ext); + + our_node_index = get_subtree_node_idx( + sst_param.get_entity_idx(), + sst_param.get_hss_parameters()[0].get_lms_parameter().get_tree_height(), + sst_param.get_top_height(), + ); + } + + let lms_private_key = LmsPrivateKey::::new( + seed_and_lms_tree_ident.seed.clone(), + seed_and_lms_tree_ident.lms_tree_identifier, + used_leafs_index as u32, // actually not used in "get_tree_element", irrelevant + *sst_param.get_hss_parameters()[0].get_lmots_parameter(), + *sst_param.get_hss_parameters()[0].get_lms_parameter(), + sst_ext_option, + ); - Ok((signing_key, verifying_key)) + let our_node_value = get_tree_element( + our_node_index as usize, + &lms_private_key, + &mut None, + ); + + Ok((signing_key, our_node_value)) } + +/// Parameters: +/// other_hss_pub_keys: HSS public keys of other signing entities +/// own_hss_pub_key: HSS public key of the calling signing entity (separate, to create entity's individual authentication path). +/// Returns the root node (public key) which comprises the authentication path -- whihch is different for every signing entity! /* +pub fn gen_sst_pubkey() -> Result<(), Error> { + + // that's different now, because we do not generate a whole LMS based on + // one seed but on different intermediate nodes (with different seeds). + // -> Check whether there is a function that takes intermediate nodes! (e.g. function using aux data) + // because that's basically what we need + + // @TODO: use the Error + Ok(()) +} +*/ + // -> shall be replaced by "sst_keygen()" -pub fn gen_sst_subtree(_top_height: u8, _entity_idx: u8, _hss_param: &HssParameter, _seed: &Seed) - -> Result, Error> { +pub fn gen_sst_pubkey(_private_key: &[u8], _aux_data: Option<&mut &mut [u8]>) +// -> Result<(VerifyingKey), Error> +{ + + // public keys -> gen_sst_pubkey + // check how the &[u8] is transformed to RefPrivKey in sign() + // let hss_public_key = HssPublicKey::from(&private_key, aux_data).map_err(|_| Error::new())?; + //let verifying_key = VerifyingKey::from_bytes(&hss_public_key.to_binary_representation())?; + // @TODO: nyi // 1. we need an HSS SigningKey/VerifyingKey ; pretend to have a full LMS here to fulfill // param. requirements for existing functions. @@ -46,7 +122,6 @@ pub fn gen_sst_subtree(_top_height: u8, _entity_idx: u8, _hss_para // - or rather the correct idx in the whole SSTS/LMS; we know our "sub-tree ID"; // then each sub-tree's seed is used as a "start a left-most leaf" seed - let node_value = ArrayVec::from([0u8; MAX_HASH_SIZE]); // @TODO work: // 1. - create key for "get_tree_element()"" with seed -- we need different seeds! // a) @@ -55,7 +130,7 @@ pub fn gen_sst_subtree(_top_height: u8, _entity_idx: u8, _hss_para // hss::parameter.rs::HssParameter, // used_leafs_index: &u32, // aux_data: &mut Option, - let _seed_and_lms_tree_identifier = SeedAndLmsTreeIdentifier::::default(); + // let _seed_and_lms_tree_identifier = SeedAndLmsTreeIdentifier::::default(); //OsRng.fill_bytes(seed_and_lms_tree_identifier.seed.as_mut_slice()); // b) lms::definitions.rs::LmsPrivateKey::new() @@ -68,21 +143,7 @@ pub fn gen_sst_subtree(_top_height: u8, _entity_idx: u8, _hss_para //); // 2. - call get_tree_element(idx, LmsPrivateKey, None) - Ok(node_value) + //Ok(verifying_key) } -*/ - -/// Parameters: -/// other_hss_pub_keys: HSS public keys of other signing entities -/// own_hss_pub_key: HSS public key of the calling signing entity (separate, to create entity's individual authentication path). -/// Returns the root node (public key) which comprises the authentication path -- whihch is different for every signing entity! -pub fn gen_sst_pubkey() -> Result<(), Error> { - // that's different now, because we do not generate a whole LMS based on - // one seed but on different intermediate nodes (with different seeds). - // -> Check whether there is a function that takes intermediate nodes! (e.g. function using aux data) - // because that's basically what we need - // @TODO: use the Error - Ok(()) -} diff --git a/src/sst/helper.rs b/src/sst/helper.rs index 8d53fcb2..53d81aa5 100644 --- a/src/sst/helper.rs +++ b/src/sst/helper.rs @@ -1,6 +1,6 @@ // a function that provides our sub-tree top node idx within the SSTS // subtree_num counts from left-most = 1 to top part's "number_of_leaves" -fn _get_subtree_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { +pub fn get_subtree_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level assert!(top_div <= total_height); @@ -57,44 +57,44 @@ mod tests { #[test] fn test_get_subtree_node_in_ssts_1() { - let subtree_node_idx = _get_subtree_node_idx(1, 4, 2); + let subtree_node_idx = get_subtree_node_idx(1, 4, 2); assert_eq!(4, subtree_node_idx); } #[test] fn test_get_subtree_node_in_ssts_2() { - let subtree_node_idx = _get_subtree_node_idx(2, 4, 2); + let subtree_node_idx = get_subtree_node_idx(2, 4, 2); assert_eq!(5, subtree_node_idx); } #[test] fn test_get_subtree_node_in_ssts_3() { - let subtree_node_idx = _get_subtree_node_idx(1, 4, 3); + let subtree_node_idx = get_subtree_node_idx(1, 4, 3); assert_eq!(8, subtree_node_idx); } #[test] fn test_get_subtree_node_in_ssts_4() { - let subtree_node_idx = _get_subtree_node_idx(2, 4, 3); + let subtree_node_idx = get_subtree_node_idx(2, 4, 3); assert_eq!(9, subtree_node_idx); } #[test] fn test_get_subtree_node_in_ssts_5() { - let subtree_node_idx = _get_subtree_node_idx(1, 4, 4); + let subtree_node_idx = get_subtree_node_idx(1, 4, 4); assert_eq!(16, subtree_node_idx); } #[test] fn test_get_subtree_node_in_ssts_6() { - let subtree_node_idx = _get_subtree_node_idx(9, 4, 4); + let subtree_node_idx = get_subtree_node_idx(9, 4, 4); assert_eq!(24, subtree_node_idx); } // one outermost "leaf" #[test] fn test_get_subtree_node_in_ssts_7() { - let subtree_node_idx = _get_subtree_node_idx(16, 4, 4); + let subtree_node_idx = get_subtree_node_idx(16, 4, 4); assert_eq!(31, subtree_node_idx); } @@ -102,7 +102,7 @@ mod tests { #[test] #[should_panic] fn test_get_subtree_node_in_ssts_8() { - let _subtree_node_idx = _get_subtree_node_idx(17, 4, 4); + let _subtree_node_idx = get_subtree_node_idx(17, 4, 4); } #[test] diff --git a/src/sst/parameters.rs b/src/sst/parameters.rs index 5822e1df..36d807ef 100644 --- a/src/sst/parameters.rs +++ b/src/sst/parameters.rs @@ -12,7 +12,7 @@ use core::convert::TryInto; pub struct SstsParameter { hss_parameters: ArrayVec<[HssParameter; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]>, top_height: u8, - entity_idx: u8, // starting with 1 + signing_entity_idx: u8, // starting with 1 } @@ -24,7 +24,7 @@ impl SstsParameter { SstsParameter { hss_parameters: hss_params, top_height, // e.g. LMS height of 5 and top_height 3: division top/bottom is 3/2 which would result in 2^3 = 8 signing entities - entity_idx, + signing_entity_idx: entity_idx, } } @@ -37,7 +37,7 @@ impl SstsParameter { } pub fn get_entity_idx(&self) -> u8 { - self.entity_idx + self.signing_entity_idx } } From c165fba40abb0da4b4c4b0202a4f9a93f59ba172 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Sun, 14 Jan 2024 19:38:39 +0100 Subject: [PATCH 23/43] sst: calc. public key via signing entity nodes --- examples/sst_demo.rs | 159 +++++++++++++++++++++++++++++-------------- src/constants.rs | 4 ++ src/lib.rs | 2 +- src/sst/gen_key.rs | 74 +++++++++++++++++++- src/sst/mod.rs | 7 +- 5 files changed, 188 insertions(+), 58 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index a4f3c534..23e86752 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -10,7 +10,7 @@ use std::{ use tinyvec::ArrayVec; const GENSUBTREE_COMMAND: &str = "gensubtree"; -const GENSSTS_COMMAND: &str = "genssts"; +const GENPUBKEY_COMMAND: &str = "genpubkey"; const VERIFY_COMMAND: &str = "verify"; const SIGN_COMMAND: &str = "sign"; @@ -20,6 +20,7 @@ const SIGN_MUT_COMMAND: &str = "sign_mut"; const ARG_KEYNAME: &str = "keyname"; const ARG_MESSAGE: &str = "file"; const ARG_SSTS_PARAMETER: &str = "parameter"; +const ARG_SI_PARAMETER: &str = "si_param"; const ARG_SEED: &str = "seed"; const AUX_DATA_DEFAULT_SIZE: usize = 100_000_000; @@ -45,15 +46,15 @@ type Hasher = Sha256_256; struct GenKeyParameter { ssts_param: SstsParameter, - aux_data: usize, + _aux_data: usize, } impl GenKeyParameter { pub fn new(ssts_param: SstsParameter, aux_data: Option) -> Self { - let aux_data = aux_data.unwrap_or(AUX_DATA_DEFAULT_SIZE); + let _aux_data = aux_data.unwrap_or(AUX_DATA_DEFAULT_SIZE); Self { ssts_param, - aux_data, + _aux_data, } } } @@ -61,35 +62,21 @@ impl GenKeyParameter { fn main() -> Result<(), Box> { - let message = [32; 0]; // 32 elements init. with 0 - /* - let _hss_key = match hbs_lms::sst::gen_sst_subtree() { - // save aux data here or in gen_sst_subtree()? -> rather here, compare with lms-demo - Ok(_) => println!("sst::gen_sst_subtree OK"), - Err(error) => panic!("sst::gen_sst_subtree error {:?}", error), - }; - */ /* - let _sst_pubkey = match hbs_lms::sst::gen_sst_pubkey() { - Ok(_) => println!("sst::gen_key OK"), - Err(error) => panic!("sst::gen_key: error {:?}", error), - }; - */ + let message = [32; 0]; // 32 elements init. with 0 let _signature = match hbs_lms::sst::sign::(&message) { Ok(_) => println!("sst::sign OK"), Err(error) => panic!("sst::sign {:?}", error), }; - let signature = [32; 0]; // 32 elements init. with 0 let public_key = [32; 0]; // 32 elements init. with 0 + if hbs_lms::sst::verify::(&message, &signature, &public_key) == false { println!("sst::verify failed"); exit(1); } - - println!("sst::verify OK"); - + */ // ********** code from "lms-demo.rs" to steal/import parameter parsing etc. ********** let command = Command::new("SSTS Demo") @@ -102,9 +89,11 @@ fn main() -> Result<(), Box> { .arg(Arg::new(ARG_SEED).long(ARG_SEED).required(true).takes_value(true).value_name("seed")), ) .subcommand( - Command::new(GENSSTS_COMMAND) + Command::new(GENPUBKEY_COMMAND) .arg(Arg::new(ARG_KEYNAME).required(true)) - .arg(Arg::new(ARG_MESSAGE).required(true).help("Configuration file for SSTS generation"))) + .arg(Arg::new(ARG_SI_PARAMETER).required(true).help( + "Specify signing instance number (1..n))")) + ) .subcommand( Command::new(VERIFY_COMMAND) .arg(Arg::new(ARG_KEYNAME).required(true)) @@ -126,13 +115,13 @@ fn main() -> Result<(), Box> { if let Some(args) = matches.subcommand_matches(GENSUBTREE_COMMAND) { gen_key_subtree(args)?; - println!("Subtree successfully generated!"); + println!("Single-subtree-structure: intermediate node and private key successfully generated!"); return Ok(()); } - if let Some(args) = matches.subcommand_matches(GENSUBTREE_COMMAND) { + if let Some(args) = matches.subcommand_matches(GENPUBKEY_COMMAND) { gen_key_ssts(args)?; - println!("Single-subtree-structure successfully generated!"); + println!("Single-subtree-structure: public key successfully generated!"); return Ok(()); } @@ -168,13 +157,13 @@ fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { let keyname = get_parameter(ARG_KEYNAME, args); let message_name = get_parameter(ARG_MESSAGE, args); - let private_key_name = get_private_key_name(&keyname); - let signature_name = get_signature_name(&message_name); + let private_key_name = get_private_key_filename(&keyname); + let signature_name = get_signature_filename(&message_name); let private_key_data = read_file(&private_key_name); let message_data = read_file(&message_name); - let aux_data_name = get_aux_name(&keyname); + let aux_data_name = get_aux_filename(&keyname); let mut aux_data = read(aux_data_name).ok(); let mut private_key_update_function = |new_key: &[u8]| { @@ -216,7 +205,7 @@ fn sign_mut(args: &ArgMatches) -> Result<(), std::io::Error> { let keyname = get_parameter(ARG_KEYNAME, args); let message_name = get_parameter(ARG_MESSAGE, args); - let private_key_name = get_private_key_name(&keyname); + let private_key_name = get_private_key_filename(&keyname); let signature_name_mut = get_signature_mut_name(&message_name); let message_name_mut = get_message_mut_name(&message_name); @@ -226,7 +215,7 @@ fn sign_mut(args: &ArgMatches) -> Result<(), std::io::Error> { let mut message_data = read_file(&message_name); message_data.extend_from_slice(&[0u8; 32]); - let aux_data_name = get_aux_name(&keyname); + let aux_data_name = get_aux_filename(&keyname); let mut aux_data = read(aux_data_name).ok(); let mut private_key_update_function = |new_key: &[u8]| { @@ -275,8 +264,8 @@ fn verify(args: &ArgMatches) -> bool { let keyname: String = get_parameter(ARG_KEYNAME, args); let message_name: String = get_parameter(ARG_MESSAGE, args); - let public_key_name = get_public_key_name(&keyname); - let signature_name = get_signature_name(&message_name); + let public_key_name = get_public_key_filename(&keyname); + let signature_name = get_signature_filename(&message_name); let signature_data = read_file(&signature_name); let message_data = read_file(&message_name); @@ -285,29 +274,29 @@ fn verify(args: &ArgMatches) -> bool { hbs_lms::verify::(&message_data, &signature_data, &public_key_data).is_ok() } -fn get_public_key_name(keyname: &str) -> String { +fn get_public_key_filename(keyname: &str) -> String { keyname.to_string() + ".pub" } -fn get_signature_name(message_name: &str) -> String { +fn get_signature_filename(message_name: &str) -> String { message_name.to_string() + ".sig" } #[cfg(feature = "fast_verify")] -fn get_signature_mut_name(message_name: &str) -> String { +fn get_signature_mut_filename(message_name: &str) -> String { message_name.to_string() + "_mut.sig" } #[cfg(feature = "fast_verify")] -fn get_message_mut_name(message_name: &str) -> String { +fn get_message_mut_filename(message_name: &str) -> String { message_name.to_string() + "_mut" } -fn get_private_key_name(private_key: &str) -> String { +fn get_private_key_filename(private_key: &str) -> String { private_key.to_string() + ".prv" } -fn get_aux_name(keyname: &str) -> String { +fn get_aux_filename(keyname: &str) -> String { keyname.to_string() + ".aux" } @@ -331,7 +320,8 @@ fn read_file(file_name: &str) -> Vec { fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> { let keyname: String = get_parameter(ARG_KEYNAME, args); - let genkey_parameter = parse_genkey_parameter(&get_parameter(ARG_SSTS_PARAMETER, args)); + + let genkey_parameter = parse_genkey1_parameter(&get_parameter(ARG_SSTS_PARAMETER, args)); let ssts_param = genkey_parameter.ssts_param; let seed: Seed = if let Some(seed) = args.value_of(ARG_SEED) { @@ -351,23 +341,24 @@ fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> return DemoError::raise("Seed was not given".to_string()); }; - // TODO should we generate aux data here onr in next step -- or in both? + // TODO should we generate aux data here or in next step -- or in both? + // create our private key let (signing_key, node_pubkey) = gen_sst_subtree(&ssts_param, &seed) .unwrap_or_else(|_| panic!("Could not generate keys")); - println!("sst_demo::gen_key_subtree(): node value: {:?}", node_pubkey); - let private_key_filename = get_private_key_name(&keyname); + //println!("sst_demo::gen_key_subtree(): node value: {:?}", node_pubkey); + let private_key_filename = get_private_key_filename(&(keyname + "." + &ssts_param.get_entity_idx().to_string())); write(private_key_filename.as_str(), signing_key.as_slice())?; // write own node value and signing instance to file // TODO maybe also HSS/LMS/LM-OTS parameters, to ensure that we got the same parameters among all signing instances let interm_node_filename = - String::from("node_si") + &(ssts_param.get_entity_idx().to_string()) + &String::from(".bin"); + String::from("node_si") + &(ssts_param.get_entity_idx().to_string()) + &String::from(".bin"); // TODO into function // if file exists, overwrite write(interm_node_filename.as_str(), &ssts_param.get_entity_idx().to_be_bytes())?; - // append + // and append let mut interm_node_file = OpenOptions::new() .create(true) .write(true) @@ -382,17 +373,81 @@ fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> fn gen_key_ssts(args: &ArgMatches) -> Result<(), Box> { - // TODO 2nd call for verifying key! -> move to dofferent function! - // we have to break here to get the params for the key generation second step (i.e. whole tree generation) + // get signing instance number and name of private keyfile from args + let keyname: String = get_parameter(ARG_KEYNAME, args); + let signing_instance: String = get_parameter(ARG_SI_PARAMETER, args); - //let public_key_filename = get_public_key_name(&keyname); + println!("keyname: {} -- SI: {}", keyname, signing_instance); - let keyname = get_parameter(ARG_KEYNAME, args); - let private_key_name = get_private_key_name(&keyname); + // read private key + let private_key_name = get_private_key_filename(&( + keyname.clone() + "." + &signing_instance.to_string())); let private_key_data = read_file(&private_key_name); - let aux_data_name = get_aux_name(&keyname); - let mut aux_data = read(aux_data_name).ok(); + + // (here so far we only had the structs "SigningKey" and "VerifyingKey" -> leave it at that if possible) + // read HSS configuration from key -> how many SI and LMS config (tree height...) + + let (ssts_param, lms_tree_ident) = get_config::(&private_key_data) + .unwrap_or_else(|_| panic!("genkey step 2: invalid config")); + + println!("lms_tree_ident: {:?}", lms_tree_ident); + + + // TODO maybe compare with HSS configuration in the "node files" + // read intermediate node values from files (ours and others) and pass for calc. + let num_signing_entities = 2u32.pow(ssts_param.get_top_height() as u32); + //let mut vec_intermed_nodes = Vec::new(); + let mut node_array: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]> = Default::default(); + + for idx in 1..=num_signing_entities { + let interm_node_filename = + String::from("node_si") + &(idx.to_string()) + &String::from(".bin"); // TODO into function + + //println!("read intermediate node value for signing entity num {}", idx); + let file_data: Vec = read_file(&interm_node_filename); + if file_data.len() != (1 + MAX_HASH_SIZE) { + panic!("genkey step 2: file data len is {}, should be {}", file_data.len(), (1 + MAX_HASH_SIZE)); + } + //println!("node data: {:?}", file_data); + //vec_intermed_nodes.push(file_data); + // let mut node: ArrayVec<[u8; MAX_HASH_SIZE]> = Default::default(); + //node.push(file_data[1..]); // TODO easier? + // TODO that works but is probably a really bad solution + + let mut node: [u8; MAX_HASH_SIZE] = [0; MAX_HASH_SIZE]; + node.copy_from_slice(&file_data[1..]); // TODO easier? + node_array.push(node.into()); + + //node_array[(idx-1) as usize].extend(&file_data[1..]); + + } + + // TODO not nice: + // either copy the elements of Vec into ArrayVec for the library code, but then we'd need t reserve lots of possibly unused memory + + + for node in node_array { + println!("node: {:?}", node); + } + + + // let's try to use it as ref-slices-references? as in lms-demo + // let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; + // where aux_data is Vec + let _pubkey = gen_pub_key::(&node_array, ssts_param.get_top_height(), lms_tree_ident); + println!("pub key (node 1) hash value: {:?}", _pubkey); + + // VerifyingKey ? + //let intermediate_nodes = ArrayVec diff --git a/src/constants.rs b/src/constants.rs index c5e9d13f..e439e1b4 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -66,6 +66,10 @@ pub const MAX_HSS_SIGNED_PUBLIC_KEY_LENGTH: usize = hss_signed_public_key_length(MAX_HASH_SIZE, MAX_HASH_CHAIN_COUNT, MAX_TREE_HEIGHT); pub const MAX_HSS_SIGNATURE_LENGTH: usize = get_hss_signature_length(); +// DSM = Distributedt State Management +pub const _MAX_DSM_TOP_TREE_HEIGHT: usize = 8; +pub const MAX_DSM_SIGNING_ENTITIES: usize = 256; // TODO calc via 2^MAX_DSM_TOP_TREE_HEIGHT + /// Calculated using the formula from RFC 8554 Appendix B /// https://datatracker.ietf.org/doc/html/rfc8554#appendix-B const HASH_CHAIN_COUNTS: [usize; 12] = [136, 200, 265, 68, 101, 133, 35, 51, 67, 18, 26, 34]; diff --git a/src/lib.rs b/src/lib.rs index a3d17b51..5b9d557d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -122,7 +122,7 @@ pub use crate::hss::{SigningKey, VerifyingKey}; // @TODO: Re-export: API for distributed state management (SST, SingleSubTree) pub use crate::sst::*; // {gen_key, sign, verify}; pub use crate::sst::parameters::SstsParameter; - +pub use crate::constants::MAX_DSM_SIGNING_ENTITIES; use core::convert::TryFrom; use signature::Error; diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index 331bf833..779a6504 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -1,3 +1,4 @@ +use crate::constants::LmsTreeIdentifier; use crate::signature::Error; use crate::{ sst::{ @@ -11,11 +12,10 @@ use crate::{ reference_impl_private_key::{Seed, ReferenceImplPrivateKey}, definitions::HssPublicKey, SigningKey, - //VerifyingKey, }, lms::helper::get_tree_element, lms::definitions::LmsPrivateKey, - constants::MAX_HASH_SIZE, + constants::{MAX_HASH_SIZE, MAX_DSM_SIGNING_ENTITIES, D_INTR}, }; use tinyvec::ArrayVec; @@ -100,7 +100,75 @@ pub fn gen_sst_pubkey() -> Result<(), Error> { } */ -// -> shall be replaced by "sst_keygen()" +pub fn get_config(private_key: &[u8]) + -> Result<(SstsParameter, LmsTreeIdentifier), Error> +{ + let rfc_private_key = ReferenceImplPrivateKey::::from_binary_representation(private_key) + .map_err(|_| Error::new())?; + + let hss_pubkey = HssPublicKey::from(&rfc_private_key, None).map_err(|_| Error::new())?; + let lms_tree_ident = hss_pubkey.public_key.lms_tree_identifier; + + let hss_param_vec = rfc_private_key.compressed_parameter + .to() + .map_err(|_| Error::new())?; + + let ssts_param = SstsParameter::new( + hss_param_vec, + rfc_private_key.sst_ext.top_tree_height, + rfc_private_key.sst_ext.signing_instance + ); + + Ok((ssts_param, lms_tree_ident)) +} + +pub fn gen_pub_key( + av_of_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, + top_tree_height: u8, + lms_tree_ident: LmsTreeIdentifier +) -> Result, Error> { + + let pubkey = get_node_hash_val::(1, av_of_nodes, top_tree_height, lms_tree_ident); + + Ok(pubkey) +} + +fn get_node_hash_val( + index: u32, + av_of_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, + top_tree_height: u8, + lms_tree_ident: LmsTreeIdentifier +) -> ArrayVec<[u8; MAX_HASH_SIZE]> { + + let index_level = (core::mem::size_of_val(&index) * 8 - index.leading_zeros() as usize - 1) as u8; + + let hasher = H::default() + .chain(lms_tree_ident) + .chain((index as u32).to_be_bytes()); + + // if index is at lowest level (where we have the signing entity node hash values) + let result = + if index_level == top_tree_height { + // return the node value from array of intermedediate node hash values + /* access vector elements via "leaf numbers" = 0..signing_entites-1 */ + let leaf_number = (index as usize ) - 2usize.pow(top_tree_height as u32); + av_of_nodes[leaf_number] + } else { + // we are "above" the intermediate node hash values -> go down + let left = get_node_hash_val::(index * 2, av_of_nodes, top_tree_height, lms_tree_ident); + let right = get_node_hash_val::(index * 2 + 1, av_of_nodes, top_tree_height, lms_tree_ident); + + hasher + .chain(D_INTR) + .chain(left.as_slice()) + .chain(right.as_slice()) + .finalize() + }; + + return result +} + + pub fn gen_sst_pubkey(_private_key: &[u8], _aux_data: Option<&mut &mut [u8]>) // -> Result<(VerifyingKey), Error> { diff --git a/src/sst/mod.rs b/src/sst/mod.rs index b87b82d5..9ef878b0 100644 --- a/src/sst/mod.rs +++ b/src/sst/mod.rs @@ -10,7 +10,10 @@ mod verify; pub use verify::*; // @TODO how to allow "helper" for "lms", but not in API? -pub mod helper; -pub use helper::*; +pub(crate) mod helper; +//pub use helper::*; +// inside crate make public +//pub(super) mod parameters; +// outside crate only limmited pub mod parameters; From bc1a178a9e25e48b1bf2bb1176f992b3bfeddd26 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Sun, 14 Jan 2024 20:12:11 +0100 Subject: [PATCH 24/43] sst: use constant, tag unused symbols (_) --- src/sst/helper.rs | 20 ++++++++++---------- src/sst/sign.rs | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/sst/helper.rs b/src/sst/helper.rs index 53d81aa5..50bee952 100644 --- a/src/sst/helper.rs +++ b/src/sst/helper.rs @@ -27,17 +27,17 @@ pub fn get_sst_last_leaf_idx(signing_entity_idx: u8, total_height: u8, top_div: // For a subtree, depending on whole SSTS and division, get first leaf idx on whole SSTS -pub fn get_sst_first_leaf_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { +pub fn _get_sst_first_leaf_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level 2u32.pow(total_height as u32) + (((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div)) as u32 } // For a subtree, depending on whole SSTS and division, get last leaf idx on whole SSTS -pub fn get_sst_last_leaf_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { +pub fn _get_sst_last_leaf_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level - get_sst_first_leaf_node_idx(signing_entity_idx, total_height, top_div) - 1 + get_num_leaves_in_sst(total_height, top_div) + _get_sst_first_leaf_node_idx(signing_entity_idx, total_height, top_div) - 1 + get_num_leaves_in_sst(total_height, top_div) } // number of leaves of a Merkle tree @@ -125,44 +125,44 @@ mod tests { #[test] fn test_get_sst_first_leaf_idx_1() { - let first_leaf_idx = get_sst_first_leaf_node_idx(1, 5, 3); + let first_leaf_idx = _get_sst_first_leaf_node_idx(1, 5, 3); assert_eq!(32, first_leaf_idx); } #[test] fn test_get_sst_first_leaf_idx_2() { - let first_leaf_idx = get_sst_first_leaf_node_idx(3, 5, 3); + let first_leaf_idx = _get_sst_first_leaf_node_idx(3, 5, 3); assert_eq!(40, first_leaf_idx); } #[test] fn test_get_sst_first_leaf_idx_3() { - let first_leaf_idx = get_sst_first_leaf_node_idx(8, 5, 3); + let first_leaf_idx = _get_sst_first_leaf_node_idx(8, 5, 3); assert_eq!(60, first_leaf_idx); } #[test] fn test_get_sst_last_leaf_idx_1() { - let last_leaf_idx = get_sst_last_leaf_node_idx(1, 5, 3); + let last_leaf_idx = _get_sst_last_leaf_node_idx(1, 5, 3); assert_eq!(35, last_leaf_idx); } #[test] fn test_get_sst_last_leaf_idx_2() { - let last_leaf_idx = get_sst_last_leaf_node_idx(3, 5, 3); + let last_leaf_idx = _get_sst_last_leaf_node_idx(3, 5, 3); assert_eq!(43, last_leaf_idx); } #[test] fn test_get_sst_last_leaf_idx_3() { - let last_leaf_idx = get_sst_last_leaf_node_idx(8, 5, 3); + let last_leaf_idx = _get_sst_last_leaf_node_idx(8, 5, 3); assert_eq!(63, last_leaf_idx); } #[test] #[should_panic] fn test_get_sst_last_leaf_idx_4() { - let last_leaf_idx = get_sst_last_leaf_node_idx(9, 5, 3); + let last_leaf_idx = _get_sst_last_leaf_node_idx(9, 5, 3); assert_eq!(63, last_leaf_idx); } diff --git a/src/sst/sign.rs b/src/sst/sign.rs index 4ce30ae4..41e75d5a 100644 --- a/src/sst/sign.rs +++ b/src/sst/sign.rs @@ -1,14 +1,14 @@ use crate::signature::Error; use crate::constants::Node; +use crate::constants::MAX_HASH_SIZE; use crate::hss::signing::HssSignature; use crate::HashChain; use tinyvec::ArrayVec; pub struct SstsSignature { pub hss_signature: HssSignature, - // use an ArrayVec with a @TODO max size? pub our_node: Node, - pub auth_path: ArrayVec<[Node; 32]>, // order: sort on-the-fly dep. on Node's values? + pub auth_path: ArrayVec<[Node; MAX_HASH_SIZE]>, // order: sort on-the-fly dep. on Node's values? } pub fn sign( From 96fcb475733b122e3795722cced556dd8488987f Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Sun, 14 Jan 2024 21:23:32 +0100 Subject: [PATCH 25/43] sst: apply rustfmt; use SI idx for filenames --- benches/mod.rs | 63 ++++++++++----- examples/sst_demo.rs | 111 +++++++++++--------------- src/constants.rs | 6 +- src/hss/aux.rs | 5 +- src/hss/definitions.rs | 35 +++++--- src/hss/mod.rs | 11 +-- src/hss/reference_impl_private_key.rs | 25 +++--- src/hss/signing.rs | 14 +--- src/hss/verify.rs | 11 +-- src/lib.rs | 39 +++++---- src/lms/definitions.rs | 20 ++--- src/lms/mod.rs | 2 +- src/lms/verify.rs | 2 +- src/sst/gen_key.rs | 72 ++++++++--------- src/sst/helper.rs | 13 ++- src/sst/parameters.rs | 27 +++---- src/sst/sign.rs | 6 +- src/sst/verify.rs | 6 +- tests/reference_implementation.rs | 14 ++-- 19 files changed, 231 insertions(+), 251 deletions(-) diff --git a/benches/mod.rs b/benches/mod.rs index ac82a07f..315ecaac 100644 --- a/benches/mod.rs +++ b/benches/mod.rs @@ -7,12 +7,12 @@ mod tests { use test::Bencher; use tinyvec::ArrayVec; + use hbs_lms::sst::parameters::SstsParameter; use hbs_lms::{keygen, HssParameter, LmotsAlgorithm, LmsAlgorithm, Seed, Sha256_256}; use hbs_lms::{ signature::{SignerMut, Verifier}, Signature, SigningKey, VerifierSignature, VerifyingKey, }; - use hbs_lms::sst::parameters::SstsParameter; const MESSAGE: [u8; 17] = [ 32u8, 48, 2, 1, 48, 58, 20, 57, 9, 83, 99, 255, 0, 34, 2, 1, 0, @@ -25,7 +25,8 @@ mod tests { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); - let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = + Default::default(); for i in 0..hss_parameter.len() { vec_hss_params.push(hss_parameter[i]); } @@ -41,16 +42,16 @@ mod tests { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); - let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); - vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = + Default::default(); + vec_hss_params.push(HssParameter::new( + LmotsAlgorithm::LmotsW2, + LmsAlgorithm::LmsH5, + )); let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); - let (mut signing_key, verifying_key) = keygen::( - &sst_param, - &seed, - None, - ) - .unwrap(); + let (mut signing_key, verifying_key) = + keygen::(&sst_param, &seed, None).unwrap(); let signature = signing_key.try_sign(&MESSAGE).unwrap(); @@ -61,8 +62,12 @@ mod tests { fn keygen_h5w2(b: &mut Bencher) { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); - let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); - vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = + Default::default(); + vec_hss_params.push(HssParameter::new( + LmotsAlgorithm::LmotsW2, + LmsAlgorithm::LmsH5, + )); let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); b.iter(|| { @@ -75,8 +80,12 @@ mod tests { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); - let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); - vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = + Default::default(); + vec_hss_params.push(HssParameter::new( + LmotsAlgorithm::LmotsW2, + LmsAlgorithm::LmsH5, + )); let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); b.iter(|| { @@ -92,9 +101,16 @@ mod tests { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); - let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); - vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); - vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = + Default::default(); + vec_hss_params.push(HssParameter::new( + LmotsAlgorithm::LmotsW2, + LmsAlgorithm::LmsH5, + )); + vec_hss_params.push(HssParameter::new( + LmotsAlgorithm::LmotsW2, + LmsAlgorithm::LmsH5, + )); let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); b.iter(|| { @@ -107,9 +123,16 @@ mod tests { let mut seed = Seed::default(); OsRng.fill_bytes(seed.as_mut_slice()); - let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); - vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); - vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = + Default::default(); + vec_hss_params.push(HssParameter::new( + LmotsAlgorithm::LmotsW2, + LmsAlgorithm::LmsH5, + )); + vec_hss_params.push(HssParameter::new( + LmotsAlgorithm::LmotsW2, + LmsAlgorithm::LmsH5, + )); let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); b.iter(|| { diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 23e86752..dc4bec97 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -59,9 +59,7 @@ impl GenKeyParameter { } } - fn main() -> Result<(), Box> { - /* let message = [32; 0]; // 32 elements init. with 0 @@ -115,7 +113,9 @@ fn main() -> Result<(), Box> { if let Some(args) = matches.subcommand_matches(GENSUBTREE_COMMAND) { gen_key_subtree(args)?; - println!("Single-subtree-structure: intermediate node and private key successfully generated!"); + println!( + "Single-subtree-structure: intermediate node and private key successfully generated!" + ); return Ok(()); } @@ -152,18 +152,19 @@ fn main() -> Result<(), Box> { Ok(()) } - fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { let keyname = get_parameter(ARG_KEYNAME, args); let message_name = get_parameter(ARG_MESSAGE, args); - let private_key_name = get_private_key_filename(&keyname); + // TODO signing entity idx + let private_key_name = get_private_key_filename(&keyname, 1); let signature_name = get_signature_filename(&message_name); let private_key_data = read_file(&private_key_name); let message_data = read_file(&message_name); - let aux_data_name = get_aux_filename(&keyname); + // TODO signing entity idx + let aux_data_name = get_aux_filename(&keyname, 1); let mut aux_data = read(aux_data_name).ok(); let mut private_key_update_function = |new_key: &[u8]| { @@ -264,7 +265,8 @@ fn verify(args: &ArgMatches) -> bool { let keyname: String = get_parameter(ARG_KEYNAME, args); let message_name: String = get_parameter(ARG_MESSAGE, args); - let public_key_name = get_public_key_filename(&keyname); + // TODO: signing entity idx + let public_key_name = get_public_key_filename(&keyname, 1); let signature_name = get_signature_filename(&message_name); let signature_data = read_file(&signature_name); @@ -274,8 +276,8 @@ fn verify(args: &ArgMatches) -> bool { hbs_lms::verify::(&message_data, &signature_data, &public_key_data).is_ok() } -fn get_public_key_filename(keyname: &str) -> String { - keyname.to_string() + ".pub" +fn get_public_key_filename(keyname: &str, idx: u8) -> String { + keyname.to_string() + &idx.to_string() + ".pub" } fn get_signature_filename(message_name: &str) -> String { @@ -292,12 +294,12 @@ fn get_message_mut_filename(message_name: &str) -> String { message_name.to_string() + "_mut" } -fn get_private_key_filename(private_key: &str) -> String { - private_key.to_string() + ".prv" +fn get_private_key_filename(private_key: &str, idx: u8) -> String { + private_key.to_string() + &idx.to_string() + "." + ".prv" } -fn get_aux_filename(keyname: &str) -> String { - keyname.to_string() + ".aux" +fn get_aux_filename(keyname: &str, idx: u8) -> String { + keyname.to_string() + &idx.to_string() + ".aux" } fn get_parameter(name: &str, args: &ArgMatches) -> String { @@ -320,7 +322,6 @@ fn read_file(file_name: &str) -> Vec { fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> { let keyname: String = get_parameter(ARG_KEYNAME, args); - let genkey_parameter = parse_genkey1_parameter(&get_parameter(ARG_SSTS_PARAMETER, args)); let ssts_param = genkey_parameter.ssts_param; @@ -344,20 +345,24 @@ fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> // TODO should we generate aux data here or in next step -- or in both? // create our private key - let (signing_key, node_pubkey) = gen_sst_subtree(&ssts_param, &seed) - .unwrap_or_else(|_| panic!("Could not generate keys")); + let (signing_key, node_pubkey) = + gen_sst_subtree(&ssts_param, &seed).unwrap_or_else(|_| panic!("Could not generate keys")); //println!("sst_demo::gen_key_subtree(): node value: {:?}", node_pubkey); - let private_key_filename = get_private_key_filename(&(keyname + "." + &ssts_param.get_entity_idx().to_string())); + let private_key_filename = get_private_key_filename(&keyname, ssts_param.get_entity_idx()); write(private_key_filename.as_str(), signing_key.as_slice())?; // write own node value and signing instance to file // TODO maybe also HSS/LMS/LM-OTS parameters, to ensure that we got the same parameters among all signing instances - let interm_node_filename = - String::from("node_si") + &(ssts_param.get_entity_idx().to_string()) + &String::from(".bin"); // TODO into function + let interm_node_filename = String::from("node_si") + + &(ssts_param.get_entity_idx().to_string()) + + &String::from(".bin"); // TODO into function // if file exists, overwrite - write(interm_node_filename.as_str(), &ssts_param.get_entity_idx().to_be_bytes())?; + write( + interm_node_filename.as_str(), + &ssts_param.get_entity_idx().to_be_bytes(), + )?; // and append let mut interm_node_file = OpenOptions::new() .create(true) @@ -370,9 +375,7 @@ fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> Ok(()) } - fn gen_key_ssts(args: &ArgMatches) -> Result<(), Box> { - // get signing instance number and name of private keyfile from args let keyname: String = get_parameter(ARG_KEYNAME, args); let signing_instance: String = get_parameter(ARG_SI_PARAMETER, args); @@ -380,11 +383,10 @@ fn gen_key_ssts(args: &ArgMatches) -> Result<(), Box> { println!("keyname: {} -- SI: {}", keyname, signing_instance); // read private key - let private_key_name = get_private_key_filename(&( - keyname.clone() + "." + &signing_instance.to_string())); + let private_key_name = + get_private_key_filename(&keyname, signing_instance.parse::().unwrap()); let private_key_data = read_file(&private_key_name); - // (here so far we only had the structs "SigningKey" and "VerifyingKey" -> leave it at that if possible) // read HSS configuration from key -> how many SI and LMS config (tree height...) @@ -393,12 +395,12 @@ fn gen_key_ssts(args: &ArgMatches) -> Result<(), Box> { println!("lms_tree_ident: {:?}", lms_tree_ident); - // TODO maybe compare with HSS configuration in the "node files" // read intermediate node values from files (ours and others) and pass for calc. let num_signing_entities = 2u32.pow(ssts_param.get_top_height() as u32); //let mut vec_intermed_nodes = Vec::new(); - let mut node_array: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]> = Default::default(); + let mut node_array: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]> = + Default::default(); for idx in 1..=num_signing_entities { let interm_node_filename = @@ -407,34 +409,23 @@ fn gen_key_ssts(args: &ArgMatches) -> Result<(), Box> { //println!("read intermediate node value for signing entity num {}", idx); let file_data: Vec = read_file(&interm_node_filename); if file_data.len() != (1 + MAX_HASH_SIZE) { - panic!("genkey step 2: file data len is {}, should be {}", file_data.len(), (1 + MAX_HASH_SIZE)); + panic!( + "genkey step 2: file data len is {}, should be {}", + file_data.len(), + (1 + MAX_HASH_SIZE) + ); } - //println!("node data: {:?}", file_data); - //vec_intermed_nodes.push(file_data); + // let mut node: ArrayVec<[u8; MAX_HASH_SIZE]> = Default::default(); - //node.push(file_data[1..]); // TODO easier? + // node.push(file_data[1..]); // TODO easier? // TODO that works but is probably a really bad solution let mut node: [u8; MAX_HASH_SIZE] = [0; MAX_HASH_SIZE]; node.copy_from_slice(&file_data[1..]); // TODO easier? node_array.push(node.into()); - //node_array[(idx-1) as usize].extend(&file_data[1..]); - - } - - // TODO not nice: - // either copy the elements of Vec into ArrayVec for the library code, but then we'd need t reserve lots of possibly unused memory - - - for node in node_array { - println!("node: {:?}", node); } - - // let's try to use it as ref-slices-references? as in lms-demo - // let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; - // where aux_data is Vec let _pubkey = gen_pub_key::(&node_array, ssts_param.get_top_height(), lms_tree_ident); println!("pub key (node 1) hash value: {:?}", _pubkey); @@ -445,8 +436,7 @@ fn gen_key_ssts(args: &ArgMatches) -> Result<(), Box> { //let public_key_filename = get_public_key_name(&keyname); - - let aux_data_name = get_aux_filename(&keyname); + let aux_data_name = get_aux_filename(&keyname, signing_instance.parse::().unwrap()); let mut _aux_data = read(aux_data_name).ok(); //let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; @@ -455,12 +445,12 @@ fn gen_key_ssts(args: &ArgMatches) -> Result<(), Box> { //write(public_key_filename.as_str(), verifying_key.as_slice())?; - Ok(()) } -fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { - let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); +fn parse_genkey1_parameter(parameter: &str) -> GenKeyParameter { + let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = + Default::default(); let mut aux_data_size: Option = None; @@ -485,19 +475,12 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { let mut is_first_loop = true; for parameter in parameters { - let mut splitted = parameter.split('/'); - let height = splitted - .next() - .expect("Merkle tree height invalid"); - let winternitz_parameter = splitted - .next() - .expect("Winternitz parameter invalid"); + let height = splitted.next().expect("Merkle tree height invalid"); + let winternitz_parameter = splitted.next().expect("Winternitz parameter invalid"); - let height: u8 = height - .parse() - .expect("Merkle tree height invalid"); + let height: u8 = height.parse().expect("Merkle tree height invalid"); let winternitz_parameter: u8 = winternitz_parameter .parse() .expect("Winternitz parameter not correct specified"); @@ -510,13 +493,9 @@ fn parse_genkey_parameter(parameter: &str) -> GenKeyParameter { .next() .expect("Top part height provided, but signing entity number missing."); // @TODO check: invalid if "height - top_part_height < 1" - top_part_height = s_top_part_height - .parse() - .expect("Top part height invalid"); + top_part_height = s_top_part_height.parse().expect("Top part height invalid"); // @TODO check: invalid if ...dep. on height and top_part_height - entity_idx = s_entity_idx - .parse() - .expect("Signing entity index invalid"); + entity_idx = s_entity_idx.parse().expect("Signing entity index invalid"); } } diff --git a/src/constants.rs b/src/constants.rs index e439e1b4..f50b02c4 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -42,8 +42,10 @@ pub const fn prng_len(seed_len: usize) -> usize { pub const LMS_LEAF_IDENTIFIERS_SIZE: usize = 8; pub const REF_IMPL_MAX_ALLOWED_HSS_LEVELS: usize = 8; pub const REF_IMPL_SSTS_EXT_SIZE: usize = 2; -pub const REF_IMPL_MAX_PRIVATE_KEY_SIZE: usize = - REF_IMPL_SSTS_EXT_SIZE + LMS_LEAF_IDENTIFIERS_SIZE + REF_IMPL_MAX_ALLOWED_HSS_LEVELS + MAX_SEED_LEN; +pub const REF_IMPL_MAX_PRIVATE_KEY_SIZE: usize = REF_IMPL_SSTS_EXT_SIZE + + LMS_LEAF_IDENTIFIERS_SIZE + + REF_IMPL_MAX_ALLOWED_HSS_LEVELS + + MAX_SEED_LEN; pub const MAX_HASH_SIZE: usize = 32; pub const MAX_HASH_BLOCK_SIZE: usize = 64; diff --git a/src/hss/aux.rs b/src/hss/aux.rs index beef1cd5..410c1fd1 100644 --- a/src/hss/aux.rs +++ b/src/hss/aux.rs @@ -262,9 +262,9 @@ fn compute_hmac(key: &[u8], data: &[u8]) -> ArrayVec<[u8; MAX_HASH #[cfg(test)] mod tests { + use crate::constants; use crate::hasher::sha256::Sha256_256; use crate::util::helper::test_helper::gen_random_seed; - use crate::constants; use crate::SstsParameter; use crate::{ constants::MAX_HASH_SIZE, @@ -282,7 +282,8 @@ mod tests { let lmots = LmotsAlgorithm::LmotsW2; let lms = LmsAlgorithm::LmsH5; - let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = + Default::default(); vec_hss_params.push(HssParameter::new(lmots, lms)); vec_hss_params.push(HssParameter::new(lmots, lms)); let sst_param = SstsParameter::new(vec_hss_params, 0, 0); diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index 5ab5068b..987d9a86 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -14,7 +14,8 @@ use crate::{ generate_key_pair, parameters::LmsParameter, }, - util::helper::read_and_advance, parameters::SstExtension, + parameters::SstExtension, + util::helper::read_and_advance, }; use crate::{hss::aux::hss_get_aux_data_len, lms::signing::LmsSignature}; @@ -77,8 +78,13 @@ impl HssPrivateKey { let signature_randomizer = generate_signature_randomizer::(¤t_seed, &parent_used_leafs_index); - let lms_keypair = - generate_key_pair(¤t_seed, parameter, &used_leafs_indexes[i], &mut None, None); + let lms_keypair = generate_key_pair( + ¤t_seed, + parameter, + &used_leafs_indexes[i], + &mut None, + None, + ); let signature = lms::signing::LmsSignature::sign( &mut hss_private_key.private_key[i - 1], @@ -200,7 +206,7 @@ impl HssPublicKey { ¶meters[0], &used_leafs_indexes[0], &mut expanded_aux_data, - sst_ext_option + sst_ext_option, ); if let Some(expanded_aux_data) = expanded_aux_data.as_mut() { @@ -246,21 +252,21 @@ impl<'a, H: HashChain> InMemoryHssPublicKey<'a, H> { mod tests { use rand::{rngs::OsRng, RngCore}; - use crate::SstsParameter; use crate::util::helper::test_helper::gen_random_seed; + use crate::SstsParameter; use crate::{ hasher::sha256::Sha256_256, hss::{ definitions::InMemoryHssPublicKey, reference_impl_private_key::{ReferenceImplPrivateKey, SeedAndLmsTreeIdentifier}, - HashChain + HashChain, }, - lms, LmotsAlgorithm, LmsAlgorithm, HssParameter, + lms, HssParameter, LmotsAlgorithm, LmsAlgorithm, }; - use tinyvec::ArrayVec; - use crate::constants; use super::{HssPrivateKey, HssPublicKey}; + use crate::constants; + use tinyvec::ArrayVec; #[test] fn child_tree_lms_leaf_update() { @@ -329,7 +335,8 @@ mod tests { ) -> (HssPrivateKey, HssPrivateKey) { let lmots = LmotsAlgorithm::LmotsW4; let lms = LmsAlgorithm::LmsH2; - let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = + Default::default(); vec_hss_params.push(HssParameter::::new(lmots, lms)); vec_hss_params.push(HssParameter::::new(lmots, lms)); vec_hss_params.push(HssParameter::::new(lmots, lms)); @@ -356,7 +363,8 @@ mod tests { let lmots = LmotsAlgorithm::LmotsW4; let lms = LmsAlgorithm::LmsH2; - let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = + Default::default(); vec_hss_params.push(HssParameter::::new(lmots, lms)); vec_hss_params.push(HssParameter::::new(lmots, lms)); vec_hss_params.push(HssParameter::::new(lmots, lms)); @@ -392,7 +400,8 @@ mod tests { let lmots = LmotsAlgorithm::LmotsW4; let lms = LmsAlgorithm::LmsH2; - let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = + Default::default(); vec_hss_params.push(HssParameter::::new(lmots, lms)); vec_hss_params.push(HssParameter::::new(lmots, lms)); let sst_param = SstsParameter::new(vec_hss_params, 0, 0); @@ -414,7 +423,7 @@ mod tests { &HssParameter::construct_default_parameters(), &0, &mut None, - None + None, ); let public_key: HssPublicKey = HssPublicKey { level: 18, diff --git a/src/hss/mod.rs b/src/hss/mod.rs index 91f51b9e..f6df60b1 100644 --- a/src/hss/mod.rs +++ b/src/hss/mod.rs @@ -6,7 +6,6 @@ mod seed_derive; pub mod signing; pub mod verify; - use core::{convert::TryFrom, marker::PhantomData}; use tinyvec::ArrayVec; @@ -292,6 +291,7 @@ pub fn hss_keygen( #[cfg(test)] mod tests { + use super::parameter::HssParameter; use crate::util::helper::test_helper::gen_random_seed; use crate::{ constants::{LMS_LEAF_IDENTIFIERS_SIZE, MAX_HASH_SIZE, REF_IMPL_MAX_ALLOWED_HSS_LEVELS}, @@ -302,7 +302,6 @@ mod tests { }, LmotsAlgorithm, LmsAlgorithm, }; - use super::parameter::HssParameter; use super::*; @@ -524,12 +523,8 @@ mod tests { vec_hss_params.push(HssParameter::construct_default_parameters()); let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); - let (mut signing_key, verifying_key) = hss_keygen::( - &sst_param, - &seed, - None, - ) - .expect("Should generate HSS keys"); + let (mut signing_key, verifying_key) = + hss_keygen::(&sst_param, &seed, None).expect("Should generate HSS keys"); let message_values = [ 32u8, 48, 2, 1, 48, 58, 20, 57, 9, 83, 99, 255, 0, 34, 2, 1, 0, diff --git a/src/hss/reference_impl_private_key.rs b/src/hss/reference_impl_private_key.rs index 47e2e7c7..c176d9b2 100644 --- a/src/hss/reference_impl_private_key.rs +++ b/src/hss/reference_impl_private_key.rs @@ -1,18 +1,18 @@ use crate::{ constants::{ LmsTreeIdentifier, D_TOPSEED, ILEN, LMS_LEAF_IDENTIFIERS_SIZE, MAX_ALLOWED_HSS_LEVELS, - MAX_HASH_SIZE, MAX_SEED_LEN, REF_IMPL_MAX_PRIVATE_KEY_SIZE, SEED_CHILD_SEED, - SEED_SIGNATURE_RANDOMIZER_SEED, TOPSEED_D, TOPSEED_LEN, TOPSEED_SEED, TOPSEED_WHICH, - REF_IMPL_SSTS_EXT_SIZE, + MAX_HASH_SIZE, MAX_SEED_LEN, REF_IMPL_MAX_PRIVATE_KEY_SIZE, REF_IMPL_SSTS_EXT_SIZE, + SEED_CHILD_SEED, SEED_SIGNATURE_RANDOMIZER_SEED, TOPSEED_D, TOPSEED_LEN, TOPSEED_SEED, + TOPSEED_WHICH, }, hasher::HashChain, hss::{definitions::HssPrivateKey, seed_derive::SeedDerive}, - util::{helper::read_and_advance, ArrayVecZeroize}, - HssParameter, LmotsAlgorithm, LmsAlgorithm, sst::{ helper, parameters::{SstExtension, SstsParameter}, - } + }, + util::{helper::read_and_advance, ArrayVecZeroize}, + HssParameter, LmotsAlgorithm, LmsAlgorithm, }; use core::{convert::TryFrom, convert::TryInto, marker::PhantomData}; @@ -117,7 +117,8 @@ impl ReferenceImplPrivateKey { used_leafs_index = helper::get_sst_first_leaf_idx( sst_ext.signing_instance, top_lms_parameter.get_tree_height(), - sst_ext.top_tree_height); + sst_ext.top_tree_height, + ); } let private_key: ReferenceImplPrivateKey = ReferenceImplPrivateKey { @@ -361,14 +362,12 @@ impl CompressedUsedLeafsIndexes { #[cfg(test)] mod tests { use super::{CompressedParameterSet, ReferenceImplPrivateKey}; + use crate::util::helper::test_helper::gen_random_seed; + use crate::SstsParameter; use crate::{ - constants::MAX_ALLOWED_HSS_LEVELS, - constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS, - hss::definitions::HssPrivateKey, HssParameter, - LmotsAlgorithm, LmsAlgorithm, Sha256_256, + constants::MAX_ALLOWED_HSS_LEVELS, constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS, + hss::definitions::HssPrivateKey, HssParameter, LmotsAlgorithm, LmsAlgorithm, Sha256_256, }; - use crate::SstsParameter; - use crate::util::helper::test_helper::gen_random_seed; use tinyvec::ArrayVec; type Hasher = Sha256_256; diff --git a/src/hss/signing.rs b/src/hss/signing.rs index d5eed969..72d03dad 100644 --- a/src/hss/signing.rs +++ b/src/hss/signing.rs @@ -280,11 +280,7 @@ mod tests { vec_hss_params.push(HssParameter::construct_default_parameters()); let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); - let private_key = ReferenceImplPrivateKey::::generate( - &sst_param, - &seed, - ) - .unwrap(); + let private_key = ReferenceImplPrivateKey::::generate(&sst_param, &seed).unwrap(); let mut private_key = HssPrivateKey::from(&private_key, &mut None).unwrap(); @@ -308,7 +304,7 @@ mod tests { &HssParameter::construct_default_parameters(), &0, &mut None, - None + None, ); let message = [3, 54, 32, 45, 67, 32, 12, 58, 29, 49]; @@ -344,11 +340,7 @@ mod tests { vec_hss_params.push(HssParameter::construct_default_parameters()); let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); - let private_key = ReferenceImplPrivateKey::::generate( - &sst_param, - &seed, - ) - .unwrap(); + let private_key = ReferenceImplPrivateKey::::generate(&sst_param, &seed).unwrap(); let mut private_key = HssPrivateKey::from(&private_key, &mut None).unwrap(); diff --git a/src/hss/verify.rs b/src/hss/verify.rs index b2aca256..8d49b5ec 100644 --- a/src/hss/verify.rs +++ b/src/hss/verify.rs @@ -30,6 +30,8 @@ pub fn verify<'a, H: HashChain>( #[cfg(test)] mod tests { + use crate::constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS; + use crate::util::helper::test_helper::gen_random_seed; use crate::{ hasher::{sha256::Sha256_256, HashChain}, hss::{ @@ -41,8 +43,6 @@ mod tests { sst::parameters::SstsParameter, HssParameter, }; - use crate::constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS; - use crate::util::helper::test_helper::gen_random_seed; use tinyvec::ArrayVec; @@ -56,12 +56,7 @@ mod tests { vec_hss_params.push(HssParameter::construct_default_parameters()); let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); - - let rfc_key = ReferenceImplPrivateKey::::generate( - &sst_param, - &seed, - ) - .unwrap(); + let rfc_key = ReferenceImplPrivateKey::::generate(&sst_param, &seed).unwrap(); let mut private_key = HssPrivateKey::from(&rfc_key, &mut None).unwrap(); let public_key = HssPublicKey::from(&rfc_key, None).unwrap(); diff --git a/src/lib.rs b/src/lib.rs index 5b9d557d..751e450a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -120,9 +120,9 @@ pub use crate::hss::hss_verify as verify; pub use crate::hss::{SigningKey, VerifyingKey}; // @TODO: Re-export: API for distributed state management (SST, SingleSubTree) -pub use crate::sst::*; // {gen_key, sign, verify}; -pub use crate::sst::parameters::SstsParameter; pub use crate::constants::MAX_DSM_SIGNING_ENTITIES; +pub use crate::sst::parameters::SstsParameter; +pub use crate::sst::*; // {gen_key, sign, verify}; use core::convert::TryFrom; use signature::Error; @@ -196,14 +196,14 @@ impl<'a> signature::Signature for VerifierSignature<'a> { #[cfg(test)] mod tests { + use crate::constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS; + use crate::util::helper::test_helper::gen_random_seed; use crate::{keygen, HssParameter, LmotsAlgorithm, LmsAlgorithm, Sha256_256}; use crate::{ signature::{SignerMut, Verifier}, - SigningKey, VerifierSignature, VerifyingKey, sst::parameters::SstsParameter, + SigningKey, VerifierSignature, VerifyingKey, }; - use crate::constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS; - use crate::util::helper::test_helper::gen_random_seed; use tinyvec::ArrayVec; #[test] @@ -212,15 +212,13 @@ mod tests { let seed = gen_random_seed::(); let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); - vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + vec_hss_params.push(HssParameter::new( + LmotsAlgorithm::LmotsW2, + LmsAlgorithm::LmsH5, + )); let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); - let (signing_key, verifying_key) = keygen::( - &sst_param, - &seed, - None, - ) - .unwrap(); + let (signing_key, verifying_key) = keygen::(&sst_param, &seed, None).unwrap(); let _: SigningKey = signing_key; let _: VerifyingKey = verifying_key; @@ -235,16 +233,17 @@ mod tests { let seed = gen_random_seed::(); let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); - vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); - vec_hss_params.push(HssParameter::new(LmotsAlgorithm::LmotsW2, LmsAlgorithm::LmsH5)); + vec_hss_params.push(HssParameter::new( + LmotsAlgorithm::LmotsW2, + LmsAlgorithm::LmsH5, + )); + vec_hss_params.push(HssParameter::new( + LmotsAlgorithm::LmotsW2, + LmsAlgorithm::LmsH5, + )); let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); - let (mut signing_key, verifying_key) = keygen::( - &sst_param, - &seed, - None, - ) - .unwrap(); + let (mut signing_key, verifying_key) = keygen::(&sst_param, &seed, None).unwrap(); let signature = signing_key.try_sign(&message).unwrap(); diff --git a/src/lms/definitions.rs b/src/lms/definitions.rs index bc78c714..b5937586 100644 --- a/src/lms/definitions.rs +++ b/src/lms/definitions.rs @@ -5,10 +5,10 @@ use crate::lm_ots::parameters::{LmotsAlgorithm, LmotsParameter}; use crate::lms::helper::get_tree_element; use crate::lms::parameters::LmsAlgorithm; use crate::lms::MutableExpandedAuxData; -use crate::util::helper::read_and_advance; -use crate::{lm_ots, Seed}; use crate::sst::helper::get_sst_last_leaf_idx; use crate::sst::parameters::SstExtension; +use crate::util::helper::read_and_advance; +use crate::{lm_ots, Seed}; use core::convert::TryInto; use tinyvec::ArrayVec; @@ -16,9 +16,6 @@ use zeroize::{Zeroize, ZeroizeOnDrop}; use super::parameters::LmsParameter; - - - #[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] pub struct LmsPrivateKey { pub lms_tree_identifier: LmsTreeIdentifier, @@ -46,7 +43,7 @@ impl LmsPrivateKey { used_leafs_index, lmots_parameter, lms_parameter, - sst_ext + sst_ext, } } @@ -54,9 +51,12 @@ impl LmsPrivateKey { let number_of_lm_ots_keys = { if let Some(my_sst_ext) = &self.sst_ext { // our last leafs function returns 0..total_num-1, but here we need 1..total_num - 1 + get_sst_last_leaf_idx(my_sst_ext.signing_instance, self.lms_parameter.get_tree_height(), my_sst_ext.top_tree_height) - } - else { + 1 + get_sst_last_leaf_idx( + my_sst_ext.signing_instance, + self.lms_parameter.get_tree_height(), + my_sst_ext.top_tree_height, + ) + } else { self.lms_parameter.number_of_lm_ots_keys() as u32 } }; @@ -188,7 +188,7 @@ mod tests { 0, LmotsAlgorithm::construct_default_parameter(), LmsAlgorithm::construct_default_parameter(), - None + None, ); let public_key = LmsPublicKey::new(&private_key, &mut None); diff --git a/src/lms/mod.rs b/src/lms/mod.rs index dae57411..00ed1c03 100644 --- a/src/lms/mod.rs +++ b/src/lms/mod.rs @@ -1,10 +1,10 @@ use crate::hasher::HashChain; use crate::hss::aux::MutableExpandedAuxData; use crate::hss::parameter::HssParameter; -use crate::parameters::SstExtension; use crate::hss::reference_impl_private_key::SeedAndLmsTreeIdentifier; use crate::lms::definitions::LmsPrivateKey; use crate::lms::definitions::LmsPublicKey; +use crate::parameters::SstExtension; pub mod definitions; pub mod helper; // TODO review -> pub! diff --git a/src/lms/verify.rs b/src/lms/verify.rs index 58eb5b63..e7b3e5c3 100644 --- a/src/lms/verify.rs +++ b/src/lms/verify.rs @@ -108,7 +108,7 @@ mod tests { 0, LmotsAlgorithm::construct_default_parameter(), LmsAlgorithm::construct_default_parameter(), - None + None, ); let public_key = LmsPublicKey::new(&private_key, &mut None).to_binary_representation(); diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index 779a6504..ef489e37 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -1,26 +1,22 @@ use crate::constants::LmsTreeIdentifier; use crate::signature::Error; use crate::{ - sst::{ - helper, - parameters::SstsParameter, - parameters::SstExtension, - helper::get_subtree_node_idx - }, + constants::{D_INTR, MAX_DSM_SIGNING_ENTITIES, MAX_HASH_SIZE}, hasher::HashChain, hss::{ - reference_impl_private_key::{Seed, ReferenceImplPrivateKey}, definitions::HssPublicKey, + reference_impl_private_key::{ReferenceImplPrivateKey, Seed}, SigningKey, }, - lms::helper::get_tree_element, lms::definitions::LmsPrivateKey, - constants::{MAX_HASH_SIZE, MAX_DSM_SIGNING_ENTITIES, D_INTR}, + lms::helper::get_tree_element, + sst::{ + helper, helper::get_subtree_node_idx, parameters::SstExtension, parameters::SstsParameter, + }, }; use tinyvec::ArrayVec; - pub fn gen_sst_subtree( sst_param: &SstsParameter, seed: &Seed, @@ -34,11 +30,15 @@ pub fn gen_sst_subtree( // TODO review: redundant...used leafs calculation let mut used_leafs_index = 0; - if sst_param.get_top_height() != 0 { // TODO: is there a better (Rust-idiomatic) approach? + if sst_param.get_top_height() != 0 { + // TODO: is there a better (Rust-idiomatic) approach? used_leafs_index = helper::get_sst_first_leaf_idx( sst_param.get_entity_idx(), - sst_param.get_hss_parameters()[0].get_lms_parameter().get_tree_height(), - sst_param.get_top_height()); + sst_param.get_hss_parameters()[0] + .get_lms_parameter() + .get_tree_height(), + sst_param.get_top_height(), + ); } // our intermediate node value @@ -59,7 +59,9 @@ pub fn gen_sst_subtree( our_node_index = get_subtree_node_idx( sst_param.get_entity_idx(), - sst_param.get_hss_parameters()[0].get_lms_parameter().get_tree_height(), + sst_param.get_hss_parameters()[0] + .get_lms_parameter() + .get_tree_height(), sst_param.get_top_height(), ); } @@ -73,16 +75,11 @@ pub fn gen_sst_subtree( sst_ext_option, ); - let our_node_value = get_tree_element( - our_node_index as usize, - &lms_private_key, - &mut None, - ); + let our_node_value = get_tree_element(our_node_index as usize, &lms_private_key, &mut None); Ok((signing_key, our_node_value)) } - /// Parameters: /// other_hss_pub_keys: HSS public keys of other signing entities /// own_hss_pub_key: HSS public key of the calling signing entity (separate, to create entity's individual authentication path). @@ -100,23 +97,24 @@ pub fn gen_sst_pubkey() -> Result<(), Error> { } */ -pub fn get_config(private_key: &[u8]) - -> Result<(SstsParameter, LmsTreeIdentifier), Error> -{ +pub fn get_config( + private_key: &[u8], +) -> Result<(SstsParameter, LmsTreeIdentifier), Error> { let rfc_private_key = ReferenceImplPrivateKey::::from_binary_representation(private_key) .map_err(|_| Error::new())?; let hss_pubkey = HssPublicKey::from(&rfc_private_key, None).map_err(|_| Error::new())?; let lms_tree_ident = hss_pubkey.public_key.lms_tree_identifier; - let hss_param_vec = rfc_private_key.compressed_parameter + let hss_param_vec = rfc_private_key + .compressed_parameter .to() .map_err(|_| Error::new())?; let ssts_param = SstsParameter::new( hss_param_vec, rfc_private_key.sst_ext.top_tree_height, - rfc_private_key.sst_ext.signing_instance + rfc_private_key.sst_ext.signing_instance, ); Ok((ssts_param, lms_tree_ident)) @@ -125,9 +123,8 @@ pub fn get_config(private_key: &[u8]) pub fn gen_pub_key( av_of_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, top_tree_height: u8, - lms_tree_ident: LmsTreeIdentifier + lms_tree_ident: LmsTreeIdentifier, ) -> Result, Error> { - let pubkey = get_node_hash_val::(1, av_of_nodes, top_tree_height, lms_tree_ident); Ok(pubkey) @@ -137,26 +134,26 @@ fn get_node_hash_val( index: u32, av_of_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, top_tree_height: u8, - lms_tree_ident: LmsTreeIdentifier + lms_tree_ident: LmsTreeIdentifier, ) -> ArrayVec<[u8; MAX_HASH_SIZE]> { - - let index_level = (core::mem::size_of_val(&index) * 8 - index.leading_zeros() as usize - 1) as u8; + let index_level = + (core::mem::size_of_val(&index) * 8 - index.leading_zeros() as usize - 1) as u8; let hasher = H::default() .chain(lms_tree_ident) .chain((index as u32).to_be_bytes()); // if index is at lowest level (where we have the signing entity node hash values) - let result = - if index_level == top_tree_height { + let result = if index_level == top_tree_height { // return the node value from array of intermedediate node hash values /* access vector elements via "leaf numbers" = 0..signing_entites-1 */ - let leaf_number = (index as usize ) - 2usize.pow(top_tree_height as u32); + let leaf_number = (index as usize) - 2usize.pow(top_tree_height as u32); av_of_nodes[leaf_number] } else { // we are "above" the intermediate node hash values -> go down let left = get_node_hash_val::(index * 2, av_of_nodes, top_tree_height, lms_tree_ident); - let right = get_node_hash_val::(index * 2 + 1, av_of_nodes, top_tree_height, lms_tree_ident); + let right = + get_node_hash_val::(index * 2 + 1, av_of_nodes, top_tree_height, lms_tree_ident); hasher .chain(D_INTR) @@ -165,12 +162,11 @@ fn get_node_hash_val( .finalize() }; - return result + return result; } - pub fn gen_sst_pubkey(_private_key: &[u8], _aux_data: Option<&mut &mut [u8]>) -// -> Result<(VerifyingKey), Error> +//-> Result<(VerifyingKey), Error> { // public keys -> gen_sst_pubkey @@ -213,5 +209,3 @@ pub fn gen_sst_pubkey(_private_key: &[u8], _aux_data: Option<&mut //Ok(verifying_key) } - - diff --git a/src/sst/helper.rs b/src/sst/helper.rs index 50bee952..cd0a801c 100644 --- a/src/sst/helper.rs +++ b/src/sst/helper.rs @@ -22,22 +22,24 @@ pub fn get_sst_first_leaf_idx(signing_entity_idx: u8, total_height: u8, top_div: pub fn get_sst_last_leaf_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level - get_sst_first_leaf_idx(signing_entity_idx, total_height, top_div) - 1 + get_num_leaves_in_sst(total_height, top_div) + get_sst_first_leaf_idx(signing_entity_idx, total_height, top_div) - 1 + + get_num_leaves_in_sst(total_height, top_div) } - // For a subtree, depending on whole SSTS and division, get first leaf idx on whole SSTS pub fn _get_sst_first_leaf_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level - 2u32.pow(total_height as u32) + (((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div)) as u32 + 2u32.pow(total_height as u32) + + (((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div)) as u32 } // For a subtree, depending on whole SSTS and division, get last leaf idx on whole SSTS pub fn _get_sst_last_leaf_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level - _get_sst_first_leaf_node_idx(signing_entity_idx, total_height, top_div) - 1 + get_num_leaves_in_sst(total_height, top_div) + _get_sst_first_leaf_node_idx(signing_entity_idx, total_height, top_div) - 1 + + get_num_leaves_in_sst(total_height, top_div) } // number of leaves of a Merkle tree @@ -49,7 +51,6 @@ fn _get_last_leaf_node_idx(height: u8) -> u32 { 2u32.pow(height as u32 + 1) - 1 } - #[cfg(test)] mod tests { @@ -111,7 +112,6 @@ mod tests { assert_eq!(63, last_idx); } - /* fn get_sst_first_leaf_idx(signing_entity_idx: usize, total_height: usize, top_div: usize) -> usize { 2usize.pow(total_height as u32) - 1 + ((signing_entity_idx - 1) * 2usize.pow((total_height - top_div) as u32)) @@ -165,5 +165,4 @@ mod tests { let last_leaf_idx = _get_sst_last_leaf_node_idx(9, 5, 3); assert_eq!(63, last_leaf_idx); } - } diff --git a/src/sst/parameters.rs b/src/sst/parameters.rs index 36d807ef..81f98abc 100644 --- a/src/sst/parameters.rs +++ b/src/sst/parameters.rs @@ -1,12 +1,8 @@ -use crate::{ - hasher::HashChain, - hss::parameter::HssParameter, - constants, -}; +use crate::{constants, hasher::HashChain, hss::parameter::HssParameter}; +use core::convert::TryInto; use tinyvec::ArrayVec; use zeroize::{Zeroize, ZeroizeOnDrop}; -use core::convert::TryInto; #[derive(Clone, PartialEq, Eq)] pub struct SstsParameter { @@ -15,12 +11,14 @@ pub struct SstsParameter { signing_entity_idx: u8, // starting with 1 } - impl Copy for SstsParameter {} impl SstsParameter { - pub fn new(hss_params: ArrayVec<[HssParameter; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]>, top_height: u8, entity_idx: u8) -> Self { - + pub fn new( + hss_params: ArrayVec<[HssParameter; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]>, + top_height: u8, + entity_idx: u8, + ) -> Self { SstsParameter { hss_parameters: hss_params, top_height, // e.g. LMS height of 5 and top_height 3: division top/bottom is 3/2 which would result in 2^3 = 8 signing entities @@ -28,7 +26,9 @@ impl SstsParameter { } } - pub fn get_hss_parameters(&self) -> &ArrayVec<[HssParameter; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> { + pub fn get_hss_parameters( + &self, + ) -> &ArrayVec<[HssParameter; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> { &self.hss_parameters } @@ -61,7 +61,6 @@ impl Default for SstsParameter { } */ - #[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] pub struct SstExtension { pub signing_instance: u8, @@ -76,10 +75,10 @@ impl SstExtension { let tmp: u16 = u16::from_be_bytes(data.try_into().unwrap()); let sst_ext = SstExtension { - signing_instance: (tmp >> 8 ) as u8, // TODO correct? - top_tree_height: tmp as u8, + signing_instance: (tmp >> 8) as u8, + top_tree_height: tmp as u8, }; Ok(sst_ext) } -} \ No newline at end of file +} diff --git a/src/sst/sign.rs b/src/sst/sign.rs index 41e75d5a..2dcd106c 100644 --- a/src/sst/sign.rs +++ b/src/sst/sign.rs @@ -1,7 +1,7 @@ -use crate::signature::Error; use crate::constants::Node; use crate::constants::MAX_HASH_SIZE; use crate::hss::signing::HssSignature; +use crate::signature::Error; use crate::HashChain; use tinyvec::ArrayVec; @@ -11,9 +11,7 @@ pub struct SstsSignature { pub auth_path: ArrayVec<[Node; MAX_HASH_SIZE]>, // order: sort on-the-fly dep. on Node's values? } -pub fn sign( - _message: &[u8], -) -> Result<(), Error> { +pub fn sign(_message: &[u8]) -> Result<(), Error> { // nyi /* hbs_lms::sign::( &message_data, diff --git a/src/sst/verify.rs b/src/sst/verify.rs index f05e3667..06f8f833 100644 --- a/src/sst/verify.rs +++ b/src/sst/verify.rs @@ -1,11 +1,7 @@ use crate::HashChain; //use crate::hss; -pub fn verify( - _message: &[u8], - _signature: &[u8], - _public_key: &[u8], -) -> bool { +pub fn verify(_message: &[u8], _signature: &[u8], _public_key: &[u8]) -> bool { // @TODO nyi // - verify SST (= HSS/LMS) signature (same as for HSS/LMS) diff --git a/tests/reference_implementation.rs b/tests/reference_implementation.rs index fcabd149..76e2d32a 100644 --- a/tests/reference_implementation.rs +++ b/tests/reference_implementation.rs @@ -6,7 +6,10 @@ use std::{ }; use tinyvec::ArrayVec; -use hbs_lms::{HssParameter, LmotsAlgorithm, LmsAlgorithm, Seed, Sha256_256, REF_IMPL_MAX_ALLOWED_HSS_LEVELS, SstsParameter}; +use hbs_lms::{ + HssParameter, LmotsAlgorithm, LmsAlgorithm, Seed, Sha256_256, SstsParameter, + REF_IMPL_MAX_ALLOWED_HSS_LEVELS, +}; use tempfile::TempDir; const MESSAGE_FILE_NAME: &str = "message.txt"; @@ -58,12 +61,9 @@ fn create_signature_with_own_implementation() { vec_hss_params.push(HssParameter::construct_default_parameters()); let sst_param = SstsParameter::new(vec_hss_params, 0, 0); - let (mut signing_key, verifying_key) = hbs_lms::keygen::( - &sst_param, - &seed, - Some(aux_slice), - ) - .expect("Should create HSS keys"); + let (mut signing_key, verifying_key) = + hbs_lms::keygen::(&sst_param, &seed, Some(aux_slice)) + .expect("Should create HSS keys"); save_file( path.join(PUBLIC_KEY_NAME).to_str().unwrap(), From 53ab9359ce3e9d475e1a80a4fbf0ab3b0ace6523 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Tue, 16 Jan 2024 16:40:17 +0100 Subject: [PATCH 26/43] sst: extend two-step key generation - adapt AUX data: add level for signing entity nodes; ignore levels "above" - generate the correct VerifyingKey: replace our own ID 1 "pubkey" value with node value calc. via intermediate SI nodes - use separate files for different signing entities numbers (aux, prv, pub) - extend arguments for demo code --- examples/sst_demo.rs | 116 +++++++++++++------------- src/constants.rs | 8 +- src/hss/aux.rs | 42 ++++++++-- src/hss/definitions.rs | 16 +++- src/hss/mod.rs | 25 ++++-- src/hss/reference_impl_private_key.rs | 3 +- src/sst/gen_key.rs | 111 +++++++----------------- src/sst/helper.rs | 4 +- src/sst/parameters.rs | 35 ++------ 9 files changed, 170 insertions(+), 190 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index dc4bec97..215dc1eb 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -9,8 +9,8 @@ use std::{ }; use tinyvec::ArrayVec; -const GENSUBTREE_COMMAND: &str = "gensubtree"; -const GENPUBKEY_COMMAND: &str = "genpubkey"; +const GENKEY1_COMMAND: &str = "genkey1"; +const GENKEY2_COMMAND: &str = "genkey2"; const VERIFY_COMMAND: &str = "verify"; const SIGN_COMMAND: &str = "sign"; @@ -19,9 +19,10 @@ const SIGN_MUT_COMMAND: &str = "sign_mut"; const ARG_KEYNAME: &str = "keyname"; const ARG_MESSAGE: &str = "file"; -const ARG_SSTS_PARAMETER: &str = "parameter"; +const ARG_GENKEY1_PARAMETER: &str = "parameter"; const ARG_SI_PARAMETER: &str = "si_param"; const ARG_SEED: &str = "seed"; +const ARG_AUXSIZE: &str = "auxsize"; const AUX_DATA_DEFAULT_SIZE: usize = 100_000_000; @@ -46,15 +47,15 @@ type Hasher = Sha256_256; struct GenKeyParameter { ssts_param: SstsParameter, - _aux_data: usize, + aux_data: usize, } impl GenKeyParameter { pub fn new(ssts_param: SstsParameter, aux_data: Option) -> Self { - let _aux_data = aux_data.unwrap_or(AUX_DATA_DEFAULT_SIZE); + let aux_data = aux_data.unwrap_or(AUX_DATA_DEFAULT_SIZE); Self { ssts_param, - _aux_data, + aux_data, } } } @@ -80,17 +81,19 @@ fn main() -> Result<(), Box> { let command = Command::new("SSTS Demo") .about("Generates SSTS keys and uses them for signing and verifying.") .subcommand( - Command::new(GENSUBTREE_COMMAND) + Command::new(GENKEY1_COMMAND) .arg(Arg::new(ARG_KEYNAME).required(true)) - .arg(Arg::new(ARG_SSTS_PARAMETER).required(true).help( + .arg(Arg::new(ARG_GENKEY1_PARAMETER).required(true).help( "Specify LMS parameters (e.g. 5/4/2/1 (tree height = 5, Winternitz parameter = 4, top height = 2, signing entity = 1))")) .arg(Arg::new(ARG_SEED).long(ARG_SEED).required(true).takes_value(true).value_name("seed")), ) .subcommand( - Command::new(GENPUBKEY_COMMAND) + Command::new(GENKEY2_COMMAND) .arg(Arg::new(ARG_KEYNAME).required(true)) .arg(Arg::new(ARG_SI_PARAMETER).required(true).help( "Specify signing instance number (1..n))")) + .arg(Arg::new(ARG_AUXSIZE).long(ARG_AUXSIZE).required(false).takes_value(true).value_name("auxsize").help( + "Specify AUX data size in bytes")) ) .subcommand( Command::new(VERIFY_COMMAND) @@ -111,16 +114,16 @@ fn main() -> Result<(), Box> { let matches = command.get_matches(); - if let Some(args) = matches.subcommand_matches(GENSUBTREE_COMMAND) { - gen_key_subtree(args)?; + if let Some(args) = matches.subcommand_matches(GENKEY1_COMMAND) { + genkey1(args)?; println!( "Single-subtree-structure: intermediate node and private key successfully generated!" ); return Ok(()); } - if let Some(args) = matches.subcommand_matches(GENPUBKEY_COMMAND) { - gen_key_ssts(args)?; + if let Some(args) = matches.subcommand_matches(GENKEY2_COMMAND) { + genkey2(args)?; println!("Single-subtree-structure: public key successfully generated!"); return Ok(()); } @@ -277,7 +280,7 @@ fn verify(args: &ArgMatches) -> bool { } fn get_public_key_filename(keyname: &str, idx: u8) -> String { - keyname.to_string() + &idx.to_string() + ".pub" + keyname.to_string() + "." + &idx.to_string() + ".pub" } fn get_signature_filename(message_name: &str) -> String { @@ -295,11 +298,11 @@ fn get_message_mut_filename(message_name: &str) -> String { } fn get_private_key_filename(private_key: &str, idx: u8) -> String { - private_key.to_string() + &idx.to_string() + "." + ".prv" + private_key.to_string() + "." + &idx.to_string() + ".prv" } fn get_aux_filename(keyname: &str, idx: u8) -> String { - keyname.to_string() + &idx.to_string() + ".aux" + keyname.to_string() + "." + &idx.to_string() + ".aux" } fn get_parameter(name: &str, args: &ArgMatches) -> String { @@ -319,10 +322,10 @@ fn read_file(file_name: &str) -> Vec { data } -fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> { +fn genkey1(args: &ArgMatches) -> Result<(), Box> { let keyname: String = get_parameter(ARG_KEYNAME, args); - let genkey_parameter = parse_genkey1_parameter(&get_parameter(ARG_SSTS_PARAMETER, args)); + let genkey_parameter = parse_genkey1_parameter(&get_parameter(ARG_GENKEY1_PARAMETER, args)); let ssts_param = genkey_parameter.ssts_param; let seed: Seed = if let Some(seed) = args.value_of(ARG_SEED) { @@ -342,19 +345,19 @@ fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> return DemoError::raise("Seed was not given".to_string()); }; - // TODO should we generate aux data here or in next step -- or in both? + let mut aux_data = vec![0u8; genkey_parameter.aux_data]; + let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; // create our private key let (signing_key, node_pubkey) = - gen_sst_subtree(&ssts_param, &seed).unwrap_or_else(|_| panic!("Could not generate keys")); + genkey1_sst(&ssts_param, &seed, Some(aux_slice)).unwrap_or_else(|_| panic!("Could not generate keys")); - //println!("sst_demo::gen_key_subtree(): node value: {:?}", node_pubkey); let private_key_filename = get_private_key_filename(&keyname, ssts_param.get_entity_idx()); write(private_key_filename.as_str(), signing_key.as_slice())?; // write own node value and signing instance to file // TODO maybe also HSS/LMS/LM-OTS parameters, to ensure that we got the same parameters among all signing instances - let interm_node_filename = String::from("node_si") + let interm_node_filename = String::from("node_si.") + &(ssts_param.get_entity_idx().to_string()) + &String::from(".bin"); // TODO into function @@ -375,75 +378,76 @@ fn gen_key_subtree(args: &ArgMatches) -> Result<(), Box> Ok(()) } -fn gen_key_ssts(args: &ArgMatches) -> Result<(), Box> { +fn genkey2(args: &ArgMatches) -> Result<(), Box> { // get signing instance number and name of private keyfile from args let keyname: String = get_parameter(ARG_KEYNAME, args); let signing_instance: String = get_parameter(ARG_SI_PARAMETER, args); + let aux_size: String = get_parameter(ARG_AUXSIZE, args); - println!("keyname: {} -- SI: {}", keyname, signing_instance); + let signing_instance: u8 = signing_instance.parse::().unwrap(); + + // AUX data: currently we create it only in genkey2 + let mut aux_data = vec![0u8; aux_size.parse::().unwrap()]; + let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; + // later on we should create it in genkey1 because it's possibly lots of calculations + // and in that case we'll read the previously generated aux data from a file + //let mut aux_data = read(aux_data_name).ok(); + //let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; + + // println!("keyname: {} -- SI: {} -- aux_size: {}", keyname, signing_instance, aux_size); // read private key - let private_key_name = - get_private_key_filename(&keyname, signing_instance.parse::().unwrap()); + let private_key_name = get_private_key_filename(&keyname, signing_instance); let private_key_data = read_file(&private_key_name); - // (here so far we only had the structs "SigningKey" and "VerifyingKey" -> leave it at that if possible) - // read HSS configuration from key -> how many SI and LMS config (tree height...) - + // here we need one additional API call so we know which files we have to read dep. on HSS config. let (ssts_param, lms_tree_ident) = get_config::(&private_key_data) .unwrap_or_else(|_| panic!("genkey step 2: invalid config")); - println!("lms_tree_ident: {:?}", lms_tree_ident); - // TODO maybe compare with HSS configuration in the "node files" // read intermediate node values from files (ours and others) and pass for calc. let num_signing_entities = 2u32.pow(ssts_param.get_top_height() as u32); - //let mut vec_intermed_nodes = Vec::new(); + let mut node_array: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]> = Default::default(); for idx in 1..=num_signing_entities { + let interm_node_filename = - String::from("node_si") + &(idx.to_string()) + &String::from(".bin"); // TODO into function + String::from("node_si.") + &(idx.to_string()) + &String::from(".bin"); // TODO into function - //println!("read intermediate node value for signing entity num {}", idx); let file_data: Vec = read_file(&interm_node_filename); if file_data.len() != (1 + MAX_HASH_SIZE) { - panic!( - "genkey step 2: file data len is {}, should be {}", - file_data.len(), - (1 + MAX_HASH_SIZE) + panic!("genkey2(): intermediate node file size is {}, should be {}", + file_data.len(), (1 + MAX_HASH_SIZE) ); } // let mut node: ArrayVec<[u8; MAX_HASH_SIZE]> = Default::default(); // node.push(file_data[1..]); // TODO easier? - // TODO that works but is probably a really bad solution - + // node_array[(idx-1) as usize].extend(&file_data[1..]); + // TODO the following works but is a really bad inefficient solution let mut node: [u8; MAX_HASH_SIZE] = [0; MAX_HASH_SIZE]; node.copy_from_slice(&file_data[1..]); // TODO easier? node_array.push(node.into()); - //node_array[(idx-1) as usize].extend(&file_data[1..]); } - let _pubkey = gen_pub_key::(&node_array, ssts_param.get_top_height(), lms_tree_ident); - println!("pub key (node 1) hash value: {:?}", _pubkey); - - // VerifyingKey ? - //let intermediate_nodes = ArrayVec( + &private_key_data, + &node_array, + ssts_param.get_top_height(), // TODO remove + lms_tree_ident, // TODO remove + Some(aux_slice), + ).unwrap_or_else(|_| panic!("Could not generate verifying key")); - // create public key (VerifyingKey) and write to file - - //let public_key_filename = get_public_key_name(&keyname); - - let aux_data_name = get_aux_filename(&keyname, signing_instance.parse::().unwrap()); - let mut _aux_data = read(aux_data_name).ok(); - //let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; + //println!("pub key (node 1) hash value: {:?}", verifying_key); - // retrieve PrivateKey private_key: &ReferenceImplPrivateKey - //gen_sst_pubkey(&private_key_data, Some(aux_slice)); + // get public key (VerifyingKey) and write to file + let aux_filename: String = get_aux_filename(&keyname, signing_instance); + write(&aux_filename, aux_slice)?; - //write(public_key_filename.as_str(), verifying_key.as_slice())?; + let public_key_filename = get_public_key_filename(&keyname, signing_instance); + write(public_key_filename.as_str(), verifying_key.as_slice())?; Ok(()) } diff --git a/src/constants.rs b/src/constants.rs index f50b02c4..acf64654 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -39,7 +39,7 @@ pub const fn prng_len(seed_len: usize) -> usize { 23 + seed_len } -pub const LMS_LEAF_IDENTIFIERS_SIZE: usize = 8; +pub const LMS_LEAF_IDENTIFIERS_SIZE: usize = 8; // TODO rename? HSS_COMPRESSED_USED_LEAFS_SIZE => 64 bit pub const REF_IMPL_MAX_ALLOWED_HSS_LEVELS: usize = 8; pub const REF_IMPL_SSTS_EXT_SIZE: usize = 2; pub const REF_IMPL_MAX_PRIVATE_KEY_SIZE: usize = REF_IMPL_SSTS_EXT_SIZE @@ -68,9 +68,9 @@ pub const MAX_HSS_SIGNED_PUBLIC_KEY_LENGTH: usize = hss_signed_public_key_length(MAX_HASH_SIZE, MAX_HASH_CHAIN_COUNT, MAX_TREE_HEIGHT); pub const MAX_HSS_SIGNATURE_LENGTH: usize = get_hss_signature_length(); -// DSM = Distributedt State Management -pub const _MAX_DSM_TOP_TREE_HEIGHT: usize = 8; -pub const MAX_DSM_SIGNING_ENTITIES: usize = 256; // TODO calc via 2^MAX_DSM_TOP_TREE_HEIGHT +// DSM = Distributed State Management +// pub const _MAX_DSM_TOP_TREE_HEIGHT: usize = 8; +pub const MAX_DSM_SIGNING_ENTITIES: usize = 256; // TODO calc via 2^MAX_DSM_TOP_TREE_HEIGHT /// Calculated using the formula from RFC 8554 Appendix B /// https://datatracker.ietf.org/doc/html/rfc8554#appendix-B diff --git a/src/hss/aux.rs b/src/hss/aux.rs index 410c1fd1..06f017a2 100644 --- a/src/hss/aux.rs +++ b/src/hss/aux.rs @@ -33,26 +33,53 @@ pub struct MutableExpandedAuxData<'a> { pub hmac: &'a mut [u8], } +// TODO maybe improve: for SST wich e.g. 8 signing entities, each level would need only 1/8 of space that's needed w/o SST! +// TODO add unit tests pub fn hss_optimal_aux_level( mut max_length: usize, lms_parameter: LmsParameter, actual_len: Option<&mut usize>, + top_tree_height: Option, ) -> AuxLevel { + let mut aux_level = AuxLevel::default(); + // HMAC has size of hash let size_hash = lms_parameter.get_hash_function_output_size(); let orig_max_length = max_length; - if max_length < AUX_DATA_HASHES + size_hash { - if let Some(actual_len) = actual_len { - *actual_len = 1; + let mut min_top_level = 1; + + // if SST is used, leave space for signing entity node values depending on their level! + let mut size_for_signing_entity_nodes: usize = 0; + if let Some(top_tree_height) = top_tree_height { + size_for_signing_entity_nodes = 2usize.pow(top_tree_height as u32) * size_hash; + + min_top_level = top_tree_height + 1; // so we don't fill above our intermediate node values + // add level to level bit, later abort if max_length too small + aux_level |= 0x80000000 | (1 << top_tree_height); + } + + let min_length = AUX_DATA_HASHES + size_hash + size_for_signing_entity_nodes; + + if max_length < min_length { + if let Some(top_tree_height) = top_tree_height { + panic!("AUX data size = {} too small to store intermediate node values for dist. state mgmt with top_tree_height {}.", + orig_max_length, top_tree_height); + } else { + if let Some(actual_len) = actual_len { + *actual_len = 1; // ?? + } + return 0; // no AUX data used, but w/o SST we can live with that } - return 0; } - max_length -= AUX_DATA_HASHES + size_hash; + + max_length -= min_length; let h0 = lms_parameter.get_tree_height().into(); - for level in (1..=h0).rev().step_by(MIN_SUBTREE) { + + for level in (min_top_level..=h0).rev().step_by(MIN_SUBTREE) { + // why other way round (cisco: 2,4,6...?! let len_this_level = size_hash << level; if max_length >= len_this_level { @@ -131,10 +158,11 @@ pub fn hss_expand_aux_data<'a, H: HashChain>( pub fn hss_get_aux_data_len( max_length: usize, lms_parameter: LmsParameter, + top_tree_height: Option, ) -> usize { let mut len = 0; - if hss_optimal_aux_level(max_length, lms_parameter, Some(&mut len)) == 0 { + if hss_optimal_aux_level(max_length, lms_parameter, Some(&mut len), top_tree_height) == 0 { return 1; } diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index 987d9a86..789113fc 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -114,12 +114,19 @@ impl HssPrivateKey { return hss_expand_aux_data::(Some(aux_data), Some(private_key.seed.as_slice())); } + let top_tree_height = private_key.sst_ext.top_tree_height; + let opt_top_tree_height = if 0 == top_tree_height { + None + } else { + Some(top_tree_height) + }; + // Shrink input slice - let aux_len = hss_get_aux_data_len(aux_data.len(), *top_lms_parameter); + let aux_len = hss_get_aux_data_len(aux_data.len(), *top_lms_parameter, opt_top_tree_height); let moved = core::mem::take(aux_data); *aux_data = &mut moved[..aux_len]; - let aux_level = hss_optimal_aux_level(aux_len, *top_lms_parameter, None); + let aux_level = hss_optimal_aux_level(aux_len, *top_lms_parameter, None, opt_top_tree_height); hss_store_aux_marker(aux_data, aux_level); hss_expand_aux_data::(Some(aux_data), None) @@ -175,7 +182,7 @@ impl HssPublicKey { let levels = parameters.len(); let used_leafs_indexes = private_key.compressed_used_leafs_indexes.to(¶meters); - let top_lms_parameter = parameters[0].get_lms_parameter(); + let top_lms_parameter = parameters[0].get_lms_parameter(); // TODO: "[0]": discuss/review for SST let is_aux_data_used = if let Some(ref aux_data) = aux_data { hss_is_aux_data_used(aux_data) @@ -186,7 +193,7 @@ impl HssPublicKey { let mut expanded_aux_data = HssPrivateKey::get_expanded_aux_data( aux_data, private_key, - top_lms_parameter, + top_lms_parameter, // TODO only top is forwarded to LmsPrivateKey for SST params is_aux_data_used, ); @@ -220,6 +227,7 @@ impl HssPublicKey { level: levels, }) } + pub fn to_binary_representation(&self) -> ArrayVec<[u8; MAX_HSS_PUBLIC_KEY_LENGTH]> { let mut result = ArrayVec::new(); diff --git a/src/hss/mod.rs b/src/hss/mod.rs index f6df60b1..cf4c194f 100644 --- a/src/hss/mod.rs +++ b/src/hss/mod.rs @@ -294,7 +294,7 @@ mod tests { use super::parameter::HssParameter; use crate::util::helper::test_helper::gen_random_seed; use crate::{ - constants::{LMS_LEAF_IDENTIFIERS_SIZE, MAX_HASH_SIZE, REF_IMPL_MAX_ALLOWED_HSS_LEVELS}, + constants::{LMS_LEAF_IDENTIFIERS_SIZE, MAX_HASH_SIZE, REF_IMPL_MAX_ALLOWED_HSS_LEVELS, REF_IMPL_SSTS_EXT_SIZE}, hasher::{ sha256::{Sha256_128, Sha256_192, Sha256_256}, shake256::{Shake256_128, Shake256_192, Shake256_256}, @@ -340,9 +340,14 @@ mod tests { assert!(hss_verify::(&message, signature.as_ref(), verifying_key.as_slice()).is_ok()); assert_ne!(signing_key.as_slice(), signing_key_const.as_slice()); + + assert_eq!( + signing_key.as_slice()[..REF_IMPL_SSTS_EXT_SIZE], + signing_key_const.as_slice()[..REF_IMPL_SSTS_EXT_SIZE] + ); assert_eq!( - signing_key.as_slice()[LMS_LEAF_IDENTIFIERS_SIZE..], - signing_key_const.as_slice()[LMS_LEAF_IDENTIFIERS_SIZE..] + signing_key.as_slice()[REF_IMPL_SSTS_EXT_SIZE+LMS_LEAF_IDENTIFIERS_SIZE..], + signing_key_const.as_slice()[REF_IMPL_SSTS_EXT_SIZE+LMS_LEAF_IDENTIFIERS_SIZE..] ); } @@ -373,7 +378,7 @@ mod tests { for index in 0..keypair_lifetime { assert_eq!( - signing_key.as_slice()[..LMS_LEAF_IDENTIFIERS_SIZE], + signing_key.as_slice()[REF_IMPL_SSTS_EXT_SIZE..LMS_LEAF_IDENTIFIERS_SIZE+REF_IMPL_SSTS_EXT_SIZE], index.to_be_bytes(), ); assert_eq!( @@ -560,12 +565,14 @@ mod tests { type H = Sha256_256; let seed = gen_random_seed::(); + let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); + vec_hss_params.push(HssParameter::construct_default_parameters()); + vec_hss_params.push(HssParameter::construct_default_parameters()); + vec_hss_params.push(HssParameter::construct_default_parameters()); + let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); + let (mut signing_key, verifying_key) = hss_keygen::( - &[ - HssParameter::construct_default_parameters(), - HssParameter::construct_default_parameters(), - HssParameter::construct_default_parameters(), - ], + &sst_param, &seed, None, ) diff --git a/src/hss/reference_impl_private_key.rs b/src/hss/reference_impl_private_key.rs index c176d9b2..b2f3626c 100644 --- a/src/hss/reference_impl_private_key.rs +++ b/src/hss/reference_impl_private_key.rs @@ -152,7 +152,7 @@ impl ReferenceImplPrivateKey { let mut index = 0; let ssts_ext = read_and_advance(data, REF_IMPL_SSTS_EXT_SIZE, &mut index); - result.sst_ext = SstExtension::from_slice(ssts_ext)?; + result.sst_ext = SstExtension::from_slice(ssts_ext); let compressed_used_leafs_indexes = read_and_advance(data, LMS_LEAF_IDENTIFIERS_SIZE, &mut index); @@ -455,7 +455,6 @@ mod tests { #[test] fn test_binary_representation_rfc_private_key() { - let mut vec_hss_params: ArrayVec<[_; REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); vec_hss_params.push(HssParameter::construct_default_parameters()); vec_hss_params.push(HssParameter::construct_default_parameters()); diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index ef489e37..058748cd 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -6,7 +6,7 @@ use crate::{ hss::{ definitions::HssPublicKey, reference_impl_private_key::{ReferenceImplPrivateKey, Seed}, - SigningKey, + SigningKey, VerifyingKey, }, lms::definitions::LmsPrivateKey, lms::helper::get_tree_element, @@ -17,18 +17,20 @@ use crate::{ use tinyvec::ArrayVec; -pub fn gen_sst_subtree( +pub fn genkey1_sst( sst_param: &SstsParameter, seed: &Seed, + _aux_data: Option<&mut &mut [u8]>, // TODO: improve efficiency and fill aux_data already here? ) -> Result<(SigningKey, ArrayVec<[u8; MAX_HASH_SIZE]>), Error> { - println!("gen_sst_subtree"); - // private keys + // create two representations of private keys: ReferenceImplPrivateKey and SigningKey let private_key = ReferenceImplPrivateKey::generate(sst_param, seed).map_err(|_| Error::new())?; let signing_key = SigningKey::from_bytes(&private_key.to_binary_representation())?; - // TODO review: redundant...used leafs calculation + // calculate our intermediate node hash value; for this we have to generate a LmsPrivateKey + + // TODO review: better option? it's somehow redundant (used leafs calculation) let mut used_leafs_index = 0; if sst_param.get_top_height() != 0 { // TODO: is there a better (Rust-idiomatic) approach? @@ -41,9 +43,7 @@ pub fn gen_sst_subtree( ); } - // our intermediate node value - // TODO: review! not elegant to create an LmsPrivateKey and SeedAndLmsTreeIdentifier - + // TODO: review! not exactly elegant to create an LmsPrivateKey and SeedAndLmsTreeIdentifier let seed_and_lms_tree_ident = private_key.generate_root_seed_and_lms_tree_identifier(); let sst_ext = SstExtension { @@ -52,7 +52,7 @@ pub fn gen_sst_subtree( }; let mut sst_ext_option = None; - let mut our_node_index = 0; + let mut our_node_index = 1; // TODO don't do that...we're calc. the TOTAL public key if private_key.sst_ext.signing_instance != 0 { sst_ext_option = Some(sst_ext); @@ -69,7 +69,7 @@ pub fn gen_sst_subtree( let lms_private_key = LmsPrivateKey::::new( seed_and_lms_tree_ident.seed.clone(), seed_and_lms_tree_ident.lms_tree_identifier, - used_leafs_index as u32, // actually not used in "get_tree_element", irrelevant + used_leafs_index, // actually not used in "get_tree_element", irrelevant *sst_param.get_hss_parameters()[0].get_lmots_parameter(), *sst_param.get_hss_parameters()[0].get_lms_parameter(), sst_ext_option, @@ -80,23 +80,6 @@ pub fn gen_sst_subtree( Ok((signing_key, our_node_value)) } -/// Parameters: -/// other_hss_pub_keys: HSS public keys of other signing entities -/// own_hss_pub_key: HSS public key of the calling signing entity (separate, to create entity's individual authentication path). -/// Returns the root node (public key) which comprises the authentication path -- whihch is different for every signing entity! -/* -pub fn gen_sst_pubkey() -> Result<(), Error> { - - // that's different now, because we do not generate a whole LMS based on - // one seed but on different intermediate nodes (with different seeds). - // -> Check whether there is a function that takes intermediate nodes! (e.g. function using aux data) - // because that's basically what we need - - // @TODO: use the Error - Ok(()) -} -*/ - pub fn get_config( private_key: &[u8], ) -> Result<(SstsParameter, LmsTreeIdentifier), Error> { @@ -120,14 +103,27 @@ pub fn get_config( Ok((ssts_param, lms_tree_ident)) } -pub fn gen_pub_key( +pub fn genkey2_sst( + private_key: &[u8], av_of_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, - top_tree_height: u8, - lms_tree_ident: LmsTreeIdentifier, -) -> Result, Error> { - let pubkey = get_node_hash_val::(1, av_of_nodes, top_tree_height, lms_tree_ident); + top_tree_height: u8, // TODO replace/remove (we have private_key) + lms_tree_ident: LmsTreeIdentifier, // TODO replace/remove (we have private_key) + aux_data: Option<&mut &mut [u8]> +) -> Result, Error> { - Ok(pubkey) + let pubkey_hash_val = get_node_hash_val::(1, av_of_nodes, top_tree_height, lms_tree_ident); + + let rfc_private_key = ReferenceImplPrivateKey::::from_binary_representation(private_key) + .map_err(|_| Error::new())?; + + // this public key has the wrong node hash vlaue, because it did not yet consider the other signing entities with their different private keys + let mut hss_public_key = HssPublicKey::from(&rfc_private_key, aux_data).map_err(|_| Error::new())?; + // so replace the hash value with the one calc. via signing entity nodes + hss_public_key.public_key.key = pubkey_hash_val; + + let verifying_key = VerifyingKey::::from_bytes(&hss_public_key.to_binary_representation())?; + + Ok(verifying_key) } fn get_node_hash_val( @@ -141,7 +137,7 @@ fn get_node_hash_val( let hasher = H::default() .chain(lms_tree_ident) - .chain((index as u32).to_be_bytes()); + .chain((index).to_be_bytes()); // if index is at lowest level (where we have the signing entity node hash values) let result = if index_level == top_tree_height { @@ -162,50 +158,5 @@ fn get_node_hash_val( .finalize() }; - return result; -} - -pub fn gen_sst_pubkey(_private_key: &[u8], _aux_data: Option<&mut &mut [u8]>) -//-> Result<(VerifyingKey), Error> -{ - - // public keys -> gen_sst_pubkey - // check how the &[u8] is transformed to RefPrivKey in sign() - // let hss_public_key = HssPublicKey::from(&private_key, aux_data).map_err(|_| Error::new())?; - //let verifying_key = VerifyingKey::from_bytes(&hss_public_key.to_binary_representation())?; - - // @TODO: nyi - // 1. we need an HSS SigningKey/VerifyingKey ; pretend to have a full LMS here to fulfill - // param. requirements for existing functions. - // A difference is that the different signing entities will use different seeds, - // but that shouldn't have any repercussions - // 2. get_tree_element(idx, LmsPrivateKey, aux_data) - // w/o aux data first - // - idx - // - either 1 , but that would mean we consider as a whole tree - // - or rather the correct idx in the whole SSTS/LMS; we know our "sub-tree ID"; - // then each sub-tree's seed is used as a "start a left-most leaf" seed - - // @TODO work: - // 1. - create key for "get_tree_element()"" with seed -- we need different seeds! - // a) - // call lms::mod.rs::generate_key_pair() ? I think except the seed, all parameters for key-gen are irrelevant - // hss::reference_impl_private_key.rs : SeedAndLmsTreeIdentifier, - // hss::parameter.rs::HssParameter, - // used_leafs_index: &u32, - // aux_data: &mut Option, - // let _seed_and_lms_tree_identifier = SeedAndLmsTreeIdentifier::::default(); - //OsRng.fill_bytes(seed_and_lms_tree_identifier.seed.as_mut_slice()); - - // b) lms::definitions.rs::LmsPrivateKey::new() - // let mut private_key = LmsPrivateKey::new( - // seed_and_lms_tree_identifier.seed.clone(), - // seed_and_lms_tree_identifier.lms_tree_identifier, - // 0, - // LmotsAlgorithm::construct_default_parameter(), - // LmsAlgorithm::construct_default_parameter(), - //); - // 2. - call get_tree_element(idx, LmsPrivateKey, None) - - //Ok(verifying_key) + result } diff --git a/src/sst/helper.rs b/src/sst/helper.rs index cd0a801c..6c515587 100644 --- a/src/sst/helper.rs +++ b/src/sst/helper.rs @@ -15,7 +15,7 @@ fn get_num_leaves_in_sst(total_height: u8, top_div: u8) -> u32 { pub fn get_sst_first_leaf_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level - (((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div)) as u32 + ((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div) } // For a subtree, depending on whole SSTS and division, get last leaf idx where leafs start with 0 @@ -31,7 +31,7 @@ pub fn _get_sst_first_leaf_node_idx(signing_entity_idx: u8, total_height: u8, to assert!(signing_entity_idx > 0); assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level 2u32.pow(total_height as u32) - + (((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div)) as u32 + + (((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div)) } // For a subtree, depending on whole SSTS and division, get last leaf idx on whole SSTS diff --git a/src/sst/parameters.rs b/src/sst/parameters.rs index 81f98abc..4bdfbf2d 100644 --- a/src/sst/parameters.rs +++ b/src/sst/parameters.rs @@ -41,25 +41,6 @@ impl SstsParameter { } } -/* -impl SstsParameter { - pub fn construct_default_parameters() -> Self { - let lmots_parameter = LmotsAlgorithm::LmotsW1; - let lms_parameter = LmsAlgorithm::LmsH5; - - SstsParameter::new(lmots_parameter, lms_parameter, 3) - } -} - -impl Default for SstsParameter { - fn default() -> Self { - let lmots_parameter = LmotsAlgorithm::LmotsW1; - let lms_parameter = LmsAlgorithm::LmsH5; - - SstsParameter::new(lmots_parameter, lms_parameter, 3) - } -} - */ #[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] pub struct SstExtension { @@ -68,17 +49,19 @@ pub struct SstExtension { } impl SstExtension { - pub fn from_slice(data: &[u8]) -> Result { + + // TODO unlike in all other locations clippy reports + // "this returns a `Result<_, ()>`" and "use a custom `Error` type instead" + pub fn from_slice(data: &[u8]) -> Self { + if data.len() != constants::REF_IMPL_SSTS_EXT_SIZE { - return Err(()); + panic!("SstExtension::from_slice(): wrong data len"); + //return Err(Error::new()); } - let tmp: u16 = u16::from_be_bytes(data.try_into().unwrap()); - let sst_ext = SstExtension { + SstExtension { signing_instance: (tmp >> 8) as u8, top_tree_height: tmp as u8, - }; - - Ok(sst_ext) + } } } From 020abc9c8ec415c6e499762f0c73c0b8f2f59b2a Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Wed, 17 Jan 2024 15:12:20 +0100 Subject: [PATCH 27/43] sst: clean up and simplify key gen steps 1+2 --- examples/sst_demo.rs | 27 +++++++++++++------------ src/sst/gen_key.rs | 48 +++++++++++++++++++------------------------- 2 files changed, 35 insertions(+), 40 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 215dc1eb..9476bc5f 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -349,7 +349,7 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; // create our private key - let (signing_key, node_pubkey) = + let (signing_key, intermed_node_hashval) = genkey1_sst(&ssts_param, &seed, Some(aux_slice)).unwrap_or_else(|_| panic!("Could not generate keys")); let private_key_filename = get_private_key_filename(&keyname, ssts_param.get_entity_idx()); @@ -367,13 +367,13 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { &ssts_param.get_entity_idx().to_be_bytes(), )?; // and append - let mut interm_node_file = OpenOptions::new() + let mut intermed_node_file = OpenOptions::new() .create(true) .write(true) .append(true) .open(interm_node_filename.as_str()) .unwrap(); - interm_node_file.write_all(node_pubkey.as_slice())?; + intermed_node_file.write_all(intermed_node_hashval.as_slice())?; Ok(()) } @@ -400,19 +400,20 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { let private_key_name = get_private_key_filename(&keyname, signing_instance); let private_key_data = read_file(&private_key_name); + // here we need one additional API call so we know which files we have to read dep. on HSS config. - let (ssts_param, lms_tree_ident) = get_config::(&private_key_data) + let num_signing_entities = get_config::(&private_key_data) .unwrap_or_else(|_| panic!("genkey step 2: invalid config")); // TODO maybe compare with HSS configuration in the "node files" // read intermediate node values from files (ours and others) and pass for calc. - let num_signing_entities = 2u32.pow(ssts_param.get_top_height() as u32); let mut node_array: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]> = Default::default(); - for idx in 1..=num_signing_entities { + // let mut node_array: ArrayVec<[[u8; MAX_HASH_SIZE]; MAX_DSM_SIGNING_ENTITIES]> = ArrayVec::new(); + for idx in 1..=num_signing_entities { let interm_node_filename = String::from("node_si.") + &(idx.to_string()) + &String::from(".bin"); // TODO into function @@ -423,26 +424,26 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { ); } - // let mut node: ArrayVec<[u8; MAX_HASH_SIZE]> = Default::default(); - // node.push(file_data[1..]); // TODO easier? - // node_array[(idx-1) as usize].extend(&file_data[1..]); // TODO the following works but is a really bad inefficient solution + let mut node: [u8; MAX_HASH_SIZE] = [0; MAX_HASH_SIZE]; - node.copy_from_slice(&file_data[1..]); // TODO easier? + node.copy_from_slice(&file_data[1..]); node_array.push(node.into()); + + // TODO replace with this and adapt calls to functions + // let node: &[u8; MAX_HASH_SIZE] = file_data[1..].try_into().unwrap(); + // node_array.push(*node); } + let verifying_key = genkey2_sst::( &private_key_data, &node_array, - ssts_param.get_top_height(), // TODO remove - lms_tree_ident, // TODO remove Some(aux_slice), ).unwrap_or_else(|_| panic!("Could not generate verifying key")); //println!("pub key (node 1) hash value: {:?}", verifying_key); - // get public key (VerifyingKey) and write to file let aux_filename: String = get_aux_filename(&keyname, signing_instance); write(&aux_filename, aux_slice)?; diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index 058748cd..1a0644a8 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -4,9 +4,10 @@ use crate::{ constants::{D_INTR, MAX_DSM_SIGNING_ENTITIES, MAX_HASH_SIZE}, hasher::HashChain, hss::{ - definitions::HssPublicKey, + definitions::{HssPublicKey, HssPrivateKey}, reference_impl_private_key::{ReferenceImplPrivateKey, Seed}, SigningKey, VerifyingKey, + aux::hss_is_aux_data_used, }, lms::definitions::LmsPrivateKey, lms::helper::get_tree_element, @@ -24,9 +25,9 @@ pub fn genkey1_sst( ) -> Result<(SigningKey, ArrayVec<[u8; MAX_HASH_SIZE]>), Error> { // create two representations of private keys: ReferenceImplPrivateKey and SigningKey - let private_key = + let rfc_private_key = ReferenceImplPrivateKey::generate(sst_param, seed).map_err(|_| Error::new())?; - let signing_key = SigningKey::from_bytes(&private_key.to_binary_representation())?; + let signing_key = SigningKey::from_bytes(&rfc_private_key.to_binary_representation())?; // calculate our intermediate node hash value; for this we have to generate a LmsPrivateKey @@ -44,17 +45,17 @@ pub fn genkey1_sst( } // TODO: review! not exactly elegant to create an LmsPrivateKey and SeedAndLmsTreeIdentifier - let seed_and_lms_tree_ident = private_key.generate_root_seed_and_lms_tree_identifier(); + let seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); let sst_ext = SstExtension { - signing_instance: private_key.sst_ext.signing_instance, - top_tree_height: private_key.sst_ext.top_tree_height, + signing_instance: rfc_private_key.sst_ext.signing_instance, + top_tree_height: rfc_private_key.sst_ext.top_tree_height, }; let mut sst_ext_option = None; let mut our_node_index = 1; // TODO don't do that...we're calc. the TOTAL public key - if private_key.sst_ext.signing_instance != 0 { + if rfc_private_key.sst_ext.signing_instance != 0 { sst_ext_option = Some(sst_ext); our_node_index = get_subtree_node_idx( @@ -82,44 +83,37 @@ pub fn genkey1_sst( pub fn get_config( private_key: &[u8], -) -> Result<(SstsParameter, LmsTreeIdentifier), Error> { +) -> Result { let rfc_private_key = ReferenceImplPrivateKey::::from_binary_representation(private_key) .map_err(|_| Error::new())?; - let hss_pubkey = HssPublicKey::from(&rfc_private_key, None).map_err(|_| Error::new())?; - let lms_tree_ident = hss_pubkey.public_key.lms_tree_identifier; + let num_signing_entities = 2u32.pow(rfc_private_key.sst_ext.top_tree_height as u32); - let hss_param_vec = rfc_private_key - .compressed_parameter - .to() - .map_err(|_| Error::new())?; - - let ssts_param = SstsParameter::new( - hss_param_vec, - rfc_private_key.sst_ext.top_tree_height, - rfc_private_key.sst_ext.signing_instance, - ); - - Ok((ssts_param, lms_tree_ident)) + Ok(num_signing_entities) } pub fn genkey2_sst( private_key: &[u8], av_of_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, - top_tree_height: u8, // TODO replace/remove (we have private_key) - lms_tree_ident: LmsTreeIdentifier, // TODO replace/remove (we have private_key) aux_data: Option<&mut &mut [u8]> ) -> Result, Error> { - let pubkey_hash_val = get_node_hash_val::(1, av_of_nodes, top_tree_height, lms_tree_ident); - let rfc_private_key = ReferenceImplPrivateKey::::from_binary_representation(private_key) .map_err(|_| Error::new())?; - // this public key has the wrong node hash vlaue, because it did not yet consider the other signing entities with their different private keys + let seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); + let lms_tree_ident = seed_and_lms_tree_ident.lms_tree_identifier; + + + let pubkey_hash_val = get_node_hash_val::( + 1, av_of_nodes, rfc_private_key.sst_ext.top_tree_height, lms_tree_ident); + + // this public key has the wrong node hash value, because it did not yet consider the other signing entities with their different private keys let mut hss_public_key = HssPublicKey::from(&rfc_private_key, aux_data).map_err(|_| Error::new())?; // so replace the hash value with the one calc. via signing entity nodes hss_public_key.public_key.key = pubkey_hash_val; + // we also need to fix AUX data with the values from the other signing entities + //fix_aux_data(&rfc_private_key, av_of_nodes, aux_data); let verifying_key = VerifyingKey::::from_bytes(&hss_public_key.to_binary_representation())?; From 93a1c08e48117f6f74f03476778b250f927bee6c Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Fri, 19 Jan 2024 13:09:01 +0100 Subject: [PATCH 28/43] sst: Complete and fix public keygen with AUX data - improve and clean up example code and API calls to lib code - add adapted HssPublicKey "from()" method for SST to adapt AUX data, - store other nodes intermediate data in AUX data - use public key generated via signing entity intermediate nodes in HssPublicKey - fix sst helper functions --- examples/sst_demo.rs | 4 +-- src/hss/definitions.rs | 73 ++++++++++++++++++++++++++++++++++++++++-- src/sst/gen_key.rs | 20 ++++-------- src/sst/helper.rs | 22 ++++++------- 4 files changed, 90 insertions(+), 29 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 9476bc5f..a92e3365 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -400,9 +400,8 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { let private_key_name = get_private_key_filename(&keyname, signing_instance); let private_key_data = read_file(&private_key_name); - // here we need one additional API call so we know which files we have to read dep. on HSS config. - let num_signing_entities = get_config::(&private_key_data) + let num_signing_entities = get_num_signing_entities::(&private_key_data) .unwrap_or_else(|_| panic!("genkey step 2: invalid config")); // TODO maybe compare with HSS configuration in the "node files" @@ -435,7 +434,6 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { // node_array.push(*node); } - let verifying_key = genkey2_sst::( &private_key_data, &node_array, diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index 789113fc..cd562ac0 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -3,10 +3,10 @@ use core::convert::TryInto; use tinyvec::ArrayVec; use crate::{ - constants::{MAX_ALLOWED_HSS_LEVELS, MAX_HSS_PUBLIC_KEY_LENGTH}, + constants::{MAX_ALLOWED_HSS_LEVELS, MAX_HSS_PUBLIC_KEY_LENGTH, MAX_DSM_SIGNING_ENTITIES, MAX_HASH_SIZE}, hasher::HashChain, hss::aux::{ - hss_expand_aux_data, hss_finalize_aux_data, hss_optimal_aux_level, hss_store_aux_marker, + hss_expand_aux_data, hss_finalize_aux_data, hss_optimal_aux_level, hss_store_aux_marker, hss_save_aux_data }, lms::{ self, @@ -14,6 +14,7 @@ use crate::{ generate_key_pair, parameters::LmsParameter, }, + sst::helper::get_subtree_node_idx, parameters::SstExtension, util::helper::read_and_advance, }; @@ -228,6 +229,74 @@ impl HssPublicKey { }) } + // same as above, but to keep the function's signature, we add a variant for SSTS + pub fn from_with_sst( + private_key: &ReferenceImplPrivateKey, + aux_data: Option<&mut &mut [u8]>, + intermed_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, + pubkey_hashval: ArrayVec<[u8; MAX_HASH_SIZE]>, + ) -> Result { + let parameters = private_key.compressed_parameter.to::()?; + let levels = parameters.len(); + let used_leafs_indexes = private_key.compressed_used_leafs_indexes.to(¶meters); + + let top_lms_parameter = parameters[0].get_lms_parameter(); // TODO: "[0]": discuss/review for SST + + let is_aux_data_used = if let Some(ref aux_data) = aux_data { + hss_is_aux_data_used(aux_data) + } else { + false + }; + + let mut expanded_aux_data = HssPrivateKey::get_expanded_aux_data( + aux_data, + private_key, + top_lms_parameter, // TODO only top is forwarded to LmsPrivateKey for SST params + is_aux_data_used, + ); + + let current_seed = private_key.generate_root_seed_and_lms_tree_identifier(); + + let mut sst_ext_option = None; + let sst_ext = SstExtension { + signing_instance: private_key.sst_ext.signing_instance, + top_tree_height: private_key.sst_ext.top_tree_height, + }; + if private_key.sst_ext.signing_instance != 0 { + sst_ext_option = Some(sst_ext); + } + + let mut lms_keypair = generate_key_pair( + ¤t_seed, + ¶meters[0], + &used_leafs_indexes[0], + &mut expanded_aux_data, + sst_ext_option, + ); + + // Addition for SSTS: replace public key node value + lms_keypair.public_key.key = pubkey_hashval; + + if let Some(expanded_aux_data) = expanded_aux_data.as_mut() { + // Additions for SSTS: fix aux data with intermediate node values from other signing entities + let num_signing_instances = 2usize.pow(private_key.sst_ext.top_tree_height as u32); + for si in 1..=num_signing_instances as u8 { + // node index of SI intermed node in whole tree: + let idx: usize = get_subtree_node_idx(si, top_lms_parameter.get_tree_height(), private_key.sst_ext.top_tree_height) as usize; + hss_save_aux_data::(expanded_aux_data, idx, intermed_nodes[(si-1) as usize].as_slice()); + } + + if !is_aux_data_used { + hss_finalize_aux_data::(expanded_aux_data, private_key.seed.as_slice()); + } + } + + Ok(Self { + public_key: lms_keypair.public_key, + level: levels, + }) + } + pub fn to_binary_representation(&self) -> ArrayVec<[u8; MAX_HSS_PUBLIC_KEY_LENGTH]> { let mut result = ArrayVec::new(); diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index 1a0644a8..b28b8e10 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -4,10 +4,9 @@ use crate::{ constants::{D_INTR, MAX_DSM_SIGNING_ENTITIES, MAX_HASH_SIZE}, hasher::HashChain, hss::{ - definitions::{HssPublicKey, HssPrivateKey}, + definitions::HssPublicKey, reference_impl_private_key::{ReferenceImplPrivateKey, Seed}, SigningKey, VerifyingKey, - aux::hss_is_aux_data_used, }, lms::definitions::LmsPrivateKey, lms::helper::get_tree_element, @@ -81,7 +80,7 @@ pub fn genkey1_sst( Ok((signing_key, our_node_value)) } -pub fn get_config( +pub fn get_num_signing_entities( private_key: &[u8], ) -> Result { let rfc_private_key = ReferenceImplPrivateKey::::from_binary_representation(private_key) @@ -94,7 +93,7 @@ pub fn get_config( pub fn genkey2_sst( private_key: &[u8], - av_of_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, + interm_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, aux_data: Option<&mut &mut [u8]> ) -> Result, Error> { @@ -104,16 +103,11 @@ pub fn genkey2_sst( let seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); let lms_tree_ident = seed_and_lms_tree_ident.lms_tree_identifier; - let pubkey_hash_val = get_node_hash_val::( - 1, av_of_nodes, rfc_private_key.sst_ext.top_tree_height, lms_tree_ident); - - // this public key has the wrong node hash value, because it did not yet consider the other signing entities with their different private keys - let mut hss_public_key = HssPublicKey::from(&rfc_private_key, aux_data).map_err(|_| Error::new())?; - // so replace the hash value with the one calc. via signing entity nodes - hss_public_key.public_key.key = pubkey_hash_val; - // we also need to fix AUX data with the values from the other signing entities - //fix_aux_data(&rfc_private_key, av_of_nodes, aux_data); + 1, interm_nodes, rfc_private_key.sst_ext.top_tree_height, lms_tree_ident); + + let hss_public_key = HssPublicKey::from_with_sst( + &rfc_private_key, aux_data, interm_nodes, pubkey_hash_val).map_err(|_| Error::new())?; let verifying_key = VerifyingKey::::from_bytes(&hss_public_key.to_binary_representation())?; diff --git a/src/sst/helper.rs b/src/sst/helper.rs index 6c515587..25867f37 100644 --- a/src/sst/helper.rs +++ b/src/sst/helper.rs @@ -2,9 +2,9 @@ // subtree_num counts from left-most = 1 to top part's "number_of_leaves" pub fn get_subtree_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); - assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level + assert!(signing_entity_idx as u32 <= get_num_leaves(top_div)); // number of nodes at that level assert!(top_div <= total_height); - 2u32.pow(top_div as u32) - 1 + (signing_entity_idx as u32) + 2u32.pow(top_div as u32) + (signing_entity_idx as u32) - 1 } fn get_num_leaves_in_sst(total_height: u8, top_div: u8) -> u32 { @@ -14,22 +14,22 @@ fn get_num_leaves_in_sst(total_height: u8, top_div: u8) -> u32 { // For a subtree, depending on whole SSTS and division, get first leaf idx where leafs start with 0 pub fn get_sst_first_leaf_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); - assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level + assert!(signing_entity_idx as u32 <= get_num_leaves(top_div)); // number of nodes at that level ((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div) } // For a subtree, depending on whole SSTS and division, get last leaf idx where leafs start with 0 pub fn get_sst_last_leaf_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); - assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level - get_sst_first_leaf_idx(signing_entity_idx, total_height, top_div) - 1 - + get_num_leaves_in_sst(total_height, top_div) + assert!(signing_entity_idx as u32 <= get_num_leaves(top_div)); // number of nodes at that level + get_sst_first_leaf_idx(signing_entity_idx, total_height, top_div) + + get_num_leaves_in_sst(total_height, top_div) - 1 } // For a subtree, depending on whole SSTS and division, get first leaf idx on whole SSTS pub fn _get_sst_first_leaf_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); - assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level + assert!(signing_entity_idx as u32 <= get_num_leaves(top_div)); // number of nodes at that level 2u32.pow(total_height as u32) + (((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div)) } @@ -37,13 +37,13 @@ pub fn _get_sst_first_leaf_node_idx(signing_entity_idx: u8, total_height: u8, to // For a subtree, depending on whole SSTS and division, get last leaf idx on whole SSTS pub fn _get_sst_last_leaf_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { assert!(signing_entity_idx > 0); - assert!(signing_entity_idx as u32 <= _get_num_leaves(top_div)); // number of nodes at that level - _get_sst_first_leaf_node_idx(signing_entity_idx, total_height, top_div) - 1 - + get_num_leaves_in_sst(total_height, top_div) + assert!(signing_entity_idx as u32 <= get_num_leaves(top_div)); // number of nodes at that level + _get_sst_first_leaf_node_idx(signing_entity_idx, total_height, top_div) + + get_num_leaves_in_sst(total_height, top_div) - 1 } // number of leaves of a Merkle tree -fn _get_num_leaves(height: u8) -> u32 { +fn get_num_leaves(height: u8) -> u32 { 2u32.pow(height as u32) } From 31a28529ad6429a5b1a439b038f9ca497f89a77f Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Fri, 26 Jan 2024 11:07:36 +0100 Subject: [PATCH 29/43] sst: fix SST ext. var names & sst_demo filenames --- examples/sst_demo.rs | 72 +++++++++++++++------------ src/constants.rs | 4 +- src/hss/aux.rs | 20 ++++---- src/hss/definitions.rs | 34 ++++++------- src/hss/reference_impl_private_key.rs | 14 +++--- src/lms/definitions.rs | 4 +- src/sst/gen_key.rs | 30 +++++------ src/sst/parameters.rs | 25 +++++----- 8 files changed, 107 insertions(+), 96 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index a92e3365..385c783b 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -20,7 +20,7 @@ const SIGN_MUT_COMMAND: &str = "sign_mut"; const ARG_KEYNAME: &str = "keyname"; const ARG_MESSAGE: &str = "file"; const ARG_GENKEY1_PARAMETER: &str = "parameter"; -const ARG_SI_PARAMETER: &str = "si_param"; +const ARG_SIGN_ENTITY_IDX_PARAMETER: &str = "se_param"; const ARG_SEED: &str = "seed"; const ARG_AUXSIZE: &str = "auxsize"; @@ -90,8 +90,8 @@ fn main() -> Result<(), Box> { .subcommand( Command::new(GENKEY2_COMMAND) .arg(Arg::new(ARG_KEYNAME).required(true)) - .arg(Arg::new(ARG_SI_PARAMETER).required(true).help( - "Specify signing instance number (1..n))")) + .arg(Arg::new(ARG_SIGN_ENTITY_IDX_PARAMETER).required(true).help( + "Specify signing entity index (1..n))")) .arg(Arg::new(ARG_AUXSIZE).long(ARG_AUXSIZE).required(false).takes_value(true).value_name("auxsize").help( "Specify AUX data size in bytes")) ) @@ -159,19 +159,17 @@ fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { let keyname = get_parameter(ARG_KEYNAME, args); let message_name = get_parameter(ARG_MESSAGE, args); - // TODO signing entity idx - let private_key_name = get_private_key_filename(&keyname, 1); - let signature_name = get_signature_filename(&message_name); + let private_key_filename = get_private_key_filename(&keyname, None); + let signature_filename = get_signature_filename(&message_name); - let private_key_data = read_file(&private_key_name); + let private_key_data = read_file(&private_key_filename); let message_data = read_file(&message_name); - // TODO signing entity idx - let aux_data_name = get_aux_filename(&keyname, 1); - let mut aux_data = read(aux_data_name).ok(); + let aux_data_filename = get_aux_filename(&keyname, None); + let mut aux_data = read(aux_data_filename).ok(); let mut private_key_update_function = |new_key: &[u8]| { - if write(&private_key_name, new_key).is_ok() { + if write(&private_key_filename, new_key).is_ok() { return Ok(()); } Err(()) @@ -199,7 +197,7 @@ fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { exit(-1) } - write(&signature_name, result.unwrap().as_ref())?; + write(&signature_filename, result.unwrap().as_ref())?; Ok(()) } @@ -269,7 +267,7 @@ fn verify(args: &ArgMatches) -> bool { let message_name: String = get_parameter(ARG_MESSAGE, args); // TODO: signing entity idx - let public_key_name = get_public_key_filename(&keyname, 1); + let public_key_name = get_public_key_filename(&keyname, None); let signature_name = get_signature_filename(&message_name); let signature_data = read_file(&signature_name); @@ -279,8 +277,12 @@ fn verify(args: &ArgMatches) -> bool { hbs_lms::verify::(&message_data, &signature_data, &public_key_data).is_ok() } -fn get_public_key_filename(keyname: &str, idx: u8) -> String { - keyname.to_string() + "." + &idx.to_string() + ".pub" +fn get_public_key_filename(keyname: &str, idx: Option) -> String { + if let Some(idx) = idx { + keyname.to_string() + "." + &idx.to_string() + ".pub" + } else { + keyname.to_string() + ".pub" + } } fn get_signature_filename(message_name: &str) -> String { @@ -297,12 +299,20 @@ fn get_message_mut_filename(message_name: &str) -> String { message_name.to_string() + "_mut" } -fn get_private_key_filename(private_key: &str, idx: u8) -> String { - private_key.to_string() + "." + &idx.to_string() + ".prv" +fn get_private_key_filename(private_key: &str, idx: Option) -> String { + if let Some(idx) = idx { + private_key.to_string() + "." + &idx.to_string() + ".prv" + } else { + private_key.to_string() + ".prv" + } } -fn get_aux_filename(keyname: &str, idx: u8) -> String { - keyname.to_string() + "." + &idx.to_string() + ".aux" +fn get_aux_filename(keyname: &str, idx: Option) -> String { + if let Some(idx) = idx { + keyname.to_string() + "." + &idx.to_string() + ".aux" + } else { + keyname.to_string() + ".aux" + } } fn get_parameter(name: &str, args: &ArgMatches) -> String { @@ -352,19 +362,19 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { let (signing_key, intermed_node_hashval) = genkey1_sst(&ssts_param, &seed, Some(aux_slice)).unwrap_or_else(|_| panic!("Could not generate keys")); - let private_key_filename = get_private_key_filename(&keyname, ssts_param.get_entity_idx()); + let private_key_filename = get_private_key_filename(&keyname, Some(ssts_param.get_signing_entity_idx())); write(private_key_filename.as_str(), signing_key.as_slice())?; - // write own node value and signing instance to file - // TODO maybe also HSS/LMS/LM-OTS parameters, to ensure that we got the same parameters among all signing instances + // write own node value and signing entity to file + // TODO maybe also HSS/LMS/LM-OTS parameters, to ensure that we got the same parameters among all signing entities let interm_node_filename = String::from("node_si.") - + &(ssts_param.get_entity_idx().to_string()) + + &(ssts_param.get_signing_entity_idx().to_string()) + &String::from(".bin"); // TODO into function // if file exists, overwrite write( interm_node_filename.as_str(), - &ssts_param.get_entity_idx().to_be_bytes(), + &ssts_param.get_signing_entity_idx().to_be_bytes(), )?; // and append let mut intermed_node_file = OpenOptions::new() @@ -379,12 +389,12 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { } fn genkey2(args: &ArgMatches) -> Result<(), Box> { - // get signing instance number and name of private keyfile from args + // get signing entity number and name of private keyfile from args let keyname: String = get_parameter(ARG_KEYNAME, args); - let signing_instance: String = get_parameter(ARG_SI_PARAMETER, args); + let signing_entity: String = get_parameter(ARG_SIGN_ENTITY_IDX_PARAMETER, args); let aux_size: String = get_parameter(ARG_AUXSIZE, args); - let signing_instance: u8 = signing_instance.parse::().unwrap(); + let signing_entity: u8 = signing_entity.parse::().unwrap(); // AUX data: currently we create it only in genkey2 let mut aux_data = vec![0u8; aux_size.parse::().unwrap()]; @@ -394,10 +404,10 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { //let mut aux_data = read(aux_data_name).ok(); //let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; - // println!("keyname: {} -- SI: {} -- aux_size: {}", keyname, signing_instance, aux_size); + // println!("keyname: {} -- SI: {} -- aux_size: {}", keyname, signing_entity, aux_size); // read private key - let private_key_name = get_private_key_filename(&keyname, signing_instance); + let private_key_name = get_private_key_filename(&keyname, Some(signing_entity)); let private_key_data = read_file(&private_key_name); // here we need one additional API call so we know which files we have to read dep. on HSS config. @@ -442,10 +452,10 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { //println!("pub key (node 1) hash value: {:?}", verifying_key); - let aux_filename: String = get_aux_filename(&keyname, signing_instance); + let aux_filename: String = get_aux_filename(&keyname, Some(signing_entity)); write(&aux_filename, aux_slice)?; - let public_key_filename = get_public_key_filename(&keyname, signing_instance); + let public_key_filename = get_public_key_filename(&keyname, Some(signing_entity)); write(public_key_filename.as_str(), verifying_key.as_slice())?; Ok(()) diff --git a/src/constants.rs b/src/constants.rs index acf64654..ad90002d 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -69,8 +69,8 @@ pub const MAX_HSS_SIGNED_PUBLIC_KEY_LENGTH: usize = pub const MAX_HSS_SIGNATURE_LENGTH: usize = get_hss_signature_length(); // DSM = Distributed State Management -// pub const _MAX_DSM_TOP_TREE_HEIGHT: usize = 8; -pub const MAX_DSM_SIGNING_ENTITIES: usize = 256; // TODO calc via 2^MAX_DSM_TOP_TREE_HEIGHT +// pub const _MAX_DSM_TOP_DIV_HEIGHT: usize = 8; +pub const MAX_DSM_SIGNING_ENTITIES: usize = 256; // TODO calc via 2^MAX_DSM_TOP_DIV_HEIGHT /// Calculated using the formula from RFC 8554 Appendix B /// https://datatracker.ietf.org/doc/html/rfc8554#appendix-B diff --git a/src/hss/aux.rs b/src/hss/aux.rs index 06f017a2..2c9b2ad0 100644 --- a/src/hss/aux.rs +++ b/src/hss/aux.rs @@ -39,7 +39,7 @@ pub fn hss_optimal_aux_level( mut max_length: usize, lms_parameter: LmsParameter, actual_len: Option<&mut usize>, - top_tree_height: Option, + top_div_height: Option, ) -> AuxLevel { let mut aux_level = AuxLevel::default(); @@ -52,20 +52,20 @@ pub fn hss_optimal_aux_level( // if SST is used, leave space for signing entity node values depending on their level! let mut size_for_signing_entity_nodes: usize = 0; - if let Some(top_tree_height) = top_tree_height { - size_for_signing_entity_nodes = 2usize.pow(top_tree_height as u32) * size_hash; + if let Some(top_div_height) = top_div_height { + size_for_signing_entity_nodes = 2usize.pow(top_div_height as u32) * size_hash; - min_top_level = top_tree_height + 1; // so we don't fill above our intermediate node values + min_top_level = top_div_height + 1; // so we don't fill above our intermediate node values // add level to level bit, later abort if max_length too small - aux_level |= 0x80000000 | (1 << top_tree_height); + aux_level |= 0x80000000 | (1 << top_div_height); } let min_length = AUX_DATA_HASHES + size_hash + size_for_signing_entity_nodes; if max_length < min_length { - if let Some(top_tree_height) = top_tree_height { - panic!("AUX data size = {} too small to store intermediate node values for dist. state mgmt with top_tree_height {}.", - orig_max_length, top_tree_height); + if let Some(top_div_height) = top_div_height { + panic!("AUX data size = {} too small to store intermediate node values for dist. state mgmt with top_div_height {}.", + orig_max_length, top_div_height); } else { if let Some(actual_len) = actual_len { *actual_len = 1; // ?? @@ -158,11 +158,11 @@ pub fn hss_expand_aux_data<'a, H: HashChain>( pub fn hss_get_aux_data_len( max_length: usize, lms_parameter: LmsParameter, - top_tree_height: Option, + top_div_height: Option, ) -> usize { let mut len = 0; - if hss_optimal_aux_level(max_length, lms_parameter, Some(&mut len), top_tree_height) == 0 { + if hss_optimal_aux_level(max_length, lms_parameter, Some(&mut len), top_div_height) == 0 { return 1; } diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index cd562ac0..5ce09478 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -52,10 +52,10 @@ impl HssPrivateKey { let mut sst_ext_option = None; let sst_ext = SstExtension { - signing_instance: private_key.sst_ext.signing_instance, - top_tree_height: private_key.sst_ext.top_tree_height, + signing_entity_idx: private_key.sst_ext.signing_entity_idx, + top_div_height: private_key.sst_ext.top_div_height, }; - if private_key.sst_ext.signing_instance != 0 { + if private_key.sst_ext.signing_entity_idx != 0 { sst_ext_option = Some(sst_ext); } @@ -115,19 +115,19 @@ impl HssPrivateKey { return hss_expand_aux_data::(Some(aux_data), Some(private_key.seed.as_slice())); } - let top_tree_height = private_key.sst_ext.top_tree_height; - let opt_top_tree_height = if 0 == top_tree_height { + let top_div_height = private_key.sst_ext.top_div_height; + let opt_top_div_height = if 0 == top_div_height { None } else { - Some(top_tree_height) + Some(top_div_height) }; // Shrink input slice - let aux_len = hss_get_aux_data_len(aux_data.len(), *top_lms_parameter, opt_top_tree_height); + let aux_len = hss_get_aux_data_len(aux_data.len(), *top_lms_parameter, opt_top_div_height); let moved = core::mem::take(aux_data); *aux_data = &mut moved[..aux_len]; - let aux_level = hss_optimal_aux_level(aux_len, *top_lms_parameter, None, opt_top_tree_height); + let aux_level = hss_optimal_aux_level(aux_len, *top_lms_parameter, None, opt_top_div_height); hss_store_aux_marker(aux_data, aux_level); hss_expand_aux_data::(Some(aux_data), None) @@ -202,10 +202,10 @@ impl HssPublicKey { let mut sst_ext_option = None; let sst_ext = SstExtension { - signing_instance: private_key.sst_ext.signing_instance, - top_tree_height: private_key.sst_ext.top_tree_height, + signing_entity_idx: private_key.sst_ext.signing_entity_idx, + top_div_height: private_key.sst_ext.top_div_height, }; - if private_key.sst_ext.signing_instance != 0 { + if private_key.sst_ext.signing_entity_idx != 0 { sst_ext_option = Some(sst_ext); } @@ -259,10 +259,10 @@ impl HssPublicKey { let mut sst_ext_option = None; let sst_ext = SstExtension { - signing_instance: private_key.sst_ext.signing_instance, - top_tree_height: private_key.sst_ext.top_tree_height, + signing_entity_idx: private_key.sst_ext.signing_entity_idx, + top_div_height: private_key.sst_ext.top_div_height, }; - if private_key.sst_ext.signing_instance != 0 { + if private_key.sst_ext.signing_entity_idx != 0 { sst_ext_option = Some(sst_ext); } @@ -279,10 +279,10 @@ impl HssPublicKey { if let Some(expanded_aux_data) = expanded_aux_data.as_mut() { // Additions for SSTS: fix aux data with intermediate node values from other signing entities - let num_signing_instances = 2usize.pow(private_key.sst_ext.top_tree_height as u32); - for si in 1..=num_signing_instances as u8 { + let num_signing_entities = 2usize.pow(private_key.sst_ext.top_div_height as u32); + for si in 1..=num_signing_entities as u8 { // node index of SI intermed node in whole tree: - let idx: usize = get_subtree_node_idx(si, top_lms_parameter.get_tree_height(), private_key.sst_ext.top_tree_height) as usize; + let idx: usize = get_subtree_node_idx(si, top_lms_parameter.get_tree_height(), private_key.sst_ext.top_div_height) as usize; hss_save_aux_data::(expanded_aux_data, idx, intermed_nodes[(si-1) as usize].as_slice()); } diff --git a/src/hss/reference_impl_private_key.rs b/src/hss/reference_impl_private_key.rs index b2f3626c..a38250f7 100644 --- a/src/hss/reference_impl_private_key.rs +++ b/src/hss/reference_impl_private_key.rs @@ -105,19 +105,19 @@ impl ReferenceImplPrivateKey { pub fn generate(parameters: &SstsParameter, seed: &Seed) -> Result { let sst_ext = SstExtension { - signing_instance: parameters.get_entity_idx(), - top_tree_height: parameters.get_top_height(), + signing_entity_idx: parameters.get_signing_entity_idx(), + top_div_height: parameters.get_top_div_height(), }; let hss_params = parameters.get_hss_parameters(); let top_lms_parameter = hss_params[0].get_lms_parameter(); let mut used_leafs_index = 0; - if parameters.get_top_height() != 0 { + if parameters.get_top_div_height() != 0 { used_leafs_index = helper::get_sst_first_leaf_idx( - sst_ext.signing_instance, + sst_ext.signing_entity_idx, top_lms_parameter.get_tree_height(), - sst_ext.top_tree_height, + sst_ext.top_div_height, ); } @@ -134,8 +134,8 @@ impl ReferenceImplPrivateKey { pub fn to_binary_representation(&self) -> ArrayVec<[u8; REF_IMPL_MAX_PRIVATE_KEY_SIZE]> { let mut result = ArrayVec::new(); - result.extend_from_slice(&self.sst_ext.signing_instance.to_be_bytes()); - result.extend_from_slice(&self.sst_ext.top_tree_height.to_be_bytes()); + result.extend_from_slice(&self.sst_ext.signing_entity_idx.to_be_bytes()); + result.extend_from_slice(&self.sst_ext.top_div_height.to_be_bytes()); result.extend_from_slice(&self.compressed_used_leafs_indexes.count.to_be_bytes()); result.extend_from_slice(&self.compressed_parameter.0); result.extend_from_slice(self.seed.as_slice()); diff --git a/src/lms/definitions.rs b/src/lms/definitions.rs index b5937586..3a352f99 100644 --- a/src/lms/definitions.rs +++ b/src/lms/definitions.rs @@ -52,9 +52,9 @@ impl LmsPrivateKey { if let Some(my_sst_ext) = &self.sst_ext { // our last leafs function returns 0..total_num-1, but here we need 1..total_num 1 + get_sst_last_leaf_idx( - my_sst_ext.signing_instance, + my_sst_ext.signing_entity_idx, self.lms_parameter.get_tree_height(), - my_sst_ext.top_tree_height, + my_sst_ext.top_div_height, ) } else { self.lms_parameter.number_of_lm_ots_keys() as u32 diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index b28b8e10..74e9ac18 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -32,14 +32,14 @@ pub fn genkey1_sst( // TODO review: better option? it's somehow redundant (used leafs calculation) let mut used_leafs_index = 0; - if sst_param.get_top_height() != 0 { + if sst_param.get_top_div_height() != 0 { // TODO: is there a better (Rust-idiomatic) approach? used_leafs_index = helper::get_sst_first_leaf_idx( - sst_param.get_entity_idx(), + sst_param.get_signing_entity_idx(), sst_param.get_hss_parameters()[0] .get_lms_parameter() .get_tree_height(), - sst_param.get_top_height(), + sst_param.get_top_div_height(), ); } @@ -47,22 +47,22 @@ pub fn genkey1_sst( let seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); let sst_ext = SstExtension { - signing_instance: rfc_private_key.sst_ext.signing_instance, - top_tree_height: rfc_private_key.sst_ext.top_tree_height, + signing_entity_idx: rfc_private_key.sst_ext.signing_entity_idx, + top_div_height: rfc_private_key.sst_ext.top_div_height, }; let mut sst_ext_option = None; let mut our_node_index = 1; // TODO don't do that...we're calc. the TOTAL public key - if rfc_private_key.sst_ext.signing_instance != 0 { + if rfc_private_key.sst_ext.signing_entity_idx != 0 { sst_ext_option = Some(sst_ext); our_node_index = get_subtree_node_idx( - sst_param.get_entity_idx(), + sst_param.get_signing_entity_idx(), sst_param.get_hss_parameters()[0] .get_lms_parameter() .get_tree_height(), - sst_param.get_top_height(), + sst_param.get_top_div_height(), ); } @@ -86,7 +86,7 @@ pub fn get_num_signing_entities( let rfc_private_key = ReferenceImplPrivateKey::::from_binary_representation(private_key) .map_err(|_| Error::new())?; - let num_signing_entities = 2u32.pow(rfc_private_key.sst_ext.top_tree_height as u32); + let num_signing_entities = 2u32.pow(rfc_private_key.sst_ext.top_div_height as u32); Ok(num_signing_entities) } @@ -104,7 +104,7 @@ pub fn genkey2_sst( let lms_tree_ident = seed_and_lms_tree_ident.lms_tree_identifier; let pubkey_hash_val = get_node_hash_val::( - 1, interm_nodes, rfc_private_key.sst_ext.top_tree_height, lms_tree_ident); + 1, interm_nodes, rfc_private_key.sst_ext.top_div_height, lms_tree_ident); let hss_public_key = HssPublicKey::from_with_sst( &rfc_private_key, aux_data, interm_nodes, pubkey_hash_val).map_err(|_| Error::new())?; @@ -117,7 +117,7 @@ pub fn genkey2_sst( fn get_node_hash_val( index: u32, av_of_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, - top_tree_height: u8, + top_div_height: u8, lms_tree_ident: LmsTreeIdentifier, ) -> ArrayVec<[u8; MAX_HASH_SIZE]> { let index_level = @@ -128,16 +128,16 @@ fn get_node_hash_val( .chain((index).to_be_bytes()); // if index is at lowest level (where we have the signing entity node hash values) - let result = if index_level == top_tree_height { + let result = if index_level == top_div_height { // return the node value from array of intermedediate node hash values /* access vector elements via "leaf numbers" = 0..signing_entites-1 */ - let leaf_number = (index as usize) - 2usize.pow(top_tree_height as u32); + let leaf_number = (index as usize) - 2usize.pow(top_div_height as u32); av_of_nodes[leaf_number] } else { // we are "above" the intermediate node hash values -> go down - let left = get_node_hash_val::(index * 2, av_of_nodes, top_tree_height, lms_tree_ident); + let left = get_node_hash_val::(index * 2, av_of_nodes, top_div_height, lms_tree_ident); let right = - get_node_hash_val::(index * 2 + 1, av_of_nodes, top_tree_height, lms_tree_ident); + get_node_hash_val::(index * 2 + 1, av_of_nodes, top_div_height, lms_tree_ident); hasher .chain(D_INTR) diff --git a/src/sst/parameters.rs b/src/sst/parameters.rs index 4bdfbf2d..27bda1c6 100644 --- a/src/sst/parameters.rs +++ b/src/sst/parameters.rs @@ -7,7 +7,8 @@ use zeroize::{Zeroize, ZeroizeOnDrop}; #[derive(Clone, PartialEq, Eq)] pub struct SstsParameter { hss_parameters: ArrayVec<[HssParameter; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]>, - top_height: u8, + // TODO use SstExtension here? + top_div_height: u8, signing_entity_idx: u8, // starting with 1 } @@ -16,13 +17,13 @@ impl Copy for SstsParameter {} impl SstsParameter { pub fn new( hss_params: ArrayVec<[HssParameter; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]>, - top_height: u8, - entity_idx: u8, + top_div_height: u8, + signing_entity_idx: u8, ) -> Self { SstsParameter { hss_parameters: hss_params, - top_height, // e.g. LMS height of 5 and top_height 3: division top/bottom is 3/2 which would result in 2^3 = 8 signing entities - signing_entity_idx: entity_idx, + top_div_height, // e.g. LMS height of 5 and top_div_height 3: division top/bottom is 3/2 which would result in 2^3 = 8 signing entities + signing_entity_idx, } } @@ -32,11 +33,11 @@ impl SstsParameter { &self.hss_parameters } - pub fn get_top_height(&self) -> u8 { - self.top_height + pub fn get_top_div_height(&self) -> u8 { + self.top_div_height } - pub fn get_entity_idx(&self) -> u8 { + pub fn get_signing_entity_idx(&self) -> u8 { self.signing_entity_idx } } @@ -44,8 +45,8 @@ impl SstsParameter { #[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] pub struct SstExtension { - pub signing_instance: u8, - pub top_tree_height: u8, + pub signing_entity_idx: u8, + pub top_div_height: u8, } impl SstExtension { @@ -60,8 +61,8 @@ impl SstExtension { } let tmp: u16 = u16::from_be_bytes(data.try_into().unwrap()); SstExtension { - signing_instance: (tmp >> 8) as u8, - top_tree_height: tmp as u8, + signing_entity_idx: (tmp >> 8) as u8, + top_div_height: tmp as u8, } } } From afeda442dbd2c605f74a041df381474c1665fb01 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Fri, 26 Jan 2024 13:16:08 +0100 Subject: [PATCH 30/43] sst: Add script for key generation - Generate keys for several signing entities (via parameter) --- res/dist_state_mgmt.py | 82 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 res/dist_state_mgmt.py diff --git a/res/dist_state_mgmt.py b/res/dist_state_mgmt.py new file mode 100755 index 00000000..d2bc2024 --- /dev/null +++ b/res/dist_state_mgmt.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 + +#!/mnt/daten/dev/hbs-lms-rust-priv.git/.venv/bin/python +# TODO how to avoid an absolute path? +# TODO add several HSS parameters + +import sys, subprocess, shlex, math, argparse + + +def parse(): + parser = argparse.ArgumentParser( + prog='dist_state_mgmt', + description='Calls demo application to generate keys for several signing entities.') + + parser.add_argument('--se', dest='se', type=int, help="number of signing entities (power of 2)") # we derive the top division from that + parser.add_argument('--hss', dest='hss', help="HSS parameters; currently only one HSS level supported, e.g. 10/2 = LMS-height / Winternitz-param.") + + args = parser.parse_args() + + return args + + +def main(): + + args = parse() + args = vars(args) + print("args: ", args) + + print("Executing \"sst_demo\" genkey1 and genkey2 with:") + number_of_signing_entities = args['se'] + print("Number of signing entities: ", number_of_signing_entities) + + hss_params = args['hss'] + print("HSS parameter: ", hss_params) + + top_div_height = math.log(number_of_signing_entities, 2) + if not top_div_height.is_integer(): + print("number of signing entities has to be power of 2") + + top_div_height = int(top_div_height) + print("calc. top_div_height: ", top_div_height) + + + # 1. Create private key and intermediate node value + + # cargo run --release --example sst_demo -- genkey1 mykey 10/2/5/3:100000 --seed 0123456701234567012345670123456701234567012345670123456701234567 + # currently w/o aux size + # cargo run --release --example sst_demo -- genkey1 mykey 10/2/5/3 --seed 0123456701234567012345670123456701234567012345670123456701234567 + cmd_1 = "cargo run --release --example sst_demo -- genkey1 mykey " + # then hss config + cmd_3 = " --seed 0123456701234567012345670123456701234567012345670123456701234567" + + for signing_entity in range(1, number_of_signing_entities+1): + hss_string = hss_params + "/" + str(top_div_height) + "/" + str(signing_entity) + #hss_string = hss_params #+ "/" + str(top_div_height) + "/" + str(signing_entity) + cmd_total = cmd_1 + hss_string + cmd_3 + print("command: ", cmd_total) + result = subprocess.run(shlex.split(cmd_total), shell=False, capture_output=True, text=True) + print(result.stdout) + print(result.stderr) + + + # 2. read other intermediate node values and create public key + + # cargo run --release --example sst_demo -- genkey1 mykey 1 --auxsize=10000 --seed 0123456701234567012345670123456701234567012345670123456701234567 + cmd_1 = "cargo run --release --example sst_demo -- genkey2 mykey " + # then se (signing entity) 1..n + cmd_3 = " --auxsize=5000" + + for signing_entity in range(1, number_of_signing_entities+1): + cmd_total = cmd_1 + str(signing_entity) + cmd_3 + print("command: ", cmd_total) + result = subprocess.run(shlex.split(cmd_total), shell=False, capture_output=True, text=True) + print(result.stdout) + print(result.stderr) + + + + + +if __name__ == "__main__": + main() From 6da4df11aee6f4f5c8d49f815d9ab9720ced4625 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Fri, 26 Jan 2024 17:34:14 +0100 Subject: [PATCH 31/43] sst: change parameters for py-script and sst_demo - provide number of signing instances instead of "top_div_height" - provide SSTS parameter separately --- examples/sst_demo.rs | 83 +++++++++++++++++------------------------- res/dist_state_mgmt.py | 45 ++++++++++------------- 2 files changed, 54 insertions(+), 74 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 385c783b..5451d0e1 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -19,10 +19,11 @@ const SIGN_MUT_COMMAND: &str = "sign_mut"; const ARG_KEYNAME: &str = "keyname"; const ARG_MESSAGE: &str = "file"; -const ARG_GENKEY1_PARAMETER: &str = "parameter"; +const ARG_HSS_PARAMETER: &str = "parameter"; const ARG_SIGN_ENTITY_IDX_PARAMETER: &str = "se_param"; const ARG_SEED: &str = "seed"; const ARG_AUXSIZE: &str = "auxsize"; +const ARG_SSTS_PARAM: &str = "ssts"; const AUX_DATA_DEFAULT_SIZE: usize = 100_000_000; @@ -61,30 +62,17 @@ impl GenKeyParameter { } fn main() -> Result<(), Box> { - /* - let message = [32; 0]; // 32 elements init. with 0 - let _signature = match hbs_lms::sst::sign::(&message) { - Ok(_) => println!("sst::sign OK"), - Err(error) => panic!("sst::sign {:?}", error), - }; - let signature = [32; 0]; // 32 elements init. with 0 - let public_key = [32; 0]; // 32 elements init. with 0 - - if hbs_lms::sst::verify::(&message, &signature, &public_key) == false { - println!("sst::verify failed"); - exit(1); - } - */ - - // ********** code from "lms-demo.rs" to steal/import parameter parsing etc. ********** let command = Command::new("SSTS Demo") .about("Generates SSTS keys and uses them for signing and verifying.") .subcommand( Command::new(GENKEY1_COMMAND) .arg(Arg::new(ARG_KEYNAME).required(true)) - .arg(Arg::new(ARG_GENKEY1_PARAMETER).required(true).help( - "Specify LMS parameters (e.g. 5/4/2/1 (tree height = 5, Winternitz parameter = 4, top height = 2, signing entity = 1))")) + .arg(Arg::new(ARG_HSS_PARAMETER).required(true).help( + "Specify LMS parameters (e.g. 10/2 => tree height = 10, Winternitz parameter = 2)")) + .arg(Arg::new(ARG_SSTS_PARAM).long(ARG_SSTS_PARAM).required(true).takes_value(true).value_name("ssts") + .help( // TODO allow required = "false"? + "Specify SSTS parameters (e.g. --ssts=3/8 => signing entity 3 of total 8")) .arg(Arg::new(ARG_SEED).long(ARG_SEED).required(true).takes_value(true).value_name("seed")), ) .subcommand( @@ -335,7 +323,10 @@ fn read_file(file_name: &str) -> Vec { fn genkey1(args: &ArgMatches) -> Result<(), Box> { let keyname: String = get_parameter(ARG_KEYNAME, args); - let genkey_parameter = parse_genkey1_parameter(&get_parameter(ARG_GENKEY1_PARAMETER, args)); + let genkey_parameter = parse_genkey1_parameter( + &get_parameter(ARG_HSS_PARAMETER, args), + &get_parameter(ARG_SSTS_PARAM, args)); + let ssts_param = genkey_parameter.ssts_param; let seed: Seed = if let Some(seed) = args.value_of(ARG_SEED) { @@ -397,12 +388,10 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { let signing_entity: u8 = signing_entity.parse::().unwrap(); // AUX data: currently we create it only in genkey2 - let mut aux_data = vec![0u8; aux_size.parse::().unwrap()]; + let mut aux_data = vec![0u8; aux_size.parse::().unwrap()]; // TODO check conversion let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; // later on we should create it in genkey1 because it's possibly lots of calculations // and in that case we'll read the previously generated aux data from a file - //let mut aux_data = read(aux_data_name).ok(); - //let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; // println!("keyname: {} -- SI: {} -- aux_size: {}", keyname, signing_entity, aux_size); @@ -461,14 +450,15 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { Ok(()) } -fn parse_genkey1_parameter(parameter: &str) -> GenKeyParameter { +fn parse_genkey1_parameter(hss_params: &str, ssts_params: &str) -> GenKeyParameter { let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); let mut aux_data_size: Option = None; - let parameter = if parameter.contains(':') { - let mut splitted = parameter.split(':'); + // TODO change : use "--auxsize" as cur. in genkey2, then read size in genkey2 from actual filesize + let hss_params = if hss_params.contains(':') { + let mut splitted = hss_params.split(':'); let parameter = splitted.next().expect("Should contain parameter"); let aux_data = splitted.next().expect("Should contain aux data size"); @@ -479,16 +469,13 @@ fn parse_genkey1_parameter(parameter: &str) -> GenKeyParameter { parameter } else { - parameter + hss_params }; - let parameters = parameter.split(','); - let mut entity_idx: u8 = 0; - let mut top_part_height: u8 = 0; - let mut is_first_loop = true; + let hss_params = hss_params.split(','); - for parameter in parameters { - let mut splitted = parameter.split('/'); + for hss_param in hss_params { + let mut splitted = hss_param.split('/'); let height = splitted.next().expect("Merkle tree height invalid"); let winternitz_parameter = splitted.next().expect("Winternitz parameter invalid"); @@ -498,20 +485,6 @@ fn parse_genkey1_parameter(parameter: &str) -> GenKeyParameter { .parse() .expect("Winternitz parameter not correct specified"); - if true == is_first_loop { - is_first_loop = false; - if let Some(s_top_part_height) = splitted.next() { - // if we have a top_part_height, we also need an entity idx - let s_entity_idx = splitted - .next() - .expect("Top part height provided, but signing entity number missing."); - // @TODO check: invalid if "height - top_part_height < 1" - top_part_height = s_top_part_height.parse().expect("Top part height invalid"); - // @TODO check: invalid if ...dep. on height and top_part_height - entity_idx = s_entity_idx.parse().expect("Signing entity index invalid"); - } - } - let lm_ots = match winternitz_parameter { 1 => LmotsAlgorithm::LmotsW1, 2 => LmotsAlgorithm::LmotsW2, @@ -533,15 +506,27 @@ fn parse_genkey1_parameter(parameter: &str) -> GenKeyParameter { vec_hss_params.push(hss_parameters); } + let mut splitted = ssts_params.split('/'); + let si_idx = splitted.next().expect("Signing instance index invalid"); + let si_idx: u8 = si_idx.parse().expect("Signing instance index invalid"); + let total_num_si = splitted.next().expect("Total number of signing instances invalid"); + let total_num_si: u8 = total_num_si.parse().expect("Total number of signing instances invalid"); + + let top_div_height = (total_num_si as f32).log2(); + if top_div_height.fract() != 0.0 { + panic!("Provided number of signing instances is not a power of 2"); + } + let top_div_height = top_div_height as u8; + // @TODO how do I know whether this "vec_hss_params" is a move, and if not, how to achieve (avoid implicit "Copy")? // ArrayVec implements trait "Clone", but I'm not sure about "Copy" (implicit) - let ssts_param = SstsParameter::new(vec_hss_params, top_part_height, entity_idx); + let param = SstsParameter::new(vec_hss_params, top_div_height, si_idx); // this here shouldn't be possible in case of "move", because then we don't have ownership anymore: //let vec_hss_param_test: HssParameter = HssParameter::new(LmotsAlgorithm::LmotsW1, LmsAlgorithm::LmsH5); //vec_hss_params.push(vec_hss_param_test); // same here: move or copy? - GenKeyParameter::new(ssts_param, aux_data_size) + GenKeyParameter::new(param, aux_data_size) } fn write(filename: &str, content: &[u8]) -> Result<(), std::io::Error> { diff --git a/res/dist_state_mgmt.py b/res/dist_state_mgmt.py index d2bc2024..7f385ead 100755 --- a/res/dist_state_mgmt.py +++ b/res/dist_state_mgmt.py @@ -12,8 +12,9 @@ def parse(): prog='dist_state_mgmt', description='Calls demo application to generate keys for several signing entities.') - parser.add_argument('--se', dest='se', type=int, help="number of signing entities (power of 2)") # we derive the top division from that - parser.add_argument('--hss', dest='hss', help="HSS parameters; currently only one HSS level supported, e.g. 10/2 = LMS-height / Winternitz-param.") + parser.add_argument('--se', dest='se', type=int, help="number of signing entities (power of 2)") + parser.add_argument('--hss', dest='hss', help="HSS parameters; e.g. 10/2,15/4 [LMS-height/Winternitz-param.]") + parser.add_argument('--auxsize', dest='auxsize', nargs='?', default='0', help="AUX data size in bytes") args = parser.parse_args() @@ -27,55 +28,49 @@ def main(): print("args: ", args) print("Executing \"sst_demo\" genkey1 and genkey2 with:") + number_of_signing_entities = args['se'] print("Number of signing entities: ", number_of_signing_entities) hss_params = args['hss'] print("HSS parameter: ", hss_params) - top_div_height = math.log(number_of_signing_entities, 2) - if not top_div_height.is_integer(): - print("number of signing entities has to be power of 2") - - top_div_height = int(top_div_height) - print("calc. top_div_height: ", top_div_height) + auxsize = args['auxsize'] + print("AUX data size: ", auxsize) # 1. Create private key and intermediate node value - - # cargo run --release --example sst_demo -- genkey1 mykey 10/2/5/3:100000 --seed 0123456701234567012345670123456701234567012345670123456701234567 - # currently w/o aux size - # cargo run --release --example sst_demo -- genkey1 mykey 10/2/5/3 --seed 0123456701234567012345670123456701234567012345670123456701234567 - cmd_1 = "cargo run --release --example sst_demo -- genkey1 mykey " - # then hss config + cmd_1 = "cargo run --release --example sst_demo -- genkey1 mykey" + # hss params e.g. "10/2,15/4" + # ssts params e.g. "ssts=5/8" -> instance 5 of 8 + # TODO aux size cmd_3 = " --seed 0123456701234567012345670123456701234567012345670123456701234567" for signing_entity in range(1, number_of_signing_entities+1): - hss_string = hss_params + "/" + str(top_div_height) + "/" + str(signing_entity) - #hss_string = hss_params #+ "/" + str(top_div_height) + "/" + str(signing_entity) - cmd_total = cmd_1 + hss_string + cmd_3 - print("command: ", cmd_total) + ssts_string = "--ssts=" + str(signing_entity) + "/" + str(number_of_signing_entities) + cmd_total = cmd_1 + " " + hss_params + " " + ssts_string + " " + cmd_3 + #print("command: ", cmd_total) result = subprocess.run(shlex.split(cmd_total), shell=False, capture_output=True, text=True) print(result.stdout) print(result.stderr) - # 2. read other intermediate node values and create public key - - # cargo run --release --example sst_demo -- genkey1 mykey 1 --auxsize=10000 --seed 0123456701234567012345670123456701234567012345670123456701234567 cmd_1 = "cargo run --release --example sst_demo -- genkey2 mykey " - # then se (signing entity) 1..n cmd_3 = " --auxsize=5000" for signing_entity in range(1, number_of_signing_entities+1): cmd_total = cmd_1 + str(signing_entity) + cmd_3 - print("command: ", cmd_total) + #print("command: ", cmd_total) result = subprocess.run(shlex.split(cmd_total), shell=False, capture_output=True, text=True) print(result.stdout) print(result.stderr) - - + # remove files with intermediate node hash values + for signing_entity in range(1, number_of_signing_entities+1): + cmd = "rm node_si." + str(signing_entity) + ".bin" + result = subprocess.run(shlex.split(cmd), shell=False, capture_output=True, text=True) + print(result.stdout) + print(result.stderr) if __name__ == "__main__": From 6aded9902e225409d1d5a3d76514a9307ce21014 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Fri, 26 Jan 2024 18:28:35 +0100 Subject: [PATCH 32/43] sst: py-script: fix auxsize; use functions --- res/dist_state_mgmt.py | 50 ++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/res/dist_state_mgmt.py b/res/dist_state_mgmt.py index 7f385ead..193e2430 100755 --- a/res/dist_state_mgmt.py +++ b/res/dist_state_mgmt.py @@ -7,19 +7,6 @@ import sys, subprocess, shlex, math, argparse -def parse(): - parser = argparse.ArgumentParser( - prog='dist_state_mgmt', - description='Calls demo application to generate keys for several signing entities.') - - parser.add_argument('--se', dest='se', type=int, help="number of signing entities (power of 2)") - parser.add_argument('--hss', dest='hss', help="HSS parameters; e.g. 10/2,15/4 [LMS-height/Winternitz-param.]") - parser.add_argument('--auxsize', dest='auxsize', nargs='?', default='0', help="AUX data size in bytes") - - args = parser.parse_args() - - return args - def main(): @@ -38,7 +25,33 @@ def main(): auxsize = args['auxsize'] print("AUX data size: ", auxsize) + genkey1(number_of_signing_entities, hss_params, auxsize) + + genkey2(number_of_signing_entities, auxsize) + + # remove files with intermediate node hash values + for signing_entity in range(1, number_of_signing_entities+1): + cmd = "rm node_si." + str(signing_entity) + ".bin" + result = subprocess.run(shlex.split(cmd), shell=False, capture_output=True, text=True) + #print(result.stdout) + #print(result.stderr) + + +def parse(): + parser = argparse.ArgumentParser( + prog='dist_state_mgmt', + description='Calls demo application to generate keys for several signing entities.') + parser.add_argument('--se', dest='se', type=int, help="number of signing entities (power of 2)") + parser.add_argument('--hss', dest='hss', help="HSS parameters; e.g. 10/2,15/4 [LMS-height/Winternitz-param.]") + parser.add_argument('--auxsize', dest='auxsize', nargs='?', default='0', help="AUX data size in bytes") + + args = parser.parse_args() + + return args + + +def genkey1(number_of_signing_entities, hss_params, auxsize): # 1. Create private key and intermediate node value cmd_1 = "cargo run --release --example sst_demo -- genkey1 mykey" # hss params e.g. "10/2,15/4" @@ -54,9 +67,11 @@ def main(): print(result.stdout) print(result.stderr) + +def genkey2(number_of_signing_entities, auxsize): # 2. read other intermediate node values and create public key cmd_1 = "cargo run --release --example sst_demo -- genkey2 mykey " - cmd_3 = " --auxsize=5000" + cmd_3 = " --auxsize=" + auxsize for signing_entity in range(1, number_of_signing_entities+1): cmd_total = cmd_1 + str(signing_entity) + cmd_3 @@ -65,13 +80,6 @@ def main(): print(result.stdout) print(result.stderr) - # remove files with intermediate node hash values - for signing_entity in range(1, number_of_signing_entities+1): - cmd = "rm node_si." + str(signing_entity) + ".bin" - result = subprocess.run(shlex.split(cmd), shell=False, capture_output=True, text=True) - print(result.stdout) - print(result.stderr) - if __name__ == "__main__": main() From 29aa774f737a57f0b1684e364f4b927d9cb59d0f Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Mon, 29 Jan 2024 09:47:26 +0100 Subject: [PATCH 33/43] sst: improve and fix AUX data - partially populate AUX data in gen key step 1 - read/use and extend AUX data in gen key step 2 - fix AUX data (finalize, write HMAC) - adapt AUX arguments for py script and sst_demo - --- examples/sst_demo.rs | 50 +++++++++++++++++------------------------- res/dist_state_mgmt.py | 12 +++++----- src/hss/definitions.rs | 41 ++++++++++++++-------------------- src/lms/definitions.rs | 15 +++++++++++-- src/sst/gen_key.rs | 30 +++++++++++++++++++++---- 5 files changed, 81 insertions(+), 67 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 5451d0e1..d61736e9 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -73,6 +73,8 @@ fn main() -> Result<(), Box> { .arg(Arg::new(ARG_SSTS_PARAM).long(ARG_SSTS_PARAM).required(true).takes_value(true).value_name("ssts") .help( // TODO allow required = "false"? "Specify SSTS parameters (e.g. --ssts=3/8 => signing entity 3 of total 8")) + .arg(Arg::new(ARG_AUXSIZE).long(ARG_AUXSIZE).required(false).takes_value(true).value_name("auxsize").help( + "Specify AUX data size in bytes")) .arg(Arg::new(ARG_SEED).long(ARG_SEED).required(true).takes_value(true).value_name("seed")), ) .subcommand( @@ -254,7 +256,6 @@ fn verify(args: &ArgMatches) -> bool { let keyname: String = get_parameter(ARG_KEYNAME, args); let message_name: String = get_parameter(ARG_MESSAGE, args); - // TODO: signing entity idx let public_key_name = get_public_key_filename(&keyname, None); let signature_name = get_signature_filename(&message_name); @@ -325,7 +326,9 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { let genkey_parameter = parse_genkey1_parameter( &get_parameter(ARG_HSS_PARAMETER, args), - &get_parameter(ARG_SSTS_PARAM, args)); + &get_parameter(ARG_SSTS_PARAM, args), + &get_parameter(ARG_AUXSIZE, args), + ); let ssts_param = genkey_parameter.ssts_param; @@ -376,6 +379,9 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { .unwrap(); intermed_node_file.write_all(intermed_node_hashval.as_slice())?; + let aux_filename: String = get_aux_filename(&keyname, Some(ssts_param.get_signing_entity_idx())); + write(&aux_filename, aux_slice)?; + Ok(()) } @@ -383,15 +389,12 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { // get signing entity number and name of private keyfile from args let keyname: String = get_parameter(ARG_KEYNAME, args); let signing_entity: String = get_parameter(ARG_SIGN_ENTITY_IDX_PARAMETER, args); - let aux_size: String = get_parameter(ARG_AUXSIZE, args); - let signing_entity: u8 = signing_entity.parse::().unwrap(); - // AUX data: currently we create it only in genkey2 - let mut aux_data = vec![0u8; aux_size.parse::().unwrap()]; // TODO check conversion - let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; - // later on we should create it in genkey1 because it's possibly lots of calculations - // and in that case we'll read the previously generated aux data from a file + // AUX data: created in genkey1, here we read the file + let aux_filename: String = get_aux_filename(&keyname, Some(signing_entity)); + let mut aux_data_v: Vec = read_file(&aux_filename); + let aux_slice: &mut &mut [u8] = &mut &mut aux_data_v[..]; // println!("keyname: {} -- SI: {} -- aux_size: {}", keyname, signing_entity, aux_size); @@ -409,8 +412,6 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { let mut node_array: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]> = Default::default(); - // let mut node_array: ArrayVec<[[u8; MAX_HASH_SIZE]; MAX_DSM_SIGNING_ENTITIES]> = ArrayVec::new(); - for idx in 1..=num_signing_entities { let interm_node_filename = String::from("node_si.") + &(idx.to_string()) + &String::from(".bin"); // TODO into function @@ -423,11 +424,9 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { } // TODO the following works but is a really bad inefficient solution - let mut node: [u8; MAX_HASH_SIZE] = [0; MAX_HASH_SIZE]; node.copy_from_slice(&file_data[1..]); node_array.push(node.into()); - // TODO replace with this and adapt calls to functions // let node: &[u8; MAX_HASH_SIZE] = file_data[1..].try_into().unwrap(); // node_array.push(*node); @@ -441,7 +440,6 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { //println!("pub key (node 1) hash value: {:?}", verifying_key); - let aux_filename: String = get_aux_filename(&keyname, Some(signing_entity)); write(&aux_filename, aux_slice)?; let public_key_filename = get_public_key_filename(&keyname, Some(signing_entity)); @@ -450,26 +448,18 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { Ok(()) } -fn parse_genkey1_parameter(hss_params: &str, ssts_params: &str) -> GenKeyParameter { +fn parse_genkey1_parameter(hss_params: &str, ssts_params: &str, auxsize: &str) -> GenKeyParameter { let mut vec_hss_params: ArrayVec<[_; hbs_lms::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); - let mut aux_data_size: Option = None; - - // TODO change : use "--auxsize" as cur. in genkey2, then read size in genkey2 from actual filesize - let hss_params = if hss_params.contains(':') { - let mut splitted = hss_params.split(':'); - let parameter = splitted.next().expect("Should contain parameter"); - - let aux_data = splitted.next().expect("Should contain aux data size"); - let aux_data = aux_data - .parse::() - .expect("Could not parse aux data size"); - aux_data_size = Some(aux_data); - - parameter + let auxsize = auxsize + .parse::() + .expect("Could not parse aux data size"); + // TODO if not provided the argument defaults to 0... + let aux_data_size = if 0 != auxsize { + Some(auxsize) } else { - hss_params + None }; let hss_params = hss_params.split(','); diff --git a/res/dist_state_mgmt.py b/res/dist_state_mgmt.py index 193e2430..458a9c3e 100755 --- a/res/dist_state_mgmt.py +++ b/res/dist_state_mgmt.py @@ -7,7 +7,6 @@ import sys, subprocess, shlex, math, argparse - def main(): args = parse() @@ -27,7 +26,7 @@ def main(): genkey1(number_of_signing_entities, hss_params, auxsize) - genkey2(number_of_signing_entities, auxsize) + genkey2(number_of_signing_entities) # remove files with intermediate node hash values for signing_entity in range(1, number_of_signing_entities+1): @@ -56,25 +55,24 @@ def genkey1(number_of_signing_entities, hss_params, auxsize): cmd_1 = "cargo run --release --example sst_demo -- genkey1 mykey" # hss params e.g. "10/2,15/4" # ssts params e.g. "ssts=5/8" -> instance 5 of 8 - # TODO aux size cmd_3 = " --seed 0123456701234567012345670123456701234567012345670123456701234567" for signing_entity in range(1, number_of_signing_entities+1): ssts_string = "--ssts=" + str(signing_entity) + "/" + str(number_of_signing_entities) - cmd_total = cmd_1 + " " + hss_params + " " + ssts_string + " " + cmd_3 + aux_string = "--auxsize=" + auxsize + cmd_total = cmd_1 + " " + hss_params + " " + ssts_string + " " + aux_string + " " + cmd_3 #print("command: ", cmd_total) result = subprocess.run(shlex.split(cmd_total), shell=False, capture_output=True, text=True) print(result.stdout) print(result.stderr) -def genkey2(number_of_signing_entities, auxsize): +def genkey2(number_of_signing_entities): # 2. read other intermediate node values and create public key cmd_1 = "cargo run --release --example sst_demo -- genkey2 mykey " - cmd_3 = " --auxsize=" + auxsize for signing_entity in range(1, number_of_signing_entities+1): - cmd_total = cmd_1 + str(signing_entity) + cmd_3 + cmd_total = cmd_1 + str(signing_entity) #print("command: ", cmd_total) result = subprocess.run(shlex.split(cmd_total), shell=False, capture_output=True, text=True) print(result.stdout) diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index 5ce09478..ba852207 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -200,21 +200,12 @@ impl HssPublicKey { let current_seed = private_key.generate_root_seed_and_lms_tree_identifier(); - let mut sst_ext_option = None; - let sst_ext = SstExtension { - signing_entity_idx: private_key.sst_ext.signing_entity_idx, - top_div_height: private_key.sst_ext.top_div_height, - }; - if private_key.sst_ext.signing_entity_idx != 0 { - sst_ext_option = Some(sst_ext); - } - let lms_keypair = generate_key_pair( ¤t_seed, ¶meters[0], &used_leafs_indexes[0], &mut expanded_aux_data, - sst_ext_option, + None, ); if let Some(expanded_aux_data) = expanded_aux_data.as_mut() { @@ -266,6 +257,17 @@ impl HssPublicKey { sst_ext_option = Some(sst_ext); } + // Additions for SSTS: add "intermediate node values" from other signing entities to AUX data + if let Some(expanded_aux_data) = expanded_aux_data.as_mut() { + let num_signing_entities = 2usize.pow(private_key.sst_ext.top_div_height as u32); + for si in 1..=num_signing_entities as u8 { + // node index of SI intermed node in whole tree: + let idx: usize = get_subtree_node_idx(si, top_lms_parameter.get_tree_height(), private_key.sst_ext.top_div_height) as usize; + hss_save_aux_data::(expanded_aux_data, idx, intermed_nodes[(si-1) as usize].as_slice()); + } + } + + // here we will add more data to aux let mut lms_keypair = generate_key_pair( ¤t_seed, ¶meters[0], @@ -274,23 +276,14 @@ impl HssPublicKey { sst_ext_option, ); - // Addition for SSTS: replace public key node value - lms_keypair.public_key.key = pubkey_hashval; - + // calc. new AUX HMAC if let Some(expanded_aux_data) = expanded_aux_data.as_mut() { - // Additions for SSTS: fix aux data with intermediate node values from other signing entities - let num_signing_entities = 2usize.pow(private_key.sst_ext.top_div_height as u32); - for si in 1..=num_signing_entities as u8 { - // node index of SI intermed node in whole tree: - let idx: usize = get_subtree_node_idx(si, top_lms_parameter.get_tree_height(), private_key.sst_ext.top_div_height) as usize; - hss_save_aux_data::(expanded_aux_data, idx, intermed_nodes[(si-1) as usize].as_slice()); - } - - if !is_aux_data_used { - hss_finalize_aux_data::(expanded_aux_data, private_key.seed.as_slice()); - } + hss_finalize_aux_data::(expanded_aux_data, private_key.seed.as_slice()); } + // Addition for SSTS: replace public key node value + lms_keypair.public_key.key = pubkey_hashval; + Ok(Self { public_key: lms_keypair.public_key, level: levels, diff --git a/src/lms/definitions.rs b/src/lms/definitions.rs index 3a352f99..37c7f725 100644 --- a/src/lms/definitions.rs +++ b/src/lms/definitions.rs @@ -6,6 +6,7 @@ use crate::lms::helper::get_tree_element; use crate::lms::parameters::LmsAlgorithm; use crate::lms::MutableExpandedAuxData; use crate::sst::helper::get_sst_last_leaf_idx; +use crate::sst::helper::get_subtree_node_idx; use crate::sst::parameters::SstExtension; use crate::util::helper::read_and_advance; use crate::{lm_ots, Seed}; @@ -90,7 +91,17 @@ impl LmsPublicKey { private_key: &LmsPrivateKey, aux_data: &mut Option, ) -> Self { - let public_key = get_tree_element(1, private_key, aux_data); + let index = if let Some(sst_ext) = &private_key.sst_ext { + get_subtree_node_idx( + sst_ext.signing_entity_idx, + private_key.lms_parameter.get_tree_height(), + sst_ext.top_div_height) + } else { + 1 + }; + + // use our signing entity's node index and also use that straight as "intermediate node hash value" instead of extra operation + let public_key = get_tree_element(index as usize, private_key, aux_data); Self { key: public_key, @@ -135,7 +146,7 @@ impl<'a, H: HashChain> PartialEq> for InMemoryLmsPublicKey<'a, H impl<'a, H: HashChain> InMemoryLmsPublicKey<'a, H> { pub fn new(data: &'a [u8]) -> Option { - // Parsing like desribed in 5.4.2 + // Parsing like described in 5.4.2 let mut data_index = 0; let lms_parameter = LmsAlgorithm::get_from_type(u32::from_be_bytes( diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index 74e9ac18..ae808971 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -5,8 +5,10 @@ use crate::{ hasher::HashChain, hss::{ definitions::HssPublicKey, + definitions::HssPrivateKey, reference_impl_private_key::{ReferenceImplPrivateKey, Seed}, SigningKey, VerifyingKey, + aux::{hss_finalize_aux_data, hss_is_aux_data_used}, }, lms::definitions::LmsPrivateKey, lms::helper::get_tree_element, @@ -20,17 +22,32 @@ use tinyvec::ArrayVec; pub fn genkey1_sst( sst_param: &SstsParameter, seed: &Seed, - _aux_data: Option<&mut &mut [u8]>, // TODO: improve efficiency and fill aux_data already here? + aux_data: Option<&mut &mut [u8]>, ) -> Result<(SigningKey, ArrayVec<[u8; MAX_HASH_SIZE]>), Error> { - // create two representations of private keys: ReferenceImplPrivateKey and SigningKey + // create two representations of private keys because we need their data elements + // -> ReferenceImplPrivateKey and SigningKey let rfc_private_key = ReferenceImplPrivateKey::generate(sst_param, seed).map_err(|_| Error::new())?; let signing_key = SigningKey::from_bytes(&rfc_private_key.to_binary_representation())?; + // get expanded AUX data + let is_aux_data_used = if let Some(ref aux_data) = aux_data { + hss_is_aux_data_used(aux_data) + } else { + false + }; + + let mut expanded_aux_data = HssPrivateKey::get_expanded_aux_data( + aux_data, + &rfc_private_key, + sst_param.get_hss_parameters()[0].get_lms_parameter(), // TODO only top is forwarded to LmsPrivateKey for SST params + is_aux_data_used, + ); + // calculate our intermediate node hash value; for this we have to generate a LmsPrivateKey - // TODO review: better option? it's somehow redundant (used leafs calculation) + // TODO review: better option? redundant (used leafs calculation) let mut used_leafs_index = 0; if sst_param.get_top_div_height() != 0 { // TODO: is there a better (Rust-idiomatic) approach? @@ -75,7 +92,11 @@ pub fn genkey1_sst( sst_ext_option, ); - let our_node_value = get_tree_element(our_node_index as usize, &lms_private_key, &mut None); + // TODO do this via LmsPublicKey() and have aux data taken care of? where is aux data finalized in original code? + let our_node_value = get_tree_element(our_node_index as usize, &lms_private_key, &mut expanded_aux_data); + if let Some(expanded_aux_data) = expanded_aux_data.as_mut() { + hss_finalize_aux_data::(expanded_aux_data, rfc_private_key.seed.as_slice()); + } Ok((signing_key, our_node_value)) } @@ -103,6 +124,7 @@ pub fn genkey2_sst( let seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); let lms_tree_ident = seed_and_lms_tree_ident.lms_tree_identifier; + // TODO we don't need AUX here to read from, but we could populate the upper levels; AUX level marker needs then to be updated let pubkey_hash_val = get_node_hash_val::( 1, interm_nodes, rfc_private_key.sst_ext.top_div_height, lms_tree_ident); From c6aa5abb0c4e68932bbd10992b88fbacaf64403e Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Tue, 30 Jan 2024 21:00:10 +0100 Subject: [PATCH 34/43] sst: fix two errors: TreeIdent, UsedLeafs - fix for "tree identifier": the value needs to be the same for all signing entities - create tree ident. via first signing entity, then use this tree ident. for other entities - here the temp. solution is a fixed value for the treee ident. - fix for "used leafs": the position of the used lefas value in the u64 "CompressedUsedLeafsIndexes" and in the HSS levels array was wrong if several HSS levels were used --- examples/lms-demo.rs | 2 +- res/dist_state_mgmt.py | 17 ++++++++++---- src/hss/reference_impl_private_key.rs | 34 +++++++++++++++++++++++---- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/examples/lms-demo.rs b/examples/lms-demo.rs index 50de2987..4e4c516a 100644 --- a/examples/lms-demo.rs +++ b/examples/lms-demo.rs @@ -96,7 +96,7 @@ fn main() -> Result<(), Box> { if let Some(args) = matches.subcommand_matches(VERIFY_COMMAND) { let result = verify(args); if result { - println!("Successful!"); + println!("Verification successful!"); exit(0); } else { println!("Wrong signature"); diff --git a/res/dist_state_mgmt.py b/res/dist_state_mgmt.py index 458a9c3e..a7a30954 100755 --- a/res/dist_state_mgmt.py +++ b/res/dist_state_mgmt.py @@ -1,8 +1,9 @@ #!/usr/bin/env python3 #!/mnt/daten/dev/hbs-lms-rust-priv.git/.venv/bin/python -# TODO how to avoid an absolute path? -# TODO add several HSS parameters +# TODO how to avoid an absolute path for venv? + +# TODO arguments: add seed; option for random seed? import sys, subprocess, shlex, math, argparse @@ -43,7 +44,7 @@ def parse(): parser.add_argument('--se', dest='se', type=int, help="number of signing entities (power of 2)") parser.add_argument('--hss', dest='hss', help="HSS parameters; e.g. 10/2,15/4 [LMS-height/Winternitz-param.]") - parser.add_argument('--auxsize', dest='auxsize', nargs='?', default='0', help="AUX data size in bytes") + parser.add_argument('--auxsize', dest='auxsize', nargs='?', default='0', help="Max AUX data file, size in bytes") args = parser.parse_args() @@ -51,18 +52,20 @@ def parse(): def genkey1(number_of_signing_entities, hss_params, auxsize): + seed = "0123456701234567012345670123456701234567012345670123456701234567" # 1. Create private key and intermediate node value cmd_1 = "cargo run --release --example sst_demo -- genkey1 mykey" # hss params e.g. "10/2,15/4" # ssts params e.g. "ssts=5/8" -> instance 5 of 8 - cmd_3 = " --seed 0123456701234567012345670123456701234567012345670123456701234567" for signing_entity in range(1, number_of_signing_entities+1): ssts_string = "--ssts=" + str(signing_entity) + "/" + str(number_of_signing_entities) aux_string = "--auxsize=" + auxsize + cmd_3 = " --seed=" + seed cmd_total = cmd_1 + " " + hss_params + " " + ssts_string + " " + aux_string + " " + cmd_3 #print("command: ", cmd_total) result = subprocess.run(shlex.split(cmd_total), shell=False, capture_output=True, text=True) + seed = rotate(seed, 3) print(result.stdout) print(result.stderr) @@ -79,5 +82,11 @@ def genkey2(number_of_signing_entities): print(result.stderr) +def rotate(input_str, d): + # slice string in two parts for left and right + Rfirst = input_str[0 : len(input_str)-d] + Rsecond = input_str[len(input_str)-d : ] + return (Rsecond + Rfirst) + if __name__ == "__main__": main() diff --git a/src/hss/reference_impl_private_key.rs b/src/hss/reference_impl_private_key.rs index a38250f7..d47b04fc 100644 --- a/src/hss/reference_impl_private_key.rs +++ b/src/hss/reference_impl_private_key.rs @@ -112,7 +112,7 @@ impl ReferenceImplPrivateKey { let hss_params = parameters.get_hss_parameters(); let top_lms_parameter = hss_params[0].get_lms_parameter(); - let mut used_leafs_index = 0; + let mut used_leafs_index: u32 = 0; if parameters.get_top_div_height() != 0 { used_leafs_index = helper::get_sst_first_leaf_idx( sst_ext.signing_entity_idx, @@ -121,8 +121,11 @@ impl ReferenceImplPrivateKey { ); } + let mut arr: [u32; MAX_ALLOWED_HSS_LEVELS] = [0; MAX_ALLOWED_HSS_LEVELS]; + arr[0] = used_leafs_index; + let private_key: ReferenceImplPrivateKey = ReferenceImplPrivateKey { - compressed_used_leafs_indexes: CompressedUsedLeafsIndexes::new(used_leafs_index as u64), + compressed_used_leafs_indexes: CompressedUsedLeafsIndexes::from(&arr, &hss_params), compressed_parameter: CompressedParameterSet::from(parameters.get_hss_parameters())?, sst_ext, seed: seed.clone(), @@ -198,8 +201,12 @@ impl ReferenceImplPrivateKey { hash_preimage[TOPSEED_WHICH] = 0x02; hasher.update(&hash_preimage); - let mut lms_tree_identifier = LmsTreeIdentifier::default(); - lms_tree_identifier.copy_from_slice(&hasher.finalize_reset()[..ILEN]); + // TODO_FIX! Tree identifier needs to be the same for all signing entities + // workaround for now: srt to fixed value + let lms_tree_identifier = [0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, + 0x05, 0x04, 0x03, 0x02, 0x01, 0x00]; // = LmsTreeIdentifier::default(); + // let mut lms_tree_identifier = LmsTreeIdentifier::default(); + // lms_tree_identifier.copy_from_slice(&hasher.finalize_reset()[..ILEN]); SeedAndLmsTreeIdentifier::new(&seed, &lms_tree_identifier) } @@ -328,6 +335,24 @@ impl CompressedUsedLeafsIndexes { } } + pub fn from( + used_leafs_array: &[u32; MAX_ALLOWED_HSS_LEVELS], + hss_params: &ArrayVec<[HssParameter; MAX_ALLOWED_HSS_LEVELS]>, + ) -> Self { + let mut compressed_used_leafs_indexes: u64 = 0; + + for (i, parameter) in hss_params.iter().enumerate() { + let shift: u32 = parameter.get_lms_parameter().get_tree_height().into(); + compressed_used_leafs_indexes <<= shift; + compressed_used_leafs_indexes |= used_leafs_array[i] as u64; + } + + CompressedUsedLeafsIndexes { + count: compressed_used_leafs_indexes + } + } + + // this works because we limit the total num of signatures / leafs to 2^64 (see RFC) pub fn to( &self, parameters: &ArrayVec<[HssParameter; MAX_ALLOWED_HSS_LEVELS]>, @@ -341,6 +366,7 @@ impl CompressedUsedLeafsIndexes { (compressed_used_leafs_indexes & (2u32.pow(tree_height) - 1) as u64) as u32; compressed_used_leafs_indexes >>= tree_height; } + lms_leaf_identifier_set } From 7c0c9e708c04651061f6ae510001a66ad6526180 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Thu, 1 Feb 2024 09:04:15 +0100 Subject: [PATCH 35/43] sst: Py: format via black; use f-strings - build strings via f-string (improve readability) - format code - add requirements.txt (so far empty) to communicate python environment --- requirements.txt | 0 res/dist_state_mgmt.py | 137 +++++++++++++++++++++++------------------ 2 files changed, 76 insertions(+), 61 deletions(-) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..e69de29b diff --git a/res/dist_state_mgmt.py b/res/dist_state_mgmt.py index a7a30954..71ad0943 100755 --- a/res/dist_state_mgmt.py +++ b/res/dist_state_mgmt.py @@ -1,92 +1,107 @@ #!/usr/bin/env python3 -#!/mnt/daten/dev/hbs-lms-rust-priv.git/.venv/bin/python -# TODO how to avoid an absolute path for venv? - # TODO arguments: add seed; option for random seed? +# TODO arguments: add name for files import sys, subprocess, shlex, math, argparse def main(): + args = parse() + args = vars(args) + print("args: ", args) - args = parse() - args = vars(args) - print("args: ", args) - - print("Executing \"sst_demo\" genkey1 and genkey2 with:") + print('Executing "sst_demo" genkey1 and genkey2 with:') - number_of_signing_entities = args['se'] - print("Number of signing entities: ", number_of_signing_entities) + number_of_signing_entities = args["se"] + print("Number of signing entities: ", number_of_signing_entities) - hss_params = args['hss'] - print("HSS parameter: ", hss_params) + hss_params = args["hss"] + print("HSS parameter: ", hss_params) - auxsize = args['auxsize'] - print("AUX data size: ", auxsize) + auxsize = args["auxsize"] + print("AUX data size: ", auxsize) - genkey1(number_of_signing_entities, hss_params, auxsize) + genkey1(number_of_signing_entities, hss_params, auxsize) - genkey2(number_of_signing_entities) + genkey2(number_of_signing_entities) - # remove files with intermediate node hash values - for signing_entity in range(1, number_of_signing_entities+1): - cmd = "rm node_si." + str(signing_entity) + ".bin" - result = subprocess.run(shlex.split(cmd), shell=False, capture_output=True, text=True) - #print(result.stdout) - #print(result.stderr) + # remove files with intermediate node hash values + for signing_entity in range(1, number_of_signing_entities + 1): + cmd = f"rm node_si.{signing_entity}.bin" + result = subprocess.run( + shlex.split(cmd), shell=False, capture_output=True, text=True + ) + # print(result.stdout) + # print(result.stderr) def parse(): - parser = argparse.ArgumentParser( - prog='dist_state_mgmt', - description='Calls demo application to generate keys for several signing entities.') - - parser.add_argument('--se', dest='se', type=int, help="number of signing entities (power of 2)") - parser.add_argument('--hss', dest='hss', help="HSS parameters; e.g. 10/2,15/4 [LMS-height/Winternitz-param.]") - parser.add_argument('--auxsize', dest='auxsize', nargs='?', default='0', help="Max AUX data file, size in bytes") - - args = parser.parse_args() - - return args + parser = argparse.ArgumentParser( + prog="dist_state_mgmt", + description="Calls demo application to generate keys for several signing entities.", + ) + + parser.add_argument( + "--se", dest="se", type=int, help="number of signing entities (power of 2)" + ) + parser.add_argument( + "--hss", + dest="hss", + help="HSS parameters; e.g. 10/2,15/4 [LMS-height/Winternitz-param.]", + ) + parser.add_argument( + "--auxsize", + dest="auxsize", + nargs="?", + default="0", + help="Max AUX data file, size in bytes", + ) + + args = parser.parse_args() + + return args def genkey1(number_of_signing_entities, hss_params, auxsize): - seed = "0123456701234567012345670123456701234567012345670123456701234567" - # 1. Create private key and intermediate node value - cmd_1 = "cargo run --release --example sst_demo -- genkey1 mykey" - # hss params e.g. "10/2,15/4" - # ssts params e.g. "ssts=5/8" -> instance 5 of 8 - - for signing_entity in range(1, number_of_signing_entities+1): - ssts_string = "--ssts=" + str(signing_entity) + "/" + str(number_of_signing_entities) - aux_string = "--auxsize=" + auxsize - cmd_3 = " --seed=" + seed - cmd_total = cmd_1 + " " + hss_params + " " + ssts_string + " " + aux_string + " " + cmd_3 - #print("command: ", cmd_total) - result = subprocess.run(shlex.split(cmd_total), shell=False, capture_output=True, text=True) - seed = rotate(seed, 3) - print(result.stdout) - print(result.stderr) + seed = "0123456701234567012345670123456701234567012345670123456701234567" + # 1. Create private key and intermediate node value + # hss params e.g. "10/2,15/4" + # ssts params e.g. "ssts=5/8" -> instance 5 of 8 + + for signing_entity in range(1, number_of_signing_entities + 1): + cmd = ( + f"cargo run --release --example sst_demo -- genkey1 mykey {hss_params} " + f"--ssts={signing_entity}/{number_of_signing_entities} --auxsize={auxsize} --seed={seed}" + ) + result = subprocess.run( + shlex.split(cmd), shell=False, capture_output=True, text=True + ) + seed = rotate(seed, 3) + print(result.stdout) + print(result.stderr) def genkey2(number_of_signing_entities): - # 2. read other intermediate node values and create public key - cmd_1 = "cargo run --release --example sst_demo -- genkey2 mykey " + # 2. read other intermediate node values and create public key - for signing_entity in range(1, number_of_signing_entities+1): - cmd_total = cmd_1 + str(signing_entity) - #print("command: ", cmd_total) - result = subprocess.run(shlex.split(cmd_total), shell=False, capture_output=True, text=True) - print(result.stdout) - print(result.stderr) + for signing_entity in range(1, number_of_signing_entities + 1): + cmd = ( + f"cargo run --release --example sst_demo -- genkey2 mykey {signing_entity}" + ) + result = subprocess.run( + shlex.split(cmd), shell=False, capture_output=True, text=True + ) + print(result.stdout) + print(result.stderr) def rotate(input_str, d): # slice string in two parts for left and right - Rfirst = input_str[0 : len(input_str)-d] - Rsecond = input_str[len(input_str)-d : ] - return (Rsecond + Rfirst) + Rfirst = input_str[0 : len(input_str) - d] + Rsecond = input_str[len(input_str) - d :] + return Rsecond + Rfirst + if __name__ == "__main__": - main() + main() From ce4dae8af752a3f63c69127d5b5f9790f0e5317d Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Thu, 1 Feb 2024 13:41:11 +0100 Subject: [PATCH 36/43] sst: code cleanup - rename some constants, variables and functions to reflect their purpose - remove obsolete comments - remove unused functions - format via "cargo fmt" --- examples/sst_demo.rs | 40 ++++++------- src/constants.rs | 84 +++++++++++++++------------ src/hss/definitions.rs | 36 ++++++++---- src/hss/mod.rs | 20 +++---- src/hss/reference_impl_private_key.rs | 19 +++--- src/hss/signing.rs | 8 ++- src/lib.rs | 2 +- src/lm_ots/definitions.rs | 10 ++-- src/lm_ots/keygen.rs | 12 ++-- src/lm_ots/parameters.rs | 24 ++++---- src/lm_ots/signing.rs | 35 ++++++----- src/lm_ots/verify.rs | 40 ++++++++----- src/lms/definitions.rs | 3 +- src/lms/signing.rs | 2 +- src/sst/gen_key.rs | 39 ++++++++----- src/sst/helper.rs | 83 +------------------------- src/sst/parameters.rs | 21 +++---- 17 files changed, 224 insertions(+), 254 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index d61736e9..4cfb9f11 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -62,7 +62,6 @@ impl GenKeyParameter { } fn main() -> Result<(), Box> { - let command = Command::new("SSTS Demo") .about("Generates SSTS keys and uses them for signing and verifying.") .subcommand( @@ -353,10 +352,11 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; // create our private key - let (signing_key, intermed_node_hashval) = - genkey1_sst(&ssts_param, &seed, Some(aux_slice)).unwrap_or_else(|_| panic!("Could not generate keys")); + let (signing_key, intermed_node_hashval) = genkey1_sst(&ssts_param, &seed, Some(aux_slice)) + .unwrap_or_else(|_| panic!("Could not generate keys")); - let private_key_filename = get_private_key_filename(&keyname, Some(ssts_param.get_signing_entity_idx())); + let private_key_filename = + get_private_key_filename(&keyname, Some(ssts_param.get_signing_entity_idx())); write(private_key_filename.as_str(), signing_key.as_slice())?; // write own node value and signing entity to file @@ -379,7 +379,8 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { .unwrap(); intermed_node_file.write_all(intermed_node_hashval.as_slice())?; - let aux_filename: String = get_aux_filename(&keyname, Some(ssts_param.get_signing_entity_idx())); + let aux_filename: String = + get_aux_filename(&keyname, Some(ssts_param.get_signing_entity_idx())); write(&aux_filename, aux_slice)?; Ok(()) @@ -409,7 +410,7 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { // TODO maybe compare with HSS configuration in the "node files" // read intermediate node values from files (ours and others) and pass for calc. - let mut node_array: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]> = + let mut node_array: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_SSTS_SIGNING_ENTITIES]> = Default::default(); for idx in 1..=num_signing_entities { @@ -418,8 +419,10 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { let file_data: Vec = read_file(&interm_node_filename); if file_data.len() != (1 + MAX_HASH_SIZE) { - panic!("genkey2(): intermediate node file size is {}, should be {}", - file_data.len(), (1 + MAX_HASH_SIZE) + panic!( + "genkey2(): intermediate node file size is {}, should be {}", + file_data.len(), + (1 + MAX_HASH_SIZE) ); } @@ -432,11 +435,8 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { // node_array.push(*node); } - let verifying_key = genkey2_sst::( - &private_key_data, - &node_array, - Some(aux_slice), - ).unwrap_or_else(|_| panic!("Could not generate verifying key")); + let verifying_key = genkey2_sst::(&private_key_data, &node_array, Some(aux_slice)) + .unwrap_or_else(|_| panic!("Could not generate verifying key")); //println!("pub key (node 1) hash value: {:?}", verifying_key); @@ -456,11 +456,7 @@ fn parse_genkey1_parameter(hss_params: &str, ssts_params: &str, auxsize: &str) - .parse::() .expect("Could not parse aux data size"); // TODO if not provided the argument defaults to 0... - let aux_data_size = if 0 != auxsize { - Some(auxsize) - } else { - None - }; + let aux_data_size = if 0 != auxsize { Some(auxsize) } else { None }; let hss_params = hss_params.split(','); @@ -499,8 +495,12 @@ fn parse_genkey1_parameter(hss_params: &str, ssts_params: &str, auxsize: &str) - let mut splitted = ssts_params.split('/'); let si_idx = splitted.next().expect("Signing instance index invalid"); let si_idx: u8 = si_idx.parse().expect("Signing instance index invalid"); - let total_num_si = splitted.next().expect("Total number of signing instances invalid"); - let total_num_si: u8 = total_num_si.parse().expect("Total number of signing instances invalid"); + let total_num_si = splitted + .next() + .expect("Total number of signing instances invalid"); + let total_num_si: u8 = total_num_si + .parse() + .expect("Total number of signing instances invalid"); let top_div_height = (total_num_si as f32).log2(); if top_div_height.fract() != 0.0 { diff --git a/src/constants.rs b/src/constants.rs index ad90002d..edd8fbb1 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -13,7 +13,11 @@ pub type LmsLeafIdentifier = [u8; 4]; type FvcMax = u16; type FvcSum = u16; type FvcCoef = (usize, u16, u64); // (index, shift, mask) -pub type FastVerifyCached = (FvcMax, FvcSum, ArrayVec<[FvcCoef; MAX_HASH_CHAIN_COUNT]>); +pub type FastVerifyCached = ( + FvcMax, + FvcSum, + ArrayVec<[FvcCoef; MAX_NUM_WINTERNITZ_CHAINS]>, +); pub const D_PBLC: [u8; 2] = [0x80, 0x80]; pub const D_MESG: [u8; 2] = [0x81, 0x81]; @@ -39,11 +43,17 @@ pub const fn prng_len(seed_len: usize) -> usize { 23 + seed_len } -pub const LMS_LEAF_IDENTIFIERS_SIZE: usize = 8; // TODO rename? HSS_COMPRESSED_USED_LEAFS_SIZE => 64 bit +pub const HSS_COMPRESSED_USED_LEAFS_SIZE: usize = size_of::(); pub const REF_IMPL_MAX_ALLOWED_HSS_LEVELS: usize = 8; -pub const REF_IMPL_SSTS_EXT_SIZE: usize = 2; + +pub const REF_IMPL_SSTS_EXT_SIGNING_ENTITY_IDX_SIZE: usize = size_of::(); +pub const REF_IMPL_SSTS_EXT_TOP_DIV_HEIGHT_SIZE: usize = size_of::(); + +pub const REF_IMPL_SSTS_EXT_SIZE: usize = + REF_IMPL_SSTS_EXT_SIGNING_ENTITY_IDX_SIZE + REF_IMPL_SSTS_EXT_TOP_DIV_HEIGHT_SIZE; + pub const REF_IMPL_MAX_PRIVATE_KEY_SIZE: usize = REF_IMPL_SSTS_EXT_SIZE - + LMS_LEAF_IDENTIFIERS_SIZE + + HSS_COMPRESSED_USED_LEAFS_SIZE + REF_IMPL_MAX_ALLOWED_HSS_LEVELS + MAX_SEED_LEN; @@ -52,31 +62,31 @@ pub const MAX_HASH_BLOCK_SIZE: usize = 64; pub const PRNG_MAX_LEN: usize = prng_len(MAX_HASH_SIZE); -pub const MAX_HASH_CHAIN_COUNT: usize = - get_hash_chain_count(MIN_WINTERNITZ_PARAMETER, MAX_HASH_SIZE); +pub const MAX_NUM_WINTERNITZ_CHAINS: usize = + get_num_winternitz_chains(MIN_WINTERNITZ_PARAMETER, MAX_HASH_SIZE); pub const MAX_LMOTS_SIGNATURE_LENGTH: usize = - lmots_signature_length(MAX_HASH_SIZE, MAX_HASH_CHAIN_COUNT); + lmots_signature_length(MAX_HASH_SIZE, MAX_NUM_WINTERNITZ_CHAINS); pub const MAX_LMS_PUBLIC_KEY_LENGTH: usize = lms_public_key_length(MAX_HASH_SIZE); pub const MAX_LMS_SIGNATURE_LENGTH: usize = - lms_signature_length(MAX_HASH_SIZE, MAX_HASH_CHAIN_COUNT, MAX_TREE_HEIGHT); + lms_signature_length(MAX_HASH_SIZE, MAX_NUM_WINTERNITZ_CHAINS, MAX_TREE_HEIGHT); pub const MAX_HSS_PUBLIC_KEY_LENGTH: usize = size_of::() // HSS Level + lms_public_key_length(MAX_HASH_SIZE); // Root LMS PublicKey pub const MAX_HSS_SIGNED_PUBLIC_KEY_LENGTH: usize = - hss_signed_public_key_length(MAX_HASH_SIZE, MAX_HASH_CHAIN_COUNT, MAX_TREE_HEIGHT); + hss_signed_public_key_length(MAX_HASH_SIZE, MAX_NUM_WINTERNITZ_CHAINS, MAX_TREE_HEIGHT); pub const MAX_HSS_SIGNATURE_LENGTH: usize = get_hss_signature_length(); -// DSM = Distributed State Management -// pub const _MAX_DSM_TOP_DIV_HEIGHT: usize = 8; -pub const MAX_DSM_SIGNING_ENTITIES: usize = 256; // TODO calc via 2^MAX_DSM_TOP_DIV_HEIGHT +pub const MAX_SSTS_TOP_DIV_HEIGHT: u32 = 8; // top division height for Single-Subtree-scheme +pub const MAX_SSTS_SIGNING_ENTITIES: usize = 2usize.pow(MAX_SSTS_TOP_DIV_HEIGHT); /// Calculated using the formula from RFC 8554 Appendix B /// https://datatracker.ietf.org/doc/html/rfc8554#appendix-B -const HASH_CHAIN_COUNTS: [usize; 12] = [136, 200, 265, 68, 101, 133, 35, 51, 67, 18, 26, 34]; +const NUM_WINTERNITZ_CHAINS: [usize; 12] = [136, 200, 265, 68, 101, 133, 35, 51, 67, 18, 26, 34]; -pub const fn get_hash_chain_count(winternitz_parameter: usize, output_size: usize) -> usize { +// RFC 8554: "p"; see terminology: "single Winternitz chain", "number of independent Winternitz chains" +pub const fn get_num_winternitz_chains(winternitz_parameter: usize, output_size: usize) -> usize { let w_i = match winternitz_parameter { 1 => 0usize, 2 => 1usize, @@ -92,13 +102,13 @@ pub const fn get_hash_chain_count(winternitz_parameter: usize, output_size: usiz _ => panic!("Invalid Output Size. Allowed is: 16, 24 or 32"), }; - HASH_CHAIN_COUNTS[w_i * 3 + o_i] + NUM_WINTERNITZ_CHAINS[w_i * 3 + o_i] } -pub const fn lmots_signature_length(hash_size: usize, hash_chain_count: usize) -> usize { +pub const fn lmots_signature_length(hash_size: usize, num_winternitz_chains: usize) -> usize { size_of::() // LMOTS Parameter TypeId + hash_size // Signature Randomizer - + (hash_size * hash_chain_count) // Signature Data + + (hash_size * num_winternitz_chains) // Signature Data } pub const fn lms_public_key_length(hash_size: usize) -> usize { @@ -110,21 +120,21 @@ pub const fn lms_public_key_length(hash_size: usize) -> usize { pub const fn lms_signature_length( hash_size: usize, - hash_chain_count: usize, + num_winternitz_chains: usize, tree_height: usize, ) -> usize { size_of::() // LMS Leaf Identifier - + lmots_signature_length(hash_size, hash_chain_count) // LMOTS Signature + + lmots_signature_length(hash_size, num_winternitz_chains) // LMOTS Signature + size_of::() // LMS Parameter TypeId + (hash_size * tree_height) // Authentication Path } pub const fn hss_signed_public_key_length( hash_size: usize, - hash_chain_count: usize, + num_winternitz_chains: usize, tree_height: usize, ) -> usize { - lms_signature_length(hash_size, hash_chain_count, tree_height) // LMS Signature + lms_signature_length(hash_size, num_winternitz_chains, tree_height) // LMS Signature + MAX_LMS_PUBLIC_KEY_LENGTH // LMS PublicKey } @@ -135,7 +145,7 @@ pub const fn get_hss_signature_length() -> usize { while level > 0 { length += hss_signed_public_key_length( MAX_HASH_SIZE, - get_hash_chain_count(WINTERNITZ_PARAMETERS[level], MAX_HASH_SIZE), + get_num_winternitz_chains(WINTERNITZ_PARAMETERS[level], MAX_HASH_SIZE), TREE_HEIGHTS[level], ); level -= 1; @@ -144,7 +154,7 @@ pub const fn get_hss_signature_length() -> usize { length + lms_signature_length( MAX_HASH_SIZE, - get_hash_chain_count(WINTERNITZ_PARAMETERS[0], MAX_HASH_SIZE), + get_num_winternitz_chains(WINTERNITZ_PARAMETERS[0], MAX_HASH_SIZE), TREE_HEIGHTS[0], ) } @@ -173,21 +183,21 @@ pub mod winternitz_chain { #[cfg(test)] mod tests { - use crate::constants::get_hash_chain_count; + use crate::constants::get_num_winternitz_chains; #[test] - fn test_get_hash_chain_count() { - assert_eq!(get_hash_chain_count(1, 32), 265); - assert_eq!(get_hash_chain_count(2, 32), 133); - assert_eq!(get_hash_chain_count(4, 32), 67); - assert_eq!(get_hash_chain_count(8, 32), 34); - assert_eq!(get_hash_chain_count(1, 24), 200); - assert_eq!(get_hash_chain_count(2, 24), 101); - assert_eq!(get_hash_chain_count(4, 24), 51); - assert_eq!(get_hash_chain_count(8, 24), 26); - assert_eq!(get_hash_chain_count(1, 16), 136); - assert_eq!(get_hash_chain_count(2, 16), 68); - assert_eq!(get_hash_chain_count(4, 16), 35); - assert_eq!(get_hash_chain_count(8, 16), 18); + fn test_get_hash_num_winternitz_chains() { + assert_eq!(get_num_winternitz_chains(1, 32), 265); + assert_eq!(get_num_winternitz_chains(2, 32), 133); + assert_eq!(get_num_winternitz_chains(4, 32), 67); + assert_eq!(get_num_winternitz_chains(8, 32), 34); + assert_eq!(get_num_winternitz_chains(1, 24), 200); + assert_eq!(get_num_winternitz_chains(2, 24), 101); + assert_eq!(get_num_winternitz_chains(4, 24), 51); + assert_eq!(get_num_winternitz_chains(8, 24), 26); + assert_eq!(get_num_winternitz_chains(1, 16), 136); + assert_eq!(get_num_winternitz_chains(2, 16), 68); + assert_eq!(get_num_winternitz_chains(4, 16), 35); + assert_eq!(get_num_winternitz_chains(8, 16), 18); } } diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index ba852207..b4c53e1c 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -3,10 +3,13 @@ use core::convert::TryInto; use tinyvec::ArrayVec; use crate::{ - constants::{MAX_ALLOWED_HSS_LEVELS, MAX_HSS_PUBLIC_KEY_LENGTH, MAX_DSM_SIGNING_ENTITIES, MAX_HASH_SIZE}, + constants::{ + MAX_ALLOWED_HSS_LEVELS, MAX_HASH_SIZE, MAX_HSS_PUBLIC_KEY_LENGTH, MAX_SSTS_SIGNING_ENTITIES, + }, hasher::HashChain, hss::aux::{ - hss_expand_aux_data, hss_finalize_aux_data, hss_optimal_aux_level, hss_store_aux_marker, hss_save_aux_data + hss_expand_aux_data, hss_finalize_aux_data, hss_optimal_aux_level, hss_save_aux_data, + hss_store_aux_marker, }, lms::{ self, @@ -14,8 +17,8 @@ use crate::{ generate_key_pair, parameters::LmsParameter, }, - sst::helper::get_subtree_node_idx, parameters::SstExtension, + sst::helper::get_subtree_node_idx, util::helper::read_and_advance, }; use crate::{hss::aux::hss_get_aux_data_len, lms::signing::LmsSignature}; @@ -127,7 +130,8 @@ impl HssPrivateKey { let moved = core::mem::take(aux_data); *aux_data = &mut moved[..aux_len]; - let aux_level = hss_optimal_aux_level(aux_len, *top_lms_parameter, None, opt_top_div_height); + let aux_level = + hss_optimal_aux_level(aux_len, *top_lms_parameter, None, opt_top_div_height); hss_store_aux_marker(aux_data, aux_level); hss_expand_aux_data::(Some(aux_data), None) @@ -183,7 +187,7 @@ impl HssPublicKey { let levels = parameters.len(); let used_leafs_indexes = private_key.compressed_used_leafs_indexes.to(¶meters); - let top_lms_parameter = parameters[0].get_lms_parameter(); // TODO: "[0]": discuss/review for SST + let top_lms_parameter = parameters[0].get_lms_parameter(); let is_aux_data_used = if let Some(ref aux_data) = aux_data { hss_is_aux_data_used(aux_data) @@ -194,7 +198,7 @@ impl HssPublicKey { let mut expanded_aux_data = HssPrivateKey::get_expanded_aux_data( aux_data, private_key, - top_lms_parameter, // TODO only top is forwarded to LmsPrivateKey for SST params + top_lms_parameter, is_aux_data_used, ); @@ -224,14 +228,14 @@ impl HssPublicKey { pub fn from_with_sst( private_key: &ReferenceImplPrivateKey, aux_data: Option<&mut &mut [u8]>, - intermed_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, - pubkey_hashval: ArrayVec<[u8; MAX_HASH_SIZE]>, + intermed_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_SSTS_SIGNING_ENTITIES]>, + pubkey_hashval: ArrayVec<[u8; MAX_HASH_SIZE]>, // TODO weg? ) -> Result { let parameters = private_key.compressed_parameter.to::()?; let levels = parameters.len(); let used_leafs_indexes = private_key.compressed_used_leafs_indexes.to(¶meters); - let top_lms_parameter = parameters[0].get_lms_parameter(); // TODO: "[0]": discuss/review for SST + let top_lms_parameter = parameters[0].get_lms_parameter(); let is_aux_data_used = if let Some(ref aux_data) = aux_data { hss_is_aux_data_used(aux_data) @@ -242,7 +246,7 @@ impl HssPublicKey { let mut expanded_aux_data = HssPrivateKey::get_expanded_aux_data( aux_data, private_key, - top_lms_parameter, // TODO only top is forwarded to LmsPrivateKey for SST params + top_lms_parameter, is_aux_data_used, ); @@ -262,8 +266,16 @@ impl HssPublicKey { let num_signing_entities = 2usize.pow(private_key.sst_ext.top_div_height as u32); for si in 1..=num_signing_entities as u8 { // node index of SI intermed node in whole tree: - let idx: usize = get_subtree_node_idx(si, top_lms_parameter.get_tree_height(), private_key.sst_ext.top_div_height) as usize; - hss_save_aux_data::(expanded_aux_data, idx, intermed_nodes[(si-1) as usize].as_slice()); + let idx: usize = get_subtree_node_idx( + si, + top_lms_parameter.get_tree_height(), + private_key.sst_ext.top_div_height, + ) as usize; + hss_save_aux_data::( + expanded_aux_data, + idx, + intermed_nodes[(si - 1) as usize].as_slice(), + ); } } diff --git a/src/hss/mod.rs b/src/hss/mod.rs index cf4c194f..4ad26965 100644 --- a/src/hss/mod.rs +++ b/src/hss/mod.rs @@ -294,7 +294,10 @@ mod tests { use super::parameter::HssParameter; use crate::util::helper::test_helper::gen_random_seed; use crate::{ - constants::{LMS_LEAF_IDENTIFIERS_SIZE, MAX_HASH_SIZE, REF_IMPL_MAX_ALLOWED_HSS_LEVELS, REF_IMPL_SSTS_EXT_SIZE}, + constants::{ + HSS_COMPRESSED_USED_LEAFS_SIZE, MAX_HASH_SIZE, REF_IMPL_MAX_ALLOWED_HSS_LEVELS, + REF_IMPL_SSTS_EXT_SIZE, + }, hasher::{ sha256::{Sha256_128, Sha256_192, Sha256_256}, shake256::{Shake256_128, Shake256_192, Shake256_256}, @@ -346,8 +349,8 @@ mod tests { signing_key_const.as_slice()[..REF_IMPL_SSTS_EXT_SIZE] ); assert_eq!( - signing_key.as_slice()[REF_IMPL_SSTS_EXT_SIZE+LMS_LEAF_IDENTIFIERS_SIZE..], - signing_key_const.as_slice()[REF_IMPL_SSTS_EXT_SIZE+LMS_LEAF_IDENTIFIERS_SIZE..] + signing_key.as_slice()[REF_IMPL_SSTS_EXT_SIZE + HSS_COMPRESSED_USED_LEAFS_SIZE..], + signing_key_const.as_slice()[REF_IMPL_SSTS_EXT_SIZE + HSS_COMPRESSED_USED_LEAFS_SIZE..] ); } @@ -378,7 +381,8 @@ mod tests { for index in 0..keypair_lifetime { assert_eq!( - signing_key.as_slice()[REF_IMPL_SSTS_EXT_SIZE..LMS_LEAF_IDENTIFIERS_SIZE+REF_IMPL_SSTS_EXT_SIZE], + signing_key.as_slice()[REF_IMPL_SSTS_EXT_SIZE + ..HSS_COMPRESSED_USED_LEAFS_SIZE + REF_IMPL_SSTS_EXT_SIZE], index.to_be_bytes(), ); assert_eq!( @@ -571,12 +575,8 @@ mod tests { vec_hss_params.push(HssParameter::construct_default_parameters()); let sst_param = SstsParameter::::new(vec_hss_params, 0, 0); - let (mut signing_key, verifying_key) = hss_keygen::( - &sst_param, - &seed, - None, - ) - .expect("Should generate HSS keys"); + let (mut signing_key, verifying_key) = + hss_keygen::(&sst_param, &seed, None).expect("Should generate HSS keys"); let message_values = [ 32u8, 48, 2, 1, 48, 58, 20, 57, 9, 83, 99, 255, 0, 34, 2, 1, 0, diff --git a/src/hss/reference_impl_private_key.rs b/src/hss/reference_impl_private_key.rs index d47b04fc..2162c1de 100644 --- a/src/hss/reference_impl_private_key.rs +++ b/src/hss/reference_impl_private_key.rs @@ -1,6 +1,6 @@ use crate::{ constants::{ - LmsTreeIdentifier, D_TOPSEED, ILEN, LMS_LEAF_IDENTIFIERS_SIZE, MAX_ALLOWED_HSS_LEVELS, + LmsTreeIdentifier, D_TOPSEED, HSS_COMPRESSED_USED_LEAFS_SIZE, ILEN, MAX_ALLOWED_HSS_LEVELS, MAX_HASH_SIZE, MAX_SEED_LEN, REF_IMPL_MAX_PRIVATE_KEY_SIZE, REF_IMPL_SSTS_EXT_SIZE, SEED_CHILD_SEED, SEED_SIGNATURE_RANDOMIZER_SEED, TOPSEED_D, TOPSEED_LEN, TOPSEED_SEED, TOPSEED_WHICH, @@ -103,7 +103,6 @@ impl ReferenceImplPrivateKey { } pub fn generate(parameters: &SstsParameter, seed: &Seed) -> Result { - let sst_ext = SstExtension { signing_entity_idx: parameters.get_signing_entity_idx(), top_div_height: parameters.get_top_div_height(), @@ -155,10 +154,10 @@ impl ReferenceImplPrivateKey { let mut index = 0; let ssts_ext = read_and_advance(data, REF_IMPL_SSTS_EXT_SIZE, &mut index); - result.sst_ext = SstExtension::from_slice(ssts_ext); + result.sst_ext = SstExtension::from_slice(ssts_ext)?; let compressed_used_leafs_indexes = - read_and_advance(data, LMS_LEAF_IDENTIFIERS_SIZE, &mut index); + read_and_advance(data, HSS_COMPRESSED_USED_LEAFS_SIZE, &mut index); result.compressed_used_leafs_indexes = CompressedUsedLeafsIndexes::from_slice(compressed_used_leafs_indexes); @@ -203,10 +202,12 @@ impl ReferenceImplPrivateKey { // TODO_FIX! Tree identifier needs to be the same for all signing entities // workaround for now: srt to fixed value - let lms_tree_identifier = [0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, - 0x05, 0x04, 0x03, 0x02, 0x01, 0x00]; // = LmsTreeIdentifier::default(); - // let mut lms_tree_identifier = LmsTreeIdentifier::default(); - // lms_tree_identifier.copy_from_slice(&hasher.finalize_reset()[..ILEN]); + let lms_tree_identifier = [ + 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, + 0x01, 0x00, + ]; // = LmsTreeIdentifier::default(); + // let mut lms_tree_identifier = LmsTreeIdentifier::default(); + // lms_tree_identifier.copy_from_slice(&hasher.finalize_reset()[..ILEN]); SeedAndLmsTreeIdentifier::new(&seed, &lms_tree_identifier) } @@ -348,7 +349,7 @@ impl CompressedUsedLeafsIndexes { } CompressedUsedLeafsIndexes { - count: compressed_used_leafs_indexes + count: compressed_used_leafs_indexes, } } diff --git a/src/hss/signing.rs b/src/hss/signing.rs index 72d03dad..49023ca5 100644 --- a/src/hss/signing.rs +++ b/src/hss/signing.rs @@ -216,7 +216,9 @@ impl<'a, H: HashChain> InMemoryHssSignedPublicKey<'a, H> { sig.lmots_signature .lmots_parameter .get_hash_function_output_size(), - sig.lmots_signature.lmots_parameter.get_hash_chain_count() as usize, + sig.lmots_signature + .lmots_parameter + .get_num_winternitz_chains() as usize, sig.lms_parameter.get_tree_height() as usize, ); @@ -234,7 +236,9 @@ impl<'a, H: HashChain> InMemoryHssSignedPublicKey<'a, H> { sig.lmots_signature .lmots_parameter .get_hash_function_output_size(), - sig.lmots_signature.lmots_parameter.get_hash_chain_count() as usize, + sig.lmots_signature + .lmots_parameter + .get_num_winternitz_chains() as usize, sig.lms_parameter.get_tree_height() as usize, ); let public_key_size = diff --git a/src/lib.rs b/src/lib.rs index 751e450a..6255bb2e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -120,7 +120,7 @@ pub use crate::hss::hss_verify as verify; pub use crate::hss::{SigningKey, VerifyingKey}; // @TODO: Re-export: API for distributed state management (SST, SingleSubTree) -pub use crate::constants::MAX_DSM_SIGNING_ENTITIES; +pub use crate::constants::MAX_SSTS_SIGNING_ENTITIES; pub use crate::sst::parameters::SstsParameter; pub use crate::sst::*; // {gen_key, sign, verify}; diff --git a/src/lm_ots/definitions.rs b/src/lm_ots/definitions.rs index b6c7989b..7c044e44 100644 --- a/src/lm_ots/definitions.rs +++ b/src/lm_ots/definitions.rs @@ -2,7 +2,9 @@ use tinyvec::ArrayVec; use zeroize::{Zeroize, ZeroizeOnDrop}; use crate::{ - constants::{LmsLeafIdentifier, LmsTreeIdentifier, Node, MAX_HASH_CHAIN_COUNT, MAX_HASH_SIZE}, + constants::{ + LmsLeafIdentifier, LmsTreeIdentifier, Node, MAX_HASH_SIZE, MAX_NUM_WINTERNITZ_CHAINS, + }, hasher::HashChain, util::ArrayVecZeroize, }; @@ -13,7 +15,7 @@ use super::parameters::LmotsParameter; pub struct LmotsPrivateKey { pub lms_tree_identifier: LmsTreeIdentifier, pub lms_leaf_identifier: LmsLeafIdentifier, - pub key: ArrayVecZeroize, // [[0u8; n]; p]; + pub key: ArrayVecZeroize, // [[0u8; n]; p]; #[zeroize(skip)] pub lmots_parameter: LmotsParameter, } @@ -22,7 +24,7 @@ impl LmotsPrivateKey { pub fn new( lms_tree_identifier: LmsTreeIdentifier, lms_leaf_identifier: LmsLeafIdentifier, - key: ArrayVec<[Node; MAX_HASH_CHAIN_COUNT]>, + key: ArrayVec<[Node; MAX_NUM_WINTERNITZ_CHAINS]>, lmots_parameter: LmotsParameter, ) -> Self { LmotsPrivateKey { @@ -69,7 +71,7 @@ mod tests { let parameter = $parameter.construct_parameter::<$hash_chain>().unwrap(); assert_eq!(parameter.get_hash_function_output_size(), $n); assert_eq!(parameter.get_winternitz(), $w); - assert_eq!(parameter.get_hash_chain_count(), $p); + assert_eq!(parameter.get_num_winternitz_chains(), $p); assert_eq!(parameter.get_checksum_left_shift(), $ls); assert_eq!(parameter.get_type_id(), $type); } diff --git a/src/lm_ots/keygen.rs b/src/lm_ots/keygen.rs index c749806a..b6458426 100644 --- a/src/lm_ots/keygen.rs +++ b/src/lm_ots/keygen.rs @@ -1,7 +1,7 @@ use super::definitions::*; use super::parameters::LmotsParameter; use crate::constants::*; -use crate::constants::{D_PBLC, MAX_HASH_CHAIN_COUNT, MAX_HASH_SIZE}; +use crate::constants::{D_PBLC, MAX_HASH_SIZE, MAX_NUM_WINTERNITZ_CHAINS}; use crate::hasher::HashChain; use crate::Seed; use tinyvec::ArrayVec; @@ -16,7 +16,7 @@ pub fn generate_private_key( let mut hasher = lmots_parameter.get_hasher(); - for index in 0..lmots_parameter.get_hash_chain_count() { + for index in 0..lmots_parameter.get_num_winternitz_chains() { hasher.update(&lms_tree_identifier); hasher.update(&lms_leaf_identifier); hasher.update(&index.to_be_bytes()); @@ -38,13 +38,13 @@ pub fn generate_public_key(private_key: &LmotsPrivateKey) -> Lm let lmots_parameter = &private_key.lmots_parameter; let mut hasher = lmots_parameter.get_hasher(); - let hash_chain_count: usize = 2_usize.pow(lmots_parameter.get_winternitz() as u32) - 1; + let num_hash_chain_iterations: usize = 2_usize.pow(lmots_parameter.get_winternitz() as u32) - 1; let key = &private_key.key; - let mut public_key_data: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_HASH_CHAIN_COUNT]> = + let mut public_key_data: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_NUM_WINTERNITZ_CHAINS]> = ArrayVec::new(); - for i in 0..lmots_parameter.get_hash_chain_count() as usize { + for i in 0..lmots_parameter.get_num_winternitz_chains() as usize { let mut hash_chain_data = H::prepare_hash_chain_data( &private_key.lms_tree_identifier, &private_key.lms_leaf_identifier, @@ -54,7 +54,7 @@ pub fn generate_public_key(private_key: &LmotsPrivateKey) -> Lm i as u16, key[i].as_slice(), 0, - hash_chain_count, + num_hash_chain_iterations, ); public_key_data.push(result); diff --git a/src/lm_ots/parameters.rs b/src/lm_ots/parameters.rs index c2e56410..dd6c77a8 100644 --- a/src/lm_ots/parameters.rs +++ b/src/lm_ots/parameters.rs @@ -2,7 +2,7 @@ use core::marker::PhantomData; use tinyvec::ArrayVec; -use crate::constants::get_hash_chain_count; +use crate::constants::get_num_winternitz_chains; use crate::{ constants::{FastVerifyCached, MAX_HASH_SIZE}, hasher::HashChain, @@ -50,25 +50,25 @@ impl LmotsAlgorithm { LmotsAlgorithm::LmotsW1 => Some(LmotsParameter::new( 1, 1, - get_hash_chain_count(1, H::OUTPUT_SIZE as usize) as u16, + get_num_winternitz_chains(1, H::OUTPUT_SIZE as usize) as u16, 7, )), LmotsAlgorithm::LmotsW2 => Some(LmotsParameter::new( 2, 2, - get_hash_chain_count(2, H::OUTPUT_SIZE as usize) as u16, + get_num_winternitz_chains(2, H::OUTPUT_SIZE as usize) as u16, 6, )), LmotsAlgorithm::LmotsW4 => Some(LmotsParameter::new( 3, 4, - get_hash_chain_count(4, H::OUTPUT_SIZE as usize) as u16, + get_num_winternitz_chains(4, H::OUTPUT_SIZE as usize) as u16, 4, )), LmotsAlgorithm::LmotsW8 => Some(LmotsParameter::new( 4, 8, - get_hash_chain_count(8, H::OUTPUT_SIZE as usize) as u16, + get_num_winternitz_chains(8, H::OUTPUT_SIZE as usize) as u16, 0, )), } @@ -89,7 +89,7 @@ impl LmotsAlgorithm { pub struct LmotsParameter { type_id: u32, winternitz: u8, - hash_chain_count: u16, + num_winternitz_chains: u16, checksum_left_shift: u8, phantom_data: PhantomData, } @@ -104,13 +104,13 @@ impl LmotsParameter { pub fn new( type_id: u32, winternitz: u8, - hash_chain_count: u16, + num_winternitz_chains: u16, checksum_left_shift: u8, ) -> Self { Self { type_id, winternitz, - hash_chain_count, + num_winternitz_chains, checksum_left_shift, phantom_data: PhantomData, } @@ -124,8 +124,8 @@ impl LmotsParameter { self.winternitz } - pub fn get_hash_chain_count(&self) -> u16 { - self.hash_chain_count + pub fn get_num_winternitz_chains(&self) -> u16 { + self.num_winternitz_chains } pub fn get_checksum_left_shift(&self) -> u8 { @@ -143,7 +143,7 @@ impl LmotsParameter { let sum = max * max_word_size; let mut coef = ArrayVec::new(); - for i in 0..self.get_hash_chain_count() { + for i in 0..self.get_num_winternitz_chains() { coef.push(coef_helper(i, self.get_winternitz())); } @@ -168,7 +168,7 @@ impl LmotsParameter { checksum <<= self.get_checksum_left_shift(); let checksum = [(checksum >> 8 & 0xff) as u8, (checksum & 0xff) as u8]; - for i in *max..self.get_hash_chain_count() { + for i in *max..self.get_num_winternitz_chains() { let (index, shift, mask) = coef[i as usize]; let hash_chain_length = ((checksum[index - 32] as u64 >> shift) & mask) as u16; total_hash_chain_iterations += hash_chain_length; diff --git a/src/lm_ots/signing.rs b/src/lm_ots/signing.rs index d730a9e3..e6931afb 100644 --- a/src/lm_ots/signing.rs +++ b/src/lm_ots/signing.rs @@ -1,5 +1,5 @@ use crate::{ - constants::{D_MESG, MAX_HASH_CHAIN_COUNT, MAX_HASH_SIZE, MAX_LMOTS_SIGNATURE_LENGTH}, + constants::{D_MESG, MAX_HASH_SIZE, MAX_LMOTS_SIGNATURE_LENGTH, MAX_NUM_WINTERNITZ_CHAINS}, hasher::HashChain, lm_ots::parameters::LmotsAlgorithm, util::{coef::coef, helper::read_and_advance}, @@ -24,7 +24,7 @@ use super::parameters::LmotsParameter; #[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct LmotsSignature { pub signature_randomizer: ArrayVec<[u8; MAX_HASH_SIZE]>, - pub signature_data: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_HASH_CHAIN_COUNT]>, + pub signature_data: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_NUM_WINTERNITZ_CHAINS]>, pub lmots_parameter: LmotsParameter, pub hash_iterations: u16, } @@ -113,15 +113,15 @@ impl LmotsSignature { fn calculate_signature( private_key: &LmotsPrivateKey, message_hash_with_checksum: &ArrayVec<[u8; MAX_HASH_SIZE + 2]>, - ) -> ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_HASH_CHAIN_COUNT]> { + ) -> ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_NUM_WINTERNITZ_CHAINS]> { let lmots_parameter = private_key.lmots_parameter; let mut hasher = lmots_parameter.get_hasher(); let mut signature_data = ArrayVec::new(); - for i in 0..lmots_parameter.get_hash_chain_count() { - let a = coef( + for i in 0..lmots_parameter.get_num_winternitz_chains() { + let num_hash_chain_iterations = coef( message_hash_with_checksum.as_slice(), i, lmots_parameter.get_winternitz(), @@ -131,7 +131,13 @@ impl LmotsSignature { &private_key.lms_tree_identifier, &private_key.lms_leaf_identifier, ); - let result = hasher.do_hash_chain(&mut hash_chain_data, i, initial.as_slice(), 0, a); + let result = hasher.do_hash_chain( + &mut hash_chain_data, + i, + initial.as_slice(), + 0, + num_hash_chain_iterations, + ); signature_data.push(result); } @@ -179,7 +185,7 @@ impl LmotsSignature { let signature_data = LmotsSignature::::calculate_signature(private_key, &message_hash_with_checksum); - let hash_iterations = (0..lmots_parameter.get_hash_chain_count()).fold(0, |sum, i| { + let hash_iterations = (0..lmots_parameter.get_num_winternitz_chains()).fold(0, |sum, i| { sum + coef( message_hash_with_checksum.as_slice(), i, @@ -228,7 +234,7 @@ impl<'a, H: HashChain> InMemoryLmotsSignature<'a, H> { let signature_data = read_and_advance( data, - (H::OUTPUT_SIZE * lmots_parameter.get_hash_chain_count()) as usize, + (H::OUTPUT_SIZE * lmots_parameter.get_num_winternitz_chains()) as usize, &mut index, ); @@ -338,7 +344,7 @@ mod tests { use tinyvec::ArrayVec; use crate::{ - constants::{MAX_HASH_CHAIN_COUNT, MAX_HASH_SIZE}, + constants::{MAX_HASH_SIZE, MAX_NUM_WINTERNITZ_CHAINS}, hasher::{ sha256::{Sha256_128, Sha256_192, Sha256_256}, shake256::{Shake256_128, Shake256_192, Shake256_256}, @@ -356,14 +362,14 @@ mod tests { let mut signature_randomizer = ArrayVec::new(); let mut signature_data: ArrayVec< - [ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_HASH_CHAIN_COUNT], + [ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_NUM_WINTERNITZ_CHAINS], > = ArrayVec::new(); for i in 0..lmots_parameter.get_hash_function_output_size() as usize { signature_randomizer.push(i as u8); } - for i in 0..lmots_parameter.get_hash_chain_count() as usize { + for i in 0..lmots_parameter.get_num_winternitz_chains() as usize { signature_data.push(ArrayVec::new()); for j in 0..lmots_parameter.get_hash_function_output_size() as usize { signature_data[i].push(j as u8); @@ -381,8 +387,11 @@ mod tests { // check signature len let output_size = lmots_parameter.get_hash_function_output_size() as usize; - let hash_chain_count = lmots_parameter.get_hash_chain_count() as usize; - assert_eq!(binary_rep.len(), 4 + output_size * (hash_chain_count + 1)); + let num_winternitz_chains = lmots_parameter.get_num_winternitz_chains() as usize; + assert_eq!( + binary_rep.len(), + 4 + output_size * (num_winternitz_chains + 1) + ); let deserialized_signature = InMemoryLmotsSignature::new(binary_rep.as_slice()) .expect("Deserialization must succeed."); diff --git a/src/lm_ots/verify.rs b/src/lm_ots/verify.rs index 4e1866b6..1d62a7c8 100644 --- a/src/lm_ots/verify.rs +++ b/src/lm_ots/verify.rs @@ -9,14 +9,18 @@ use super::{definitions::LmotsPublicKey, signing::InMemoryLmotsSignature}; #[derive(Default)] struct HashChainArray { - pub array_w1: - Option; get_hash_chain_count(1, MAX_HASH_SIZE)]>>, - pub array_w2: - Option; get_hash_chain_count(2, MAX_HASH_SIZE)]>>, - pub array_w4: - Option; get_hash_chain_count(4, MAX_HASH_SIZE)]>>, - pub array_w8: - Option; get_hash_chain_count(8, MAX_HASH_SIZE)]>>, + pub array_w1: Option< + ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; get_num_winternitz_chains(1, MAX_HASH_SIZE)]>, + >, + pub array_w2: Option< + ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; get_num_winternitz_chains(2, MAX_HASH_SIZE)]>, + >, + pub array_w4: Option< + ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; get_num_winternitz_chains(4, MAX_HASH_SIZE)]>, + >, + pub array_w8: Option< + ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; get_num_winternitz_chains(8, MAX_HASH_SIZE)]>, + >, phantom_data: PhantomData, } @@ -25,19 +29,19 @@ impl HashChainArray { let mut hash_chain_array = HashChainArray::::default(); if LmotsAlgorithm::from(lmots_parameter.get_type_id()) == LmotsAlgorithm::LmotsW8 { hash_chain_array.array_w8 = Some(ArrayVec::< - [ArrayVec<[u8; MAX_HASH_SIZE]>; get_hash_chain_count(8, MAX_HASH_SIZE)], + [ArrayVec<[u8; MAX_HASH_SIZE]>; get_num_winternitz_chains(8, MAX_HASH_SIZE)], >::default()); } else if LmotsAlgorithm::from(lmots_parameter.get_type_id()) == LmotsAlgorithm::LmotsW4 { hash_chain_array.array_w4 = Some(ArrayVec::< - [ArrayVec<[u8; MAX_HASH_SIZE]>; get_hash_chain_count(4, MAX_HASH_SIZE)], + [ArrayVec<[u8; MAX_HASH_SIZE]>; get_num_winternitz_chains(4, MAX_HASH_SIZE)], >::default()); } else if LmotsAlgorithm::from(lmots_parameter.get_type_id()) == LmotsAlgorithm::LmotsW2 { hash_chain_array.array_w2 = Some(ArrayVec::< - [ArrayVec<[u8; MAX_HASH_SIZE]>; get_hash_chain_count(2, MAX_HASH_SIZE)], + [ArrayVec<[u8; MAX_HASH_SIZE]>; get_num_winternitz_chains(2, MAX_HASH_SIZE)], >::default()); } else { hash_chain_array.array_w1 = Some(ArrayVec::< - [ArrayVec<[u8; MAX_HASH_SIZE]>; get_hash_chain_count(1, MAX_HASH_SIZE)], + [ArrayVec<[u8; MAX_HASH_SIZE]>; get_num_winternitz_chains(1, MAX_HASH_SIZE)], >::default()); } hash_chain_array @@ -111,8 +115,8 @@ pub fn generate_public_key_candidate( let mut hash_chain_array = HashChainArray::new(&lmots_parameter); let max_w = 2usize.pow(lmots_parameter.get_winternitz() as u32) - 1; - for i in 0..lmots_parameter.get_hash_chain_count() { - let a = coef( + for i in 0..lmots_parameter.get_num_winternitz_chains() { + let hash_chain_iterations_from = coef( message_hash_with_checksum.as_slice(), i, lmots_parameter.get_winternitz(), @@ -121,7 +125,13 @@ pub fn generate_public_key_candidate( let initial = signature.get_signature_data(i as usize); let mut hash_chain_data = H::prepare_hash_chain_data(lms_tree_identifier, &lms_leaf_identifier); - let result = hasher.do_hash_chain(&mut hash_chain_data, i, initial, a, max_w); + let result = hasher.do_hash_chain( + &mut hash_chain_data, + i, + initial, + hash_chain_iterations_from, + max_w, + ); hash_chain_array.push(&result); } diff --git a/src/lms/definitions.rs b/src/lms/definitions.rs index 37c7f725..d5515e79 100644 --- a/src/lms/definitions.rs +++ b/src/lms/definitions.rs @@ -95,7 +95,8 @@ impl LmsPublicKey { get_subtree_node_idx( sst_ext.signing_entity_idx, private_key.lms_parameter.get_tree_height(), - sst_ext.top_div_height) + sst_ext.top_div_height, + ) } else { 1 }; diff --git a/src/lms/signing.rs b/src/lms/signing.rs index e79508e3..17a2359f 100644 --- a/src/lms/signing.rs +++ b/src/lms/signing.rs @@ -174,7 +174,7 @@ impl<'a, H: HashChain> InMemoryLmsSignature<'a, H> { .unwrap(); let lmots_signature = lm_ots::signing::InMemoryLmotsSignature::new(read_and_advance( data, - (4 + H::OUTPUT_SIZE * (1 + lmots_parameter.get_hash_chain_count())) as usize, + (4 + H::OUTPUT_SIZE * (1 + lmots_parameter.get_num_winternitz_chains())) as usize, &mut index, )) .unwrap(); diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index ae808971..1b1022af 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -1,14 +1,14 @@ use crate::constants::LmsTreeIdentifier; use crate::signature::Error; use crate::{ - constants::{D_INTR, MAX_DSM_SIGNING_ENTITIES, MAX_HASH_SIZE}, + constants::{D_INTR, MAX_HASH_SIZE, MAX_SSTS_SIGNING_ENTITIES}, hasher::HashChain, hss::{ - definitions::HssPublicKey, + aux::{hss_finalize_aux_data, hss_is_aux_data_used}, definitions::HssPrivateKey, + definitions::HssPublicKey, reference_impl_private_key::{ReferenceImplPrivateKey, Seed}, SigningKey, VerifyingKey, - aux::{hss_finalize_aux_data, hss_is_aux_data_used}, }, lms::definitions::LmsPrivateKey, lms::helper::get_tree_element, @@ -24,7 +24,6 @@ pub fn genkey1_sst( seed: &Seed, aux_data: Option<&mut &mut [u8]>, ) -> Result<(SigningKey, ArrayVec<[u8; MAX_HASH_SIZE]>), Error> { - // create two representations of private keys because we need their data elements // -> ReferenceImplPrivateKey and SigningKey let rfc_private_key = @@ -41,7 +40,7 @@ pub fn genkey1_sst( let mut expanded_aux_data = HssPrivateKey::get_expanded_aux_data( aux_data, &rfc_private_key, - sst_param.get_hss_parameters()[0].get_lms_parameter(), // TODO only top is forwarded to LmsPrivateKey for SST params + sst_param.get_hss_parameters()[0].get_lms_parameter(), is_aux_data_used, ); @@ -93,17 +92,21 @@ pub fn genkey1_sst( ); // TODO do this via LmsPublicKey() and have aux data taken care of? where is aux data finalized in original code? - let our_node_value = get_tree_element(our_node_index as usize, &lms_private_key, &mut expanded_aux_data); + let our_node_value = get_tree_element( + our_node_index as usize, + &lms_private_key, + &mut expanded_aux_data, + ); if let Some(expanded_aux_data) = expanded_aux_data.as_mut() { hss_finalize_aux_data::(expanded_aux_data, rfc_private_key.seed.as_slice()); } + //println!("genkey1_sst(): our_node_value: {}", our_node_value); + Ok((signing_key, our_node_value)) } -pub fn get_num_signing_entities( - private_key: &[u8], -) -> Result { +pub fn get_num_signing_entities(private_key: &[u8]) -> Result { let rfc_private_key = ReferenceImplPrivateKey::::from_binary_representation(private_key) .map_err(|_| Error::new())?; @@ -114,10 +117,9 @@ pub fn get_num_signing_entities( pub fn genkey2_sst( private_key: &[u8], - interm_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, - aux_data: Option<&mut &mut [u8]> + interm_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_SSTS_SIGNING_ENTITIES]>, + aux_data: Option<&mut &mut [u8]>, ) -> Result, Error> { - let rfc_private_key = ReferenceImplPrivateKey::::from_binary_representation(private_key) .map_err(|_| Error::new())?; @@ -126,10 +128,15 @@ pub fn genkey2_sst( // TODO we don't need AUX here to read from, but we could populate the upper levels; AUX level marker needs then to be updated let pubkey_hash_val = get_node_hash_val::( - 1, interm_nodes, rfc_private_key.sst_ext.top_div_height, lms_tree_ident); + 1, + interm_nodes, + rfc_private_key.sst_ext.top_div_height, + lms_tree_ident, + ); - let hss_public_key = HssPublicKey::from_with_sst( - &rfc_private_key, aux_data, interm_nodes, pubkey_hash_val).map_err(|_| Error::new())?; + let hss_public_key = + HssPublicKey::from_with_sst(&rfc_private_key, aux_data, interm_nodes, pubkey_hash_val) + .map_err(|_| Error::new())?; let verifying_key = VerifyingKey::::from_bytes(&hss_public_key.to_binary_representation())?; @@ -138,7 +145,7 @@ pub fn genkey2_sst( fn get_node_hash_val( index: u32, - av_of_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_DSM_SIGNING_ENTITIES]>, + av_of_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_SSTS_SIGNING_ENTITIES]>, top_div_height: u8, lms_tree_ident: LmsTreeIdentifier, ) -> ArrayVec<[u8; MAX_HASH_SIZE]> { diff --git a/src/sst/helper.rs b/src/sst/helper.rs index 25867f37..0bb6726b 100644 --- a/src/sst/helper.rs +++ b/src/sst/helper.rs @@ -23,23 +23,8 @@ pub fn get_sst_last_leaf_idx(signing_entity_idx: u8, total_height: u8, top_div: assert!(signing_entity_idx > 0); assert!(signing_entity_idx as u32 <= get_num_leaves(top_div)); // number of nodes at that level get_sst_first_leaf_idx(signing_entity_idx, total_height, top_div) - + get_num_leaves_in_sst(total_height, top_div) - 1 -} - -// For a subtree, depending on whole SSTS and division, get first leaf idx on whole SSTS -pub fn _get_sst_first_leaf_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { - assert!(signing_entity_idx > 0); - assert!(signing_entity_idx as u32 <= get_num_leaves(top_div)); // number of nodes at that level - 2u32.pow(total_height as u32) - + (((signing_entity_idx as u32) - 1) * get_num_leaves_in_sst(total_height, top_div)) -} - -// For a subtree, depending on whole SSTS and division, get last leaf idx on whole SSTS -pub fn _get_sst_last_leaf_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u8) -> u32 { - assert!(signing_entity_idx > 0); - assert!(signing_entity_idx as u32 <= get_num_leaves(top_div)); // number of nodes at that level - _get_sst_first_leaf_node_idx(signing_entity_idx, total_height, top_div) - + get_num_leaves_in_sst(total_height, top_div) - 1 + + get_num_leaves_in_sst(total_height, top_div) + - 1 } // number of leaves of a Merkle tree @@ -47,10 +32,6 @@ fn get_num_leaves(height: u8) -> u32 { 2u32.pow(height as u32) } -fn _get_last_leaf_node_idx(height: u8) -> u32 { - 2u32.pow(height as u32 + 1) - 1 -} - #[cfg(test)] mod tests { @@ -105,64 +86,4 @@ mod tests { fn test_get_subtree_node_in_ssts_8() { let _subtree_node_idx = get_subtree_node_idx(17, 4, 4); } - - #[test] - fn test_get_last_leaf_node_idx() { - let last_idx = _get_last_leaf_node_idx(5); - assert_eq!(63, last_idx); - } - - /* - fn get_sst_first_leaf_idx(signing_entity_idx: usize, total_height: usize, top_div: usize) -> usize { - 2usize.pow(total_height as u32) - 1 + ((signing_entity_idx - 1) * 2usize.pow((total_height - top_div) as u32)) - } - - // For a subtree, depending on whole SSTS and division, get first leaf idx on whole SSTS - fn get_sst_last_leaf_idx(signing_entity_idx: usize, total_height: usize, top_div: usize) -> usize { - get_sst_first_leaf_idx(signing_entity_idx, total_height, top_div) - 1 + 2usize.pow((total_height - top_div) as u32) - } - */ - - #[test] - fn test_get_sst_first_leaf_idx_1() { - let first_leaf_idx = _get_sst_first_leaf_node_idx(1, 5, 3); - assert_eq!(32, first_leaf_idx); - } - - #[test] - fn test_get_sst_first_leaf_idx_2() { - let first_leaf_idx = _get_sst_first_leaf_node_idx(3, 5, 3); - assert_eq!(40, first_leaf_idx); - } - - #[test] - fn test_get_sst_first_leaf_idx_3() { - let first_leaf_idx = _get_sst_first_leaf_node_idx(8, 5, 3); - assert_eq!(60, first_leaf_idx); - } - - #[test] - fn test_get_sst_last_leaf_idx_1() { - let last_leaf_idx = _get_sst_last_leaf_node_idx(1, 5, 3); - assert_eq!(35, last_leaf_idx); - } - - #[test] - fn test_get_sst_last_leaf_idx_2() { - let last_leaf_idx = _get_sst_last_leaf_node_idx(3, 5, 3); - assert_eq!(43, last_leaf_idx); - } - - #[test] - fn test_get_sst_last_leaf_idx_3() { - let last_leaf_idx = _get_sst_last_leaf_node_idx(8, 5, 3); - assert_eq!(63, last_leaf_idx); - } - - #[test] - #[should_panic] - fn test_get_sst_last_leaf_idx_4() { - let last_leaf_idx = _get_sst_last_leaf_node_idx(9, 5, 3); - assert_eq!(63, last_leaf_idx); - } } diff --git a/src/sst/parameters.rs b/src/sst/parameters.rs index 27bda1c6..1dc7cc75 100644 --- a/src/sst/parameters.rs +++ b/src/sst/parameters.rs @@ -1,6 +1,5 @@ use crate::{constants, hasher::HashChain, hss::parameter::HssParameter}; -use core::convert::TryInto; use tinyvec::ArrayVec; use zeroize::{Zeroize, ZeroizeOnDrop}; @@ -42,7 +41,6 @@ impl SstsParameter { } } - #[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] pub struct SstExtension { pub signing_entity_idx: u8, @@ -50,19 +48,14 @@ pub struct SstExtension { } impl SstExtension { - - // TODO unlike in all other locations clippy reports - // "this returns a `Result<_, ()>`" and "use a custom `Error` type instead" - pub fn from_slice(data: &[u8]) -> Self { - + pub fn from_slice(data: &[u8]) -> Result { if data.len() != constants::REF_IMPL_SSTS_EXT_SIZE { - panic!("SstExtension::from_slice(): wrong data len"); - //return Err(Error::new()); - } - let tmp: u16 = u16::from_be_bytes(data.try_into().unwrap()); - SstExtension { - signing_entity_idx: (tmp >> 8) as u8, - top_div_height: tmp as u8, + return Err(()); } + + Ok(SstExtension { + signing_entity_idx: data[0], + top_div_height: data[1], + }) } } From 5169aa42a80e60111ea6e4a701c059ce64562655 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Thu, 1 Feb 2024 15:54:45 +0100 Subject: [PATCH 37/43] sst: code cleanup: simplify, remove redundancies Simplification is possible because AUX data is filled before calculating the "LmsPublicKey", so the "real" public key can now be calculated straight via "LmsPublicKey" with index 1. Before we used the LmsPublicKey with sst extension and index != 1 which would result in the intermediate node value. --- src/hss/definitions.rs | 48 ++++++++++---------- src/lms/definitions.rs | 14 +----- src/sst/gen_key.rs | 99 +++++++++++++----------------------------- 3 files changed, 53 insertions(+), 108 deletions(-) diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index b4c53e1c..db668cca 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -9,26 +9,24 @@ use crate::{ hasher::HashChain, hss::aux::{ hss_expand_aux_data, hss_finalize_aux_data, hss_optimal_aux_level, hss_save_aux_data, - hss_store_aux_marker, + hss_store_aux_marker, hss_get_aux_data_len, hss_is_aux_data_used, + MutableExpandedAuxData, }, lms::{ self, definitions::{InMemoryLmsPublicKey, LmsPrivateKey, LmsPublicKey}, generate_key_pair, parameters::LmsParameter, + signing::LmsSignature, }, parameters::SstExtension, sst::helper::get_subtree_node_idx, util::helper::read_and_advance, }; -use crate::{hss::aux::hss_get_aux_data_len, lms::signing::LmsSignature}; -use super::{ - aux::{hss_is_aux_data_used, MutableExpandedAuxData}, - reference_impl_private_key::{ +use super::reference_impl_private_key::{ generate_child_seed_and_lms_tree_identifier, generate_signature_randomizer, ReferenceImplPrivateKey, - }, }; #[derive(Debug, Default, PartialEq)] @@ -229,8 +227,12 @@ impl HssPublicKey { private_key: &ReferenceImplPrivateKey, aux_data: Option<&mut &mut [u8]>, intermed_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_SSTS_SIGNING_ENTITIES]>, - pubkey_hashval: ArrayVec<[u8; MAX_HASH_SIZE]>, // TODO weg? ) -> Result { + + if private_key.sst_ext.signing_entity_idx == 0 || private_key.sst_ext.top_div_height == 0 { + return Err(()); + }; + let parameters = private_key.compressed_parameter.to::()?; let levels = parameters.len(); let used_leafs_indexes = private_key.compressed_used_leafs_indexes.to(¶meters); @@ -243,26 +245,22 @@ impl HssPublicKey { false }; - let mut expanded_aux_data = HssPrivateKey::get_expanded_aux_data( + let mut opt_expanded_aux_data = HssPrivateKey::get_expanded_aux_data( aux_data, private_key, top_lms_parameter, is_aux_data_used, ); - let current_seed = private_key.generate_root_seed_and_lms_tree_identifier(); - - let mut sst_ext_option = None; - let sst_ext = SstExtension { - signing_entity_idx: private_key.sst_ext.signing_entity_idx, - top_div_height: private_key.sst_ext.top_div_height, + if let None = opt_expanded_aux_data.as_mut() { + return Err(()); }; - if private_key.sst_ext.signing_entity_idx != 0 { - sst_ext_option = Some(sst_ext); - } + let current_seed = private_key.generate_root_seed_and_lms_tree_identifier(); + + // TODO/Rework: how do we get rid of those repeated "if let Some"? // Additions for SSTS: add "intermediate node values" from other signing entities to AUX data - if let Some(expanded_aux_data) = expanded_aux_data.as_mut() { + if let Some(expanded_aux_data) = opt_expanded_aux_data.as_mut() { let num_signing_entities = 2usize.pow(private_key.sst_ext.top_div_height as u32); for si in 1..=num_signing_entities as u8 { // node index of SI intermed node in whole tree: @@ -279,23 +277,21 @@ impl HssPublicKey { } } - // here we will add more data to aux - let mut lms_keypair = generate_key_pair( + // here we will calc. the final public key (due to intermediate nodes being present in AUX data) and add more data to aux + let lms_keypair = generate_key_pair( ¤t_seed, ¶meters[0], &used_leafs_indexes[0], - &mut expanded_aux_data, - sst_ext_option, + &mut opt_expanded_aux_data, + None, //sst_ext_option, ); // calc. new AUX HMAC - if let Some(expanded_aux_data) = expanded_aux_data.as_mut() { + // TODO/Rework: how do we get rid of those repeated "if let Some"? + if let Some(expanded_aux_data) = opt_expanded_aux_data.as_mut() { hss_finalize_aux_data::(expanded_aux_data, private_key.seed.as_slice()); } - // Addition for SSTS: replace public key node value - lms_keypair.public_key.key = pubkey_hashval; - Ok(Self { public_key: lms_keypair.public_key, level: levels, diff --git a/src/lms/definitions.rs b/src/lms/definitions.rs index d5515e79..c8ec40d3 100644 --- a/src/lms/definitions.rs +++ b/src/lms/definitions.rs @@ -6,7 +6,6 @@ use crate::lms::helper::get_tree_element; use crate::lms::parameters::LmsAlgorithm; use crate::lms::MutableExpandedAuxData; use crate::sst::helper::get_sst_last_leaf_idx; -use crate::sst::helper::get_subtree_node_idx; use crate::sst::parameters::SstExtension; use crate::util::helper::read_and_advance; use crate::{lm_ots, Seed}; @@ -91,18 +90,9 @@ impl LmsPublicKey { private_key: &LmsPrivateKey, aux_data: &mut Option, ) -> Self { - let index = if let Some(sst_ext) = &private_key.sst_ext { - get_subtree_node_idx( - sst_ext.signing_entity_idx, - private_key.lms_parameter.get_tree_height(), - sst_ext.top_div_height, - ) - } else { - 1 - }; - + println!("LmsPublicKey::new() -> get_tree_element({})", 1); // use our signing entity's node index and also use that straight as "intermediate node hash value" instead of extra operation - let public_key = get_tree_element(index as usize, private_key, aux_data); + let public_key = get_tree_element(1 as usize, private_key, aux_data); Self { key: public_key, diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index 1b1022af..f107fe4c 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -1,7 +1,6 @@ -use crate::constants::LmsTreeIdentifier; use crate::signature::Error; use crate::{ - constants::{D_INTR, MAX_HASH_SIZE, MAX_SSTS_SIGNING_ENTITIES}, + constants::{MAX_HASH_SIZE, MAX_SSTS_SIGNING_ENTITIES}, hasher::HashChain, hss::{ aux::{hss_finalize_aux_data, hss_is_aux_data_used}, @@ -24,6 +23,10 @@ pub fn genkey1_sst( seed: &Seed, aux_data: Option<&mut &mut [u8]>, ) -> Result<(SigningKey, ArrayVec<[u8; MAX_HASH_SIZE]>), Error> { + if sst_param.get_signing_entity_idx() == 0 || sst_param.get_top_div_height() == 0 { + return Err(Error::new()); + } + // create two representations of private keys because we need their data elements // -> ReferenceImplPrivateKey and SigningKey let rfc_private_key = @@ -46,20 +49,15 @@ pub fn genkey1_sst( // calculate our intermediate node hash value; for this we have to generate a LmsPrivateKey - // TODO review: better option? redundant (used leafs calculation) - let mut used_leafs_index = 0; - if sst_param.get_top_div_height() != 0 { - // TODO: is there a better (Rust-idiomatic) approach? - used_leafs_index = helper::get_sst_first_leaf_idx( - sst_param.get_signing_entity_idx(), - sst_param.get_hss_parameters()[0] - .get_lms_parameter() - .get_tree_height(), - sst_param.get_top_div_height(), - ); - } + // TODO/Review: better option? redundant (used leafs calculation) + let used_leafs_index = helper::get_sst_first_leaf_idx( + sst_param.get_signing_entity_idx(), + sst_param.get_hss_parameters()[0] + .get_lms_parameter() + .get_tree_height(), + sst_param.get_top_div_height()); - // TODO: review! not exactly elegant to create an LmsPrivateKey and SeedAndLmsTreeIdentifier + // TODO/Review: not exactly elegant to create an LmsPrivateKey and SeedAndLmsTreeIdentifier let seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); let sst_ext = SstExtension { @@ -67,20 +65,16 @@ pub fn genkey1_sst( top_div_height: rfc_private_key.sst_ext.top_div_height, }; - let mut sst_ext_option = None; - let mut our_node_index = 1; // TODO don't do that...we're calc. the TOTAL public key + // TODO/Rework: try to get it from adapted LmsPublicKey::new() + let sst_ext_option = Some(sst_ext); - if rfc_private_key.sst_ext.signing_entity_idx != 0 { - sst_ext_option = Some(sst_ext); - - our_node_index = get_subtree_node_idx( - sst_param.get_signing_entity_idx(), - sst_param.get_hss_parameters()[0] - .get_lms_parameter() - .get_tree_height(), - sst_param.get_top_div_height(), - ); - } + let our_node_index = get_subtree_node_idx( + sst_param.get_signing_entity_idx(), + sst_param.get_hss_parameters()[0] + .get_lms_parameter() + .get_tree_height(), + sst_param.get_top_div_height(), + ); let lms_private_key = LmsPrivateKey::::new( seed_and_lms_tree_ident.seed.clone(), @@ -91,8 +85,8 @@ pub fn genkey1_sst( sst_ext_option, ); - // TODO do this via LmsPublicKey() and have aux data taken care of? where is aux data finalized in original code? - let our_node_value = get_tree_element( + // TODO/Rework: do this via LmsPublicKey() and have aux data taken care of? where is aux data finalized in original code? + let our_intermed_node_value = get_tree_element( our_node_index as usize, &lms_private_key, &mut expanded_aux_data, @@ -101,9 +95,7 @@ pub fn genkey1_sst( hss_finalize_aux_data::(expanded_aux_data, rfc_private_key.seed.as_slice()); } - //println!("genkey1_sst(): our_node_value: {}", our_node_value); - - Ok((signing_key, our_node_value)) + Ok((signing_key, our_intermed_node_value)) } pub fn get_num_signing_entities(private_key: &[u8]) -> Result { @@ -123,57 +115,24 @@ pub fn genkey2_sst( let rfc_private_key = ReferenceImplPrivateKey::::from_binary_representation(private_key) .map_err(|_| Error::new())?; + /* let seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); let lms_tree_ident = seed_and_lms_tree_ident.lms_tree_identifier; - // TODO we don't need AUX here to read from, but we could populate the upper levels; AUX level marker needs then to be updated + // TODO/Rework: we don't need AUX here to read from, but we could populate the upper levels; AUX level marker needs then to be updated let pubkey_hash_val = get_node_hash_val::( 1, interm_nodes, rfc_private_key.sst_ext.top_div_height, lms_tree_ident, ); + */ let hss_public_key = - HssPublicKey::from_with_sst(&rfc_private_key, aux_data, interm_nodes, pubkey_hash_val) + HssPublicKey::from_with_sst(&rfc_private_key, aux_data, interm_nodes) .map_err(|_| Error::new())?; let verifying_key = VerifyingKey::::from_bytes(&hss_public_key.to_binary_representation())?; Ok(verifying_key) } - -fn get_node_hash_val( - index: u32, - av_of_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_SSTS_SIGNING_ENTITIES]>, - top_div_height: u8, - lms_tree_ident: LmsTreeIdentifier, -) -> ArrayVec<[u8; MAX_HASH_SIZE]> { - let index_level = - (core::mem::size_of_val(&index) * 8 - index.leading_zeros() as usize - 1) as u8; - - let hasher = H::default() - .chain(lms_tree_ident) - .chain((index).to_be_bytes()); - - // if index is at lowest level (where we have the signing entity node hash values) - let result = if index_level == top_div_height { - // return the node value from array of intermedediate node hash values - /* access vector elements via "leaf numbers" = 0..signing_entites-1 */ - let leaf_number = (index as usize) - 2usize.pow(top_div_height as u32); - av_of_nodes[leaf_number] - } else { - // we are "above" the intermediate node hash values -> go down - let left = get_node_hash_val::(index * 2, av_of_nodes, top_div_height, lms_tree_ident); - let right = - get_node_hash_val::(index * 2 + 1, av_of_nodes, top_div_height, lms_tree_ident); - - hasher - .chain(D_INTR) - .chain(left.as_slice()) - .chain(right.as_slice()) - .finalize() - }; - - result -} From 072c7cbfed15edd58a968ce1d349d7782620b5dd Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Tue, 6 Feb 2024 18:13:07 +0100 Subject: [PATCH 38/43] sst: fix keygen and signing (TreeIdentifier) Use common tree identifier (RFC: "I") so that the key generation and signing all use the same value (as opposed to using different values dep. on their different seeds). --- benches/mod.rs | 8 ++-- examples/lms-demo.rs | 2 + examples/sst_demo.rs | 65 ++++++++++++++++++++++----- res/dist_state_mgmt.py | 7 +++ src/hss/definitions.rs | 23 +++++++--- src/hss/mod.rs | 17 +++++-- src/hss/reference_impl_private_key.rs | 16 +++---- src/hss/signing.rs | 4 +- src/hss/verify.rs | 2 +- src/lib.rs | 1 + src/sst/gen_key.rs | 27 +++++------ 11 files changed, 116 insertions(+), 56 deletions(-) diff --git a/benches/mod.rs b/benches/mod.rs index 315ecaac..60977c57 100644 --- a/benches/mod.rs +++ b/benches/mod.rs @@ -170,7 +170,7 @@ mod tests { b.iter(|| { let mut signing_key = signing_key.clone(); signing_key - .try_sign_with_aux(&MESSAGE, Some(aux_slice)) + .try_sign_with_aux(&MESSAGE, Some(aux_slice), None) .unwrap() }); } @@ -188,7 +188,7 @@ mod tests { b.iter(|| { let mut signing_key = signing_key.clone(); signing_key - .try_sign_with_aux(&MESSAGE, Some(aux_slice)) + .try_sign_with_aux(&MESSAGE, Some(aux_slice), None) .unwrap() }); } @@ -206,7 +206,7 @@ mod tests { b.iter(|| { let mut signing_key = signing_key.clone(); signing_key - .try_sign_with_aux(&MESSAGE, Some(aux_slice)) + .try_sign_with_aux(&MESSAGE, Some(aux_slice), None) .unwrap() }); } @@ -238,7 +238,7 @@ mod tests { b.iter(|| { let mut signing_key = signing_key.clone(); signing_key - .try_sign_with_aux(&MESSAGE, Some(aux_slice)) + .try_sign_with_aux(&MESSAGE, Some(aux_slice), None) .unwrap() }); } diff --git a/examples/lms-demo.rs b/examples/lms-demo.rs index 4e4c516a..b556ec71 100644 --- a/examples/lms-demo.rs +++ b/examples/lms-demo.rs @@ -147,6 +147,7 @@ fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { &private_key_data, &mut private_key_update_function, Some(aux_slice), + None, ) } else { hbs_lms::sign::( @@ -154,6 +155,7 @@ fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { &private_key_data, &mut private_key_update_function, None, + None, ) }; diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 4cfb9f11..2708293c 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -19,10 +19,11 @@ const SIGN_MUT_COMMAND: &str = "sign_mut"; const ARG_KEYNAME: &str = "keyname"; const ARG_MESSAGE: &str = "file"; -const ARG_HSS_PARAMETER: &str = "parameter"; +const ARG_HSS_PARAMETER: &str = "hss"; const ARG_SIGN_ENTITY_IDX_PARAMETER: &str = "se_param"; const ARG_SEED: &str = "seed"; const ARG_AUXSIZE: &str = "auxsize"; +const ARG_INIT_TREE_IDENT: &str = "init_tree_ident"; const ARG_SSTS_PARAM: &str = "ssts"; const AUX_DATA_DEFAULT_SIZE: usize = 100_000_000; @@ -69,20 +70,21 @@ fn main() -> Result<(), Box> { .arg(Arg::new(ARG_KEYNAME).required(true)) .arg(Arg::new(ARG_HSS_PARAMETER).required(true).help( "Specify LMS parameters (e.g. 10/2 => tree height = 10, Winternitz parameter = 2)")) - .arg(Arg::new(ARG_SSTS_PARAM).long(ARG_SSTS_PARAM).required(true).takes_value(true).value_name("ssts") + .arg(Arg::new(ARG_SSTS_PARAM).long(ARG_SSTS_PARAM).required(true).takes_value(true).value_name(ARG_SSTS_PARAM) .help( // TODO allow required = "false"? "Specify SSTS parameters (e.g. --ssts=3/8 => signing entity 3 of total 8")) - .arg(Arg::new(ARG_AUXSIZE).long(ARG_AUXSIZE).required(false).takes_value(true).value_name("auxsize").help( + // TODO/rework: I didn't manage to add an optional flag "--inittreeident" w/o value that's then true or false... + .arg(Arg::new(ARG_INIT_TREE_IDENT).long(ARG_INIT_TREE_IDENT).required(true).takes_value(true).value_name(ARG_INIT_TREE_IDENT).help( + "Announce initialization of tree identifier")) + .arg(Arg::new(ARG_AUXSIZE).long(ARG_AUXSIZE).required(false).takes_value(true).value_name(ARG_AUXSIZE).help( "Specify AUX data size in bytes")) - .arg(Arg::new(ARG_SEED).long(ARG_SEED).required(true).takes_value(true).value_name("seed")), + .arg(Arg::new(ARG_SEED).long(ARG_SEED).required(true).takes_value(true).value_name(ARG_SEED)), ) .subcommand( Command::new(GENKEY2_COMMAND) .arg(Arg::new(ARG_KEYNAME).required(true)) .arg(Arg::new(ARG_SIGN_ENTITY_IDX_PARAMETER).required(true).help( "Specify signing entity index (1..n))")) - .arg(Arg::new(ARG_AUXSIZE).long(ARG_AUXSIZE).required(false).takes_value(true).value_name("auxsize").help( - "Specify AUX data size in bytes")) ) .subcommand( Command::new(VERIFY_COMMAND) @@ -157,6 +159,16 @@ fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { let aux_data_filename = get_aux_filename(&keyname, None); let mut aux_data = read(aux_data_filename).ok(); + let treeident_filename = String::from("mykey_treeident.bin");// TODO/Fix get_treeident_filename(&keyname); + let tree_ident_filedata = read_file(&treeident_filename); + if tree_ident_filedata.len() != ILEN { + println!("Could not sign message. Tree ident file has wrong size."); + exit(-1); + } + let mut tree_ident_data: [u8; ILEN] = [0; ILEN]; + tree_ident_data.clone_from_slice(&tree_ident_filedata); + + let mut private_key_update_function = |new_key: &[u8]| { if write(&private_key_filename, new_key).is_ok() { return Ok(()); @@ -171,13 +183,17 @@ fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { &private_key_data, &mut private_key_update_function, Some(aux_slice), + Some(&tree_ident_data), ) } else { + // TODO/Rework: check availabulity of aux data above and remove this + // because we don't work w/o aux data (intermediate node hash values) in "SSTS" hbs_lms::sign::( &message_data, &private_key_data, &mut private_key_update_function, None, + Some(&tree_ident_data), ) }; @@ -303,6 +319,10 @@ fn get_aux_filename(keyname: &str, idx: Option) -> String { } } +fn get_treeident_filename(keyname: &str) -> String { + keyname.to_string() + "_treeident.bin" +} + fn get_parameter(name: &str, args: &ArgMatches) -> String { args.value_of(name) .expect("Parameter must be present.") @@ -323,6 +343,18 @@ fn read_file(file_name: &str) -> Vec { fn genkey1(args: &ArgMatches) -> Result<(), Box> { let keyname: String = get_parameter(ARG_KEYNAME, args); + let mut tree_ident_data: [u8; ILEN] = [0; ILEN]; + let arg_init_tree_ident = get_parameter(ARG_INIT_TREE_IDENT, args); + let treeident_filename = get_treeident_filename(&keyname); + if arg_init_tree_ident == "0" { + let tree_ident_filedata = read_file(&treeident_filename); + if tree_ident_filedata.len() != ILEN { + let error = String::from("tree identifier file: wrong len"); + return DemoError::raise(error); + } + tree_ident_data.clone_from_slice(&tree_ident_filedata); + } + let genkey_parameter = parse_genkey1_parameter( &get_parameter(ARG_HSS_PARAMETER, args), &get_parameter(ARG_SSTS_PARAM, args), @@ -352,7 +384,8 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { let aux_slice: &mut &mut [u8] = &mut &mut aux_data[..]; // create our private key - let (signing_key, intermed_node_hashval) = genkey1_sst(&ssts_param, &seed, Some(aux_slice)) + let (signing_key, intermed_node_hashval) = + genkey1_sst(&ssts_param, &seed, Some(aux_slice), &mut tree_ident_data) .unwrap_or_else(|_| panic!("Could not generate keys")); let private_key_filename = @@ -383,6 +416,9 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { get_aux_filename(&keyname, Some(ssts_param.get_signing_entity_idx())); write(&aux_filename, aux_slice)?; + + write(&treeident_filename, &tree_ident_data)?; + Ok(()) } @@ -397,8 +433,6 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { let mut aux_data_v: Vec = read_file(&aux_filename); let aux_slice: &mut &mut [u8] = &mut &mut aux_data_v[..]; - // println!("keyname: {} -- SI: {} -- aux_size: {}", keyname, signing_entity, aux_size); - // read private key let private_key_name = get_private_key_filename(&keyname, Some(signing_entity)); let private_key_data = read_file(&private_key_name); @@ -435,10 +469,17 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { // node_array.push(*node); } - let verifying_key = genkey2_sst::(&private_key_data, &node_array, Some(aux_slice)) - .unwrap_or_else(|_| panic!("Could not generate verifying key")); + let treeident_filename = get_treeident_filename(&keyname); + let tree_ident_filedata = read_file(&treeident_filename); + if tree_ident_filedata.len() != ILEN { + let error = String::from("tree identifier file: wrong len"); + return DemoError::raise(error); + } + let mut tree_ident_data: [u8; ILEN] = [0; ILEN]; + tree_ident_data.clone_from_slice(&tree_ident_filedata); - //println!("pub key (node 1) hash value: {:?}", verifying_key); + let verifying_key = genkey2_sst::(&private_key_data, &node_array, Some(aux_slice), &tree_ident_data) + .unwrap_or_else(|_| panic!("Could not generate verifying key")); write(&aux_filename, aux_slice)?; diff --git a/res/dist_state_mgmt.py b/res/dist_state_mgmt.py index 71ad0943..af4dd2ae 100755 --- a/res/dist_state_mgmt.py +++ b/res/dist_state_mgmt.py @@ -68,16 +68,23 @@ def genkey1(number_of_signing_entities, hss_params, auxsize): # 1. Create private key and intermediate node value # hss params e.g. "10/2,15/4" # ssts params e.g. "ssts=5/8" -> instance 5 of 8 + init_tree_ident = True for signing_entity in range(1, number_of_signing_entities + 1): cmd = ( f"cargo run --release --example sst_demo -- genkey1 mykey {hss_params} " f"--ssts={signing_entity}/{number_of_signing_entities} --auxsize={auxsize} --seed={seed}" ) + if True == init_tree_ident: + cmd = f"{cmd} --init_tree_ident=1" + else: + cmd = f"{cmd} --init_tree_ident=0" + result = subprocess.run( shlex.split(cmd), shell=False, capture_output=True, text=True ) seed = rotate(seed, 3) + init_tree_ident = False print(result.stdout) print(result.stderr) diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index db668cca..6e044e9b 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -5,6 +5,7 @@ use tinyvec::ArrayVec; use crate::{ constants::{ MAX_ALLOWED_HSS_LEVELS, MAX_HASH_SIZE, MAX_HSS_PUBLIC_KEY_LENGTH, MAX_SSTS_SIGNING_ENTITIES, + ILEN, }, hasher::HashChain, hss::aux::{ @@ -44,10 +45,16 @@ impl HssPrivateKey { pub fn from( private_key: &ReferenceImplPrivateKey, aux_data: &mut Option, + tree_identifier: Option<& [u8; ILEN]>, ) -> Result { let mut hss_private_key: HssPrivateKey = Default::default(); let mut current_seed = private_key.generate_root_seed_and_lms_tree_identifier(); + + if let Some(tree_identifier) = tree_identifier { + current_seed.lms_tree_identifier.clone_from_slice(tree_identifier); + } + let parameters = private_key.compressed_parameter.to::()?; let used_leafs_indexes = private_key.compressed_used_leafs_indexes.to(¶meters); @@ -227,6 +234,7 @@ impl HssPublicKey { private_key: &ReferenceImplPrivateKey, aux_data: Option<&mut &mut [u8]>, intermed_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_SSTS_SIGNING_ENTITIES]>, + tree_identifier: &[u8; ILEN], ) -> Result { if private_key.sst_ext.signing_entity_idx == 0 || private_key.sst_ext.top_div_height == 0 { @@ -256,7 +264,8 @@ impl HssPublicKey { return Err(()); }; - let current_seed = private_key.generate_root_seed_and_lms_tree_identifier(); + let mut current_seed = private_key.generate_root_seed_and_lms_tree_identifier(); + current_seed.lms_tree_identifier.copy_from_slice(tree_identifier); // TODO/Rework: how do we get rid of those repeated "if let Some"? // Additions for SSTS: add "intermediate node values" from other signing entities to AUX data @@ -423,13 +432,13 @@ mod tests { let seed = gen_random_seed::(); let mut rfc_key = ReferenceImplPrivateKey::generate(&sst_param, &seed).unwrap(); - let hss_key_before = HssPrivateKey::from(&rfc_key, &mut None).unwrap(); + let hss_key_before = HssPrivateKey::from(&rfc_key, &mut None, None).unwrap(); for _ in 0..increment_by { rfc_key.increment(&hss_key_before); } - let hss_key_after = HssPrivateKey::from(&rfc_key, &mut None).unwrap(); + let hss_key_after = HssPrivateKey::from(&rfc_key, &mut None, None).unwrap(); (hss_key_before, hss_key_after) } @@ -450,7 +459,7 @@ mod tests { let seed = gen_random_seed::(); let mut private_key = ReferenceImplPrivateKey::generate(&sst_param, &seed).unwrap(); - let hss_key = HssPrivateKey::from(&private_key, &mut None).unwrap(); + let hss_key = HssPrivateKey::from(&private_key, &mut None, None).unwrap(); let tree_heights = hss_key .private_key @@ -462,7 +471,7 @@ mod tests { const STEP_BY: usize = 27; for index in (0..total_ots_count).step_by(STEP_BY) { - let hss_key = HssPrivateKey::from(&private_key, &mut None).unwrap(); + let hss_key = HssPrivateKey::from(&private_key, &mut None, None).unwrap(); assert_eq!(hss_key.get_lifetime(), total_ots_count - index,); @@ -487,8 +496,8 @@ mod tests { let seed = gen_random_seed::(); let private_key = ReferenceImplPrivateKey::generate(&sst_param, &seed).unwrap(); - let hss_key = HssPrivateKey::from(&private_key, &mut None).unwrap(); - let hss_key_second = HssPrivateKey::from(&private_key, &mut None).unwrap(); + let hss_key = HssPrivateKey::from(&private_key, &mut None, None).unwrap(); + let hss_key_second = HssPrivateKey::from(&private_key, &mut None, None).unwrap(); assert_eq!(hss_key, hss_key_second); } diff --git a/src/hss/mod.rs b/src/hss/mod.rs index 4ad26965..fd6e8eb3 100644 --- a/src/hss/mod.rs +++ b/src/hss/mod.rs @@ -12,7 +12,7 @@ use tinyvec::ArrayVec; use super::parameters::SstsParameter; use crate::{ - constants::{MAX_HSS_PUBLIC_KEY_LENGTH, REF_IMPL_MAX_PRIVATE_KEY_SIZE}, + constants::{MAX_HSS_PUBLIC_KEY_LENGTH, REF_IMPL_MAX_PRIVATE_KEY_SIZE, ILEN}, hss::{aux::hss_is_aux_data_used, reference_impl_private_key::Seed}, signature::{Error, SignerMut, Verifier}, HashChain, Signature, VerifierSignature, @@ -55,7 +55,7 @@ impl SigningKey { let rfc_sk = ReferenceImplPrivateKey::from_binary_representation(self.bytes.as_slice()) .map_err(|_| Error::new())?; - let parsed_sk = HssPrivateKey::::from(&rfc_sk, &mut None).map_err(|_| Error::new())?; + let parsed_sk = HssPrivateKey::::from(&rfc_sk, &mut None, None).map_err(|_| Error::new())?; Ok(parsed_sk.get_lifetime()) } @@ -64,6 +64,7 @@ impl SigningKey { &mut self, msg: &[u8], aux_data: Option<&mut &mut [u8]>, + tree_ident: Option<&[u8; ILEN]>, ) -> Result { let private_key = self.bytes; let mut private_key_update_function = |new_key: &[u8]| { @@ -76,13 +77,14 @@ impl SigningKey { private_key.as_slice(), &mut private_key_update_function, aux_data, + tree_ident, ) } } impl SignerMut for SigningKey { fn try_sign(&mut self, msg: &[u8]) -> Result { - self.try_sign_with_aux(msg, None) + self.try_sign_with_aux(msg, None, None) } } @@ -158,6 +160,7 @@ pub fn hss_sign( private_key: &[u8], private_key_update_function: &mut dyn FnMut(&[u8]) -> Result<(), ()>, aux_data: Option<&mut &mut [u8]>, + tree_identifier: Option<& [u8; ILEN]>, ) -> Result { hss_sign_core::( Some(message), @@ -165,6 +168,7 @@ pub fn hss_sign( private_key, private_key_update_function, aux_data, + tree_identifier, ) } @@ -199,6 +203,7 @@ fn hss_sign_core( private_key: &[u8], private_key_update_function: &mut dyn FnMut(&[u8]) -> Result<(), ()>, aux_data: Option<&mut &mut [u8]>, + tree_identifier: Option<& [u8; ILEN]>, ) -> Result { let mut rfc_private_key = ReferenceImplPrivateKey::from_binary_representation(private_key) .map_err(|_| Error::new())?; @@ -220,7 +225,7 @@ fn hss_sign_core( is_aux_data_used, ); - let mut private_key = HssPrivateKey::::from(&rfc_private_key, &mut expanded_aux_data) + let mut private_key = HssPrivateKey::::from(&rfc_private_key, &mut expanded_aux_data, tree_identifier) .map_err(|_| Error::new())?; let hss_signature = HssSignature::sign( @@ -337,6 +342,7 @@ mod tests { signing_key_const.as_slice(), &mut update_private_key, None, + None ) .expect("Signing should complete without error."); @@ -402,6 +408,7 @@ mod tests { signing_key_const.as_slice(), &mut update_private_key, None, + None ) .expect("Signing should complete without error."); @@ -449,6 +456,7 @@ mod tests { signing_key_const.as_slice(), &mut update_private_key, None, + None, ) .unwrap_or_else(|_| { if index < keypair_lifetime { @@ -553,6 +561,7 @@ mod tests { signing_key_const.as_slice(), &mut update_private_key, None, + None ) .expect("Signing should complete without error."); diff --git a/src/hss/reference_impl_private_key.rs b/src/hss/reference_impl_private_key.rs index 2162c1de..e45df5a7 100644 --- a/src/hss/reference_impl_private_key.rs +++ b/src/hss/reference_impl_private_key.rs @@ -200,14 +200,10 @@ impl ReferenceImplPrivateKey { hash_preimage[TOPSEED_WHICH] = 0x02; hasher.update(&hash_preimage); - // TODO_FIX! Tree identifier needs to be the same for all signing entities - // workaround for now: srt to fixed value - let lms_tree_identifier = [ - 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, - 0x01, 0x00, - ]; // = LmsTreeIdentifier::default(); - // let mut lms_tree_identifier = LmsTreeIdentifier::default(); - // lms_tree_identifier.copy_from_slice(&hasher.finalize_reset()[..ILEN]); + // TODO/Rework: maybe provide the LmsTreeIdentifier as an Option-argument for this function + // The root LmsTreeIdentifier needs to be the same for all signing entities for signing and verification + let mut lms_tree_identifier = LmsTreeIdentifier::default(); + lms_tree_identifier.copy_from_slice(&hasher.finalize_reset()[..ILEN]); SeedAndLmsTreeIdentifier::new(&seed, &lms_tree_identifier) } @@ -411,7 +407,7 @@ mod tests { let seed = gen_random_seed::(); let mut rfc_private_key = ReferenceImplPrivateKey::generate(&sst_param, &seed).unwrap(); - let hss_private_key = HssPrivateKey::from(&rfc_private_key, &mut None).unwrap(); + let hss_private_key = HssPrivateKey::from(&rfc_private_key, &mut None, None).unwrap(); let seed = rfc_private_key.seed.clone(); @@ -441,7 +437,7 @@ mod tests { let seed = gen_random_seed::(); let mut rfc_private_key = ReferenceImplPrivateKey::generate(&sst_param, &seed).unwrap(); - let hss_private_key = HssPrivateKey::from(&rfc_private_key, &mut None).unwrap(); + let hss_private_key = HssPrivateKey::from(&rfc_private_key, &mut None, None).unwrap(); let keypair_lifetime = hss_private_key.get_lifetime(); for _ in 0..keypair_lifetime { diff --git a/src/hss/signing.rs b/src/hss/signing.rs index 49023ca5..34b70ee6 100644 --- a/src/hss/signing.rs +++ b/src/hss/signing.rs @@ -286,7 +286,7 @@ mod tests { let private_key = ReferenceImplPrivateKey::::generate(&sst_param, &seed).unwrap(); - let mut private_key = HssPrivateKey::from(&private_key, &mut None).unwrap(); + let mut private_key = HssPrivateKey::from(&private_key, &mut None, None).unwrap(); let message = [2, 56, 123, 22, 42, 49, 22]; @@ -346,7 +346,7 @@ mod tests { let private_key = ReferenceImplPrivateKey::::generate(&sst_param, &seed).unwrap(); - let mut private_key = HssPrivateKey::from(&private_key, &mut None).unwrap(); + let mut private_key = HssPrivateKey::from(&private_key, &mut None, None).unwrap(); let message_values = [2, 56, 123, 22, 42, 49, 22]; let mut message = [0u8; 64]; diff --git a/src/hss/verify.rs b/src/hss/verify.rs index 8d49b5ec..ff25f9a3 100644 --- a/src/hss/verify.rs +++ b/src/hss/verify.rs @@ -58,7 +58,7 @@ mod tests { let rfc_key = ReferenceImplPrivateKey::::generate(&sst_param, &seed).unwrap(); - let mut private_key = HssPrivateKey::from(&rfc_key, &mut None).unwrap(); + let mut private_key = HssPrivateKey::from(&rfc_key, &mut None, None).unwrap(); let public_key = HssPublicKey::from(&rfc_key, None).unwrap(); let message_values = [42, 57, 20, 59, 33, 1, 49, 3, 99, 130, 50, 20]; diff --git a/src/lib.rs b/src/lib.rs index 6255bb2e..83f5bcdb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -121,6 +121,7 @@ pub use crate::hss::{SigningKey, VerifyingKey}; // @TODO: Re-export: API for distributed state management (SST, SingleSubTree) pub use crate::constants::MAX_SSTS_SIGNING_ENTITIES; +pub use crate::constants::ILEN; pub use crate::sst::parameters::SstsParameter; pub use crate::sst::*; // {gen_key, sign, verify}; diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index f107fe4c..5faff801 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -1,6 +1,6 @@ use crate::signature::Error; use crate::{ - constants::{MAX_HASH_SIZE, MAX_SSTS_SIGNING_ENTITIES}, + constants::{MAX_HASH_SIZE, MAX_SSTS_SIGNING_ENTITIES, ILEN}, hasher::HashChain, hss::{ aux::{hss_finalize_aux_data, hss_is_aux_data_used}, @@ -22,6 +22,7 @@ pub fn genkey1_sst( sst_param: &SstsParameter, seed: &Seed, aux_data: Option<&mut &mut [u8]>, + tree_identifier: &mut [u8; ILEN], ) -> Result<(SigningKey, ArrayVec<[u8; MAX_HASH_SIZE]>), Error> { if sst_param.get_signing_entity_idx() == 0 || sst_param.get_top_div_height() == 0 { return Err(Error::new()); @@ -58,7 +59,13 @@ pub fn genkey1_sst( sst_param.get_top_div_height()); // TODO/Review: not exactly elegant to create an LmsPrivateKey and SeedAndLmsTreeIdentifier - let seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); + let mut seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); + + if tree_identifier.iter().all(|&byte| byte == 0) { + tree_identifier.clone_from_slice(&seed_and_lms_tree_ident.lms_tree_identifier); + } else { + seed_and_lms_tree_ident.lms_tree_identifier.clone_from_slice(tree_identifier); + } let sst_ext = SstExtension { signing_entity_idx: rfc_private_key.sst_ext.signing_entity_idx, @@ -111,25 +118,13 @@ pub fn genkey2_sst( private_key: &[u8], interm_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_SSTS_SIGNING_ENTITIES]>, aux_data: Option<&mut &mut [u8]>, + tree_identifier: &[u8; ILEN], ) -> Result, Error> { let rfc_private_key = ReferenceImplPrivateKey::::from_binary_representation(private_key) .map_err(|_| Error::new())?; - /* - let seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); - let lms_tree_ident = seed_and_lms_tree_ident.lms_tree_identifier; - - // TODO/Rework: we don't need AUX here to read from, but we could populate the upper levels; AUX level marker needs then to be updated - let pubkey_hash_val = get_node_hash_val::( - 1, - interm_nodes, - rfc_private_key.sst_ext.top_div_height, - lms_tree_ident, - ); - */ - let hss_public_key = - HssPublicKey::from_with_sst(&rfc_private_key, aux_data, interm_nodes) + HssPublicKey::from_with_sst(&rfc_private_key, aux_data, interm_nodes, tree_identifier) .map_err(|_| Error::new())?; let verifying_key = VerifyingKey::::from_bytes(&hss_public_key.to_binary_representation())?; From a22f410e2ffdda5f224ce66b048216fcd374a82a Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Wed, 24 Apr 2024 11:32:44 +0200 Subject: [PATCH 39/43] sst: clean up sst_demo and python-demo script --- examples/sst_demo.rs | 22 ++++++++++++-------- res/dist_state_mgmt.py | 46 ++++++++++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 25 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 2708293c..026264cf 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -9,8 +9,8 @@ use std::{ }; use tinyvec::ArrayVec; -const GENKEY1_COMMAND: &str = "genkey1"; -const GENKEY2_COMMAND: &str = "genkey2"; +const GENKEY1_COMMAND: &str = "prepare_keygen"; +const GENKEY2_COMMAND: &str = "finalize_keygen"; const VERIFY_COMMAND: &str = "verify"; const SIGN_COMMAND: &str = "sign"; @@ -20,7 +20,7 @@ const SIGN_MUT_COMMAND: &str = "sign_mut"; const ARG_KEYNAME: &str = "keyname"; const ARG_MESSAGE: &str = "file"; const ARG_HSS_PARAMETER: &str = "hss"; -const ARG_SIGN_ENTITY_IDX_PARAMETER: &str = "se_param"; +const ARG_SIGN_ENTITY_IDX: &str = "se_param"; const ARG_SEED: &str = "seed"; const ARG_AUXSIZE: &str = "auxsize"; const ARG_INIT_TREE_IDENT: &str = "init_tree_ident"; @@ -83,7 +83,7 @@ fn main() -> Result<(), Box> { .subcommand( Command::new(GENKEY2_COMMAND) .arg(Arg::new(ARG_KEYNAME).required(true)) - .arg(Arg::new(ARG_SIGN_ENTITY_IDX_PARAMETER).required(true).help( + .arg(Arg::new(ARG_SIGN_ENTITY_IDX).required(true).help( "Specify signing entity index (1..n))")) ) .subcommand( @@ -93,6 +93,8 @@ fn main() -> Result<(), Box> { .subcommand( Command::new(SIGN_COMMAND) .arg(Arg::new(ARG_KEYNAME).required(true)) + .arg(Arg::new(ARG_SIGN_ENTITY_IDX).required(true).help( + "Specify signing entity index (1..n))")) .arg(Arg::new(ARG_MESSAGE).required(true)) ); @@ -146,20 +148,24 @@ fn main() -> Result<(), Box> { Ok(()) } + fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { let keyname = get_parameter(ARG_KEYNAME, args); let message_name = get_parameter(ARG_MESSAGE, args); - let private_key_filename = get_private_key_filename(&keyname, None); + let se_idx = get_parameter(ARG_SIGN_ENTITY_IDX, args); + let se_idx: u8 = se_idx.parse::().unwrap(); + + let private_key_filename = get_private_key_filename(&keyname, Some(se_idx)); let signature_filename = get_signature_filename(&message_name); let private_key_data = read_file(&private_key_filename); let message_data = read_file(&message_name); - let aux_data_filename = get_aux_filename(&keyname, None); + let aux_data_filename = get_aux_filename(&keyname, Some(se_idx)); let mut aux_data = read(aux_data_filename).ok(); - let treeident_filename = String::from("mykey_treeident.bin");// TODO/Fix get_treeident_filename(&keyname); + let treeident_filename = keyname.to_string() + &String::from("_treeident.bin"); let tree_ident_filedata = read_file(&treeident_filename); if tree_ident_filedata.len() != ILEN { println!("Could not sign message. Tree ident file has wrong size."); @@ -425,7 +431,7 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { fn genkey2(args: &ArgMatches) -> Result<(), Box> { // get signing entity number and name of private keyfile from args let keyname: String = get_parameter(ARG_KEYNAME, args); - let signing_entity: String = get_parameter(ARG_SIGN_ENTITY_IDX_PARAMETER, args); + let signing_entity: String = get_parameter(ARG_SIGN_ENTITY_IDX, args); let signing_entity: u8 = signing_entity.parse::().unwrap(); // AUX data: created in genkey1, here we read the file diff --git a/res/dist_state_mgmt.py b/res/dist_state_mgmt.py index af4dd2ae..61b3b0f7 100755 --- a/res/dist_state_mgmt.py +++ b/res/dist_state_mgmt.py @@ -1,30 +1,35 @@ #!/usr/bin/env python3 -# TODO arguments: add seed; option for random seed? -# TODO arguments: add name for files - -import sys, subprocess, shlex, math, argparse +import sys, subprocess, shlex, math, argparse, os +# w/o time measurement +#demo_binary = "cargo run --release --example sst_demo -- " +# show timings +demo_binary = "time -p target/release/examples/sst_demo " def main(): args = parse() args = vars(args) - print("args: ", args) print('Executing "sst_demo" genkey1 and genkey2 with:') number_of_signing_entities = args["se"] - print("Number of signing entities: ", number_of_signing_entities) + print(" - Number of signing entities: ", number_of_signing_entities) hss_params = args["hss"] - print("HSS parameter: ", hss_params) + print(" - HSS parameter: ", hss_params) + + keyname = args["keyname"] + print(" - Keyname: ", keyname) auxsize = args["auxsize"] - print("AUX data size: ", auxsize) + print(" - AUX data size: ", auxsize) - genkey1(number_of_signing_entities, hss_params, auxsize) + print("") - genkey2(number_of_signing_entities) + genkey1(number_of_signing_entities, hss_params, auxsize, keyname) + + genkey2(number_of_signing_entities, keyname) # remove files with intermediate node hash values for signing_entity in range(1, number_of_signing_entities + 1): @@ -32,8 +37,6 @@ def main(): result = subprocess.run( shlex.split(cmd), shell=False, capture_output=True, text=True ) - # print(result.stdout) - # print(result.stderr) def parse(): @@ -45,6 +48,9 @@ def parse(): parser.add_argument( "--se", dest="se", type=int, help="number of signing entities (power of 2)" ) + parser.add_argument( + "--keyname", dest="keyname", type=ascii, help="keyname for storing files" + ) parser.add_argument( "--hss", dest="hss", @@ -63,16 +69,21 @@ def parse(): return args -def genkey1(number_of_signing_entities, hss_params, auxsize): - seed = "0123456701234567012345670123456701234567012345670123456701234567" +def genkey1(number_of_signing_entities, hss_params, auxsize, keyname): + # For "deterministic" results, set the seed here: + # seed = "abcd456701234567012345670123456701234567012345670123456701234567" + # 1. Create private key and intermediate node value # hss params e.g. "10/2,15/4" # ssts params e.g. "ssts=5/8" -> instance 5 of 8 init_tree_ident = True for signing_entity in range(1, number_of_signing_entities + 1): + seed = os.urandom(32).hex() + cmd = ( - f"cargo run --release --example sst_demo -- genkey1 mykey {hss_params} " + #f"{demo_binary} genkey1 {keyname} {hss_params} " + f"{demo_binary} prepare_keygen {keyname} {hss_params} " f"--ssts={signing_entity}/{number_of_signing_entities} --auxsize={auxsize} --seed={seed}" ) if True == init_tree_ident: @@ -89,12 +100,13 @@ def genkey1(number_of_signing_entities, hss_params, auxsize): print(result.stderr) -def genkey2(number_of_signing_entities): +def genkey2(number_of_signing_entities, keyname): # 2. read other intermediate node values and create public key for signing_entity in range(1, number_of_signing_entities + 1): cmd = ( - f"cargo run --release --example sst_demo -- genkey2 mykey {signing_entity}" + #f"{demo_binary} genkey2 {keyname} {signing_entity}" + f"{demo_binary} finalize_keygen {keyname} {signing_entity}" ) result = subprocess.run( shlex.split(cmd), shell=False, capture_output=True, text=True From c3b251ee252c866d1a87e69f492ac7959f356a1b Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Wed, 24 Apr 2024 16:59:00 +0200 Subject: [PATCH 40/43] sst: Improve naming, API, README; remove comments --- README.md | 14 +++++++++++--- benches/mod.rs | 2 +- examples/sst_demo.rs | 12 ++++++------ res/dist_state_mgmt.py | 2 -- src/hss/aux.rs | 21 ++++++++++++++------- src/hss/definitions.rs | 2 +- src/hss/mod.rs | 3 +-- src/lib.rs | 11 +++++++---- src/lms/definitions.rs | 2 -- src/lms/mod.rs | 4 ++-- src/sst/gen_key.rs | 7 ++----- src/sst/helper.rs | 1 + src/sst/mod.rs | 15 ++------------- src/sst/sign.rs | 23 ----------------------- src/sst/verify.rs | 13 ------------- 15 files changed, 48 insertions(+), 84 deletions(-) delete mode 100644 src/sst/sign.rs delete mode 100644 src/sst/verify.rs diff --git a/README.md b/README.md index 4d437198..f231bd39 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,17 @@ A demo application is located in the `examples` folder to demonstrate the use of This demo application can be used in the console as follows: ``` -# Key generation -# Generates `mykey.prv`, `mykey.pub` with merkle tree height = 10, winternitz parameter = 2, top tree height = 3, signing instance = 2 -cargo run --release --example lms-demo -- genkey mykey 10/2/3/2 --seed 0123456701234567012345670123456701234567012345670123456701234567 +# Key generation: prepare +# Generates intermediate node, generates or reads the tree identifier (init_tree_ident 1/0), and uses "mykey" as filename base. +# The following example uses two HSS levels, first with tree height = 10 / Winternitz = 8, second with 5 / 2. +# The signing instance index is 5 of total 8. +# This will use "mykey.5.prv" and "mykey.5.aux" for private key and aux data, and "mykey_treeident.bin" to write the tree identifier +cargo run --release --example sst_demo -- prepare_keygen mykey 10/8,5/2 --ssts=5/8 --auxsize=2048 \ + --seed=c912a74bc8c5fc1b2a73b96e6ce1eb2317dc9aa49806b30e578436d0f659b1f5 --init_tree_ident=0 + +# Key generation: finalize +# This will use mykey.5.pub to write the public key for signing entity index 5. +cargo run --release --example sst_demo -- finalize_keygen mykey 5 # Signing # Generates `message.txt.sig` diff --git a/benches/mod.rs b/benches/mod.rs index 60977c57..5d51022f 100644 --- a/benches/mod.rs +++ b/benches/mod.rs @@ -7,7 +7,7 @@ mod tests { use test::Bencher; use tinyvec::ArrayVec; - use hbs_lms::sst::parameters::SstsParameter; + use hbs_lms::SstsParameter; use hbs_lms::{keygen, HssParameter, LmotsAlgorithm, LmsAlgorithm, Seed, Sha256_256}; use hbs_lms::{ signature::{SignerMut, Verifier}, diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 026264cf..1fc049b7 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -108,7 +108,7 @@ fn main() -> Result<(), Box> { let matches = command.get_matches(); if let Some(args) = matches.subcommand_matches(GENKEY1_COMMAND) { - genkey1(args)?; + prepare_keygen(args)?; println!( "Single-subtree-structure: intermediate node and private key successfully generated!" ); @@ -116,7 +116,7 @@ fn main() -> Result<(), Box> { } if let Some(args) = matches.subcommand_matches(GENKEY2_COMMAND) { - genkey2(args)?; + finalize_keygen(args)?; println!("Single-subtree-structure: public key successfully generated!"); return Ok(()); } @@ -346,7 +346,7 @@ fn read_file(file_name: &str) -> Vec { data } -fn genkey1(args: &ArgMatches) -> Result<(), Box> { +fn prepare_keygen(args: &ArgMatches) -> Result<(), Box> { let keyname: String = get_parameter(ARG_KEYNAME, args); let mut tree_ident_data: [u8; ILEN] = [0; ILEN]; @@ -391,7 +391,7 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { // create our private key let (signing_key, intermed_node_hashval) = - genkey1_sst(&ssts_param, &seed, Some(aux_slice), &mut tree_ident_data) + prepare_sst_keygen(&ssts_param, &seed, Some(aux_slice), &mut tree_ident_data) .unwrap_or_else(|_| panic!("Could not generate keys")); let private_key_filename = @@ -428,7 +428,7 @@ fn genkey1(args: &ArgMatches) -> Result<(), Box> { Ok(()) } -fn genkey2(args: &ArgMatches) -> Result<(), Box> { +fn finalize_keygen(args: &ArgMatches) -> Result<(), Box> { // get signing entity number and name of private keyfile from args let keyname: String = get_parameter(ARG_KEYNAME, args); let signing_entity: String = get_parameter(ARG_SIGN_ENTITY_IDX, args); @@ -484,7 +484,7 @@ fn genkey2(args: &ArgMatches) -> Result<(), Box> { let mut tree_ident_data: [u8; ILEN] = [0; ILEN]; tree_ident_data.clone_from_slice(&tree_ident_filedata); - let verifying_key = genkey2_sst::(&private_key_data, &node_array, Some(aux_slice), &tree_ident_data) + let verifying_key = finalize_sst_keygen::(&private_key_data, &node_array, Some(aux_slice), &tree_ident_data) .unwrap_or_else(|_| panic!("Could not generate verifying key")); write(&aux_filename, aux_slice)?; diff --git a/res/dist_state_mgmt.py b/res/dist_state_mgmt.py index 61b3b0f7..7aef505a 100755 --- a/res/dist_state_mgmt.py +++ b/res/dist_state_mgmt.py @@ -82,7 +82,6 @@ def genkey1(number_of_signing_entities, hss_params, auxsize, keyname): seed = os.urandom(32).hex() cmd = ( - #f"{demo_binary} genkey1 {keyname} {hss_params} " f"{demo_binary} prepare_keygen {keyname} {hss_params} " f"--ssts={signing_entity}/{number_of_signing_entities} --auxsize={auxsize} --seed={seed}" ) @@ -105,7 +104,6 @@ def genkey2(number_of_signing_entities, keyname): for signing_entity in range(1, number_of_signing_entities + 1): cmd = ( - #f"{demo_binary} genkey2 {keyname} {signing_entity}" f"{demo_binary} finalize_keygen {keyname} {signing_entity}" ) result = subprocess.run( diff --git a/src/hss/aux.rs b/src/hss/aux.rs index 2c9b2ad0..afc0d862 100644 --- a/src/hss/aux.rs +++ b/src/hss/aux.rs @@ -33,15 +33,16 @@ pub struct MutableExpandedAuxData<'a> { pub hmac: &'a mut [u8], } -// TODO maybe improve: for SST wich e.g. 8 signing entities, each level would need only 1/8 of space that's needed w/o SST! -// TODO add unit tests +// TODO/Rework: +// Improve: for SST with e.g. 8 signing entities, each level below intermediate nodes +// would need only ~1/8 of space that's needed w/o SST +// (obviously it doesn't make sense to save lower-level nodes of other signing entities) pub fn hss_optimal_aux_level( mut max_length: usize, lms_parameter: LmsParameter, actual_len: Option<&mut usize>, top_div_height: Option, ) -> AuxLevel { - let mut aux_level = AuxLevel::default(); // HMAC has size of hash @@ -55,7 +56,10 @@ pub fn hss_optimal_aux_level( if let Some(top_div_height) = top_div_height { size_for_signing_entity_nodes = 2usize.pow(top_div_height as u32) * size_hash; - min_top_level = top_div_height + 1; // so we don't fill above our intermediate node values + // don't populate levels above the "intermediate node" values in first keygen step (those would be wrong) + // TODO/Rework: maybe populate the levels above intermed. node values in the second keygen step + // -> given the max. of 256 signing entities, that should result in a minor performance improvement + min_top_level = top_div_height + 1; // add level to level bit, later abort if max_length too small aux_level |= 0x80000000 | (1 << top_div_height); } @@ -79,7 +83,6 @@ pub fn hss_optimal_aux_level( let h0 = lms_parameter.get_tree_height().into(); for level in (min_top_level..=h0).rev().step_by(MIN_SUBTREE) { - // why other way round (cisco: 2,4,6...?! let len_this_level = size_hash << level; if max_length >= len_this_level { @@ -182,6 +185,7 @@ pub fn hss_is_aux_data_used(aux_data: &[u8]) -> bool { aux_data[AUX_DATA_MARKER] != NO_AUX_DATA } +// saves a single node value to AUX data pub fn hss_save_aux_data( data: &mut MutableExpandedAuxData, index: usize, @@ -193,6 +197,9 @@ pub fn hss_save_aux_data( return; } + // For SSTS keygen preparation, that's the nodes of the signing entity's sub-tree within the L0-tree. + // Omit saving values that will be replaced anyway by intermed. values of the other signing entities + // during keygen finalization let lms_leaf_identifier: usize = index - 2u32.pow(level as u32) as usize; let start_index = lms_leaf_identifier * H::OUTPUT_SIZE as usize; let end_index = start_index + H::OUTPUT_SIZE as usize; @@ -312,8 +319,8 @@ mod tests { let mut vec_hss_params: ArrayVec<[_; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]> = Default::default(); - vec_hss_params.push(HssParameter::new(lmots, lms)); - vec_hss_params.push(HssParameter::new(lmots, lms)); + vec_hss_params.push(HssParameter::::new(lmots, lms)); + vec_hss_params.push(HssParameter::::new(lmots, lms)); let sst_param = SstsParameter::new(vec_hss_params, 0, 0); let mut aux_data = [0u8; 1_000]; diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index 6e044e9b..8204a644 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -20,7 +20,7 @@ use crate::{ parameters::LmsParameter, signing::LmsSignature, }, - parameters::SstExtension, + sst::parameters::SstExtension, sst::helper::get_subtree_node_idx, util::helper::read_and_advance, }; diff --git a/src/hss/mod.rs b/src/hss/mod.rs index fd6e8eb3..702af420 100644 --- a/src/hss/mod.rs +++ b/src/hss/mod.rs @@ -9,11 +9,10 @@ pub mod verify; use core::{convert::TryFrom, marker::PhantomData}; use tinyvec::ArrayVec; -use super::parameters::SstsParameter; - use crate::{ constants::{MAX_HSS_PUBLIC_KEY_LENGTH, REF_IMPL_MAX_PRIVATE_KEY_SIZE, ILEN}, hss::{aux::hss_is_aux_data_used, reference_impl_private_key::Seed}, + sst::parameters::SstsParameter, signature::{Error, SignerMut, Verifier}, HashChain, Signature, VerifierSignature, }; diff --git a/src/lib.rs b/src/lib.rs index 83f5bcdb..f80fbef8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -91,8 +91,8 @@ mod hasher; mod hss; mod lm_ots; mod lms; +mod sst; mod util; -pub mod sst; // Re-export the `signature` crate pub use signature::{self}; @@ -119,18 +119,21 @@ pub use crate::hss::hss_sign_mut as sign_mut; pub use crate::hss::hss_verify as verify; pub use crate::hss::{SigningKey, VerifyingKey}; -// @TODO: Re-export: API for distributed state management (SST, SingleSubTree) +// TODO/Review: API for distributed state management (SST, SingleSubTree) +// should not contain anything else, while crate's modules get to use more of "sst" pub use crate::constants::MAX_SSTS_SIGNING_ENTITIES; pub use crate::constants::ILEN; + pub use crate::sst::parameters::SstsParameter; -pub use crate::sst::*; // {gen_key, sign, verify}; +pub use crate::sst::prepare_sst_keygen; +pub use crate::sst::finalize_sst_keygen; +pub use crate::sst::get_num_signing_entities; use core::convert::TryFrom; use signature::Error; use tinyvec::ArrayVec; use constants::MAX_HSS_SIGNATURE_LENGTH; -// @TODO review: okay in API? pub use crate::constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS; /** diff --git a/src/lms/definitions.rs b/src/lms/definitions.rs index c8ec40d3..3af9b79d 100644 --- a/src/lms/definitions.rs +++ b/src/lms/definitions.rs @@ -90,8 +90,6 @@ impl LmsPublicKey { private_key: &LmsPrivateKey, aux_data: &mut Option, ) -> Self { - println!("LmsPublicKey::new() -> get_tree_element({})", 1); - // use our signing entity's node index and also use that straight as "intermediate node hash value" instead of extra operation let public_key = get_tree_element(1 as usize, private_key, aux_data); Self { diff --git a/src/lms/mod.rs b/src/lms/mod.rs index 00ed1c03..3544c290 100644 --- a/src/lms/mod.rs +++ b/src/lms/mod.rs @@ -4,10 +4,10 @@ use crate::hss::parameter::HssParameter; use crate::hss::reference_impl_private_key::SeedAndLmsTreeIdentifier; use crate::lms::definitions::LmsPrivateKey; use crate::lms::definitions::LmsPublicKey; -use crate::parameters::SstExtension; +use crate::sst::parameters::SstExtension; pub mod definitions; -pub mod helper; // TODO review -> pub! +pub(crate) mod helper; pub mod parameters; pub mod signing; pub mod verify; diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index 5faff801..90fee462 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -18,7 +18,7 @@ use crate::{ use tinyvec::ArrayVec; -pub fn genkey1_sst( +pub fn prepare_sst_keygen( sst_param: &SstsParameter, seed: &Seed, aux_data: Option<&mut &mut [u8]>, @@ -58,7 +58,6 @@ pub fn genkey1_sst( .get_tree_height(), sst_param.get_top_div_height()); - // TODO/Review: not exactly elegant to create an LmsPrivateKey and SeedAndLmsTreeIdentifier let mut seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); if tree_identifier.iter().all(|&byte| byte == 0) { @@ -72,7 +71,6 @@ pub fn genkey1_sst( top_div_height: rfc_private_key.sst_ext.top_div_height, }; - // TODO/Rework: try to get it from adapted LmsPublicKey::new() let sst_ext_option = Some(sst_ext); let our_node_index = get_subtree_node_idx( @@ -92,7 +90,6 @@ pub fn genkey1_sst( sst_ext_option, ); - // TODO/Rework: do this via LmsPublicKey() and have aux data taken care of? where is aux data finalized in original code? let our_intermed_node_value = get_tree_element( our_node_index as usize, &lms_private_key, @@ -114,7 +111,7 @@ pub fn get_num_signing_entities(private_key: &[u8]) -> Result( +pub fn finalize_sst_keygen( private_key: &[u8], interm_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_SSTS_SIGNING_ENTITIES]>, aux_data: Option<&mut &mut [u8]>, diff --git a/src/sst/helper.rs b/src/sst/helper.rs index 0bb6726b..9a2519c1 100644 --- a/src/sst/helper.rs +++ b/src/sst/helper.rs @@ -8,6 +8,7 @@ pub fn get_subtree_node_idx(signing_entity_idx: u8, total_height: u8, top_div: u } fn get_num_leaves_in_sst(total_height: u8, top_div: u8) -> u32 { + assert!(top_div <= total_height); 2u32.pow((total_height - top_div) as u32) } diff --git a/src/sst/mod.rs b/src/sst/mod.rs index 9ef878b0..7f5a3da2 100644 --- a/src/sst/mod.rs +++ b/src/sst/mod.rs @@ -3,17 +3,6 @@ mod gen_key; pub use gen_key::*; -mod sign; -pub use sign::*; - -mod verify; -pub use verify::*; - -// @TODO how to allow "helper" for "lms", but not in API? +// public only inside crate pub(crate) mod helper; -//pub use helper::*; - -// inside crate make public -//pub(super) mod parameters; -// outside crate only limmited -pub mod parameters; +pub(crate) mod parameters; diff --git a/src/sst/sign.rs b/src/sst/sign.rs deleted file mode 100644 index 2dcd106c..00000000 --- a/src/sst/sign.rs +++ /dev/null @@ -1,23 +0,0 @@ -use crate::constants::Node; -use crate::constants::MAX_HASH_SIZE; -use crate::hss::signing::HssSignature; -use crate::signature::Error; -use crate::HashChain; -use tinyvec::ArrayVec; - -pub struct SstsSignature { - pub hss_signature: HssSignature, - pub our_node: Node, - pub auth_path: ArrayVec<[Node; MAX_HASH_SIZE]>, // order: sort on-the-fly dep. on Node's values? -} - -pub fn sign(_message: &[u8]) -> Result<(), Error> { - // nyi - /* hbs_lms::sign::( - &message_data, - &private_key_data, - &mut private_key_update_function, - Some(aux_slice), - ) */ - Ok(()) -} diff --git a/src/sst/verify.rs b/src/sst/verify.rs deleted file mode 100644 index 06f8f833..00000000 --- a/src/sst/verify.rs +++ /dev/null @@ -1,13 +0,0 @@ -use crate::HashChain; -//use crate::hss; - -pub fn verify(_message: &[u8], _signature: &[u8], _public_key: &[u8]) -> bool { - // @TODO nyi - // - verify SST (= HSS/LMS) signature (same as for HSS/LMS) - - //let _hss_sig = hss::hss_verify::(&message, &signature, &public_key).is_ok(); - - // - verify ST: calc. ST key candidate (using SST pubkey and authentication path), compare with stored ST publey - - true -} From 5b01dd138a78026ca2633a9759dbf8a7754e14f5 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Fri, 31 May 2024 16:20:04 +0200 Subject: [PATCH 41/43] sst: Cleanup (fmt, py-black, clippy); adapt README --- README.md | 30 +++++++++++++------------ examples/sst_demo.rs | 22 +++++++++--------- res/dist_state_mgmt.py | 22 +++++++++++++----- src/hss/aux.rs | 2 +- src/hss/definitions.rs | 32 ++++++++++++++------------- src/hss/mod.rs | 23 ++++++++++--------- src/hss/reference_impl_private_key.rs | 2 +- src/lib.rs | 8 +++---- src/lms/definitions.rs | 4 ++-- src/lms/mod.rs | 2 +- src/sst/gen_key.rs | 9 +++++--- tests/reference_implementation.rs | 1 + 12 files changed, 90 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index f231bd39..830b52c1 100644 --- a/README.md +++ b/README.md @@ -18,28 +18,30 @@ This demo application can be used in the console as follows: ``` # Key generation: prepare # Generates intermediate node, generates or reads the tree identifier (init_tree_ident 1/0), and uses "mykey" as filename base. +# One dedicated signing entity has to create the common L-0 tree identifier (--init_tree_ident=1) before other signing entities +# can generate their subtrees. +# # The following example uses two HSS levels, first with tree height = 10 / Winternitz = 8, second with 5 / 2. -# The signing instance index is 5 of total 8. +# First, a signing entity (here: 1 of 8) creates the tree identifier +cargo run --release --example sst_demo -- prepare_keygen mykey 10/8,5/2 --ssts=1/8 --auxsize=2048 \ + --seed=c912a74bc8c5fc1b2a73b96e6ce1eb2317dc9aa49806b30e578436d0f659b1f5 --init_tree_ident=1 +# The signing instance index is 3 of total 8, and this signing entity will use the tree identifier and use another secret seed. # This will use "mykey.5.prv" and "mykey.5.aux" for private key and aux data, and "mykey_treeident.bin" to write the tree identifier -cargo run --release --example sst_demo -- prepare_keygen mykey 10/8,5/2 --ssts=5/8 --auxsize=2048 \ - --seed=c912a74bc8c5fc1b2a73b96e6ce1eb2317dc9aa49806b30e578436d0f659b1f5 --init_tree_ident=0 +cargo run --release --example sst_demo -- prepare_keygen mykey 10/8,5/2 --ssts=3/8 --auxsize=2048 \ + --seed=1eb2317dc9aa49806b30e578436d0f659b1f5c912a74bc8c5fc1b2a73b96e6ce --init_tree_ident=0 # Key generation: finalize -# This will use mykey.5.pub to write the public key for signing entity index 5. -cargo run --release --example sst_demo -- finalize_keygen mykey 5 +# After all signing entities have created their intermediate node values, the public key can be generated. +# This will use mykey.5.pub to write the public key for signing entity index 3. +cargo run --release --example sst_demo -- finalize_keygen mykey 3 # Signing -# Generates `message.txt.sig` -cargo run --release --example lms-demo -- sign mykey message.txt - -# Signing (fast_verification) -# Generates `message.txt_mut`, `message.txt_mut.sig` -HBS_LMS_MAX_HASH_OPTIMIZATIONS=1000 HBS_LMS_THREADS=2 cargo run --release --example lms-demo \ - --features fast_verify -- sign_mut mykey message.txt +# Generates `message.txt.sig` using mykey.5.prv +cargo run --release --example sst_demo -- sign mykey 5 message.txt # Verification -# Verifies `message.txt` with `message.txt.sig` against `mykey.pub` -cargo run --release --example lms-demo -- verify mykey message.txt +# Verifies `message.txt` with `message.txt.sig` against `mykey.5.pub` +cargo run --release --example sst_demo -- verify mykey.5 message.txt ``` ## Naming conventions wrt to the IETF RFC diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 1fc049b7..4ba4e7b5 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -148,7 +148,6 @@ fn main() -> Result<(), Box> { Ok(()) } - fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { let keyname = get_parameter(ARG_KEYNAME, args); let message_name = get_parameter(ARG_MESSAGE, args); @@ -174,7 +173,6 @@ fn sign(args: &ArgMatches) -> Result<(), std::io::Error> { let mut tree_ident_data: [u8; ILEN] = [0; ILEN]; tree_ident_data.clone_from_slice(&tree_ident_filedata); - let mut private_key_update_function = |new_key: &[u8]| { if write(&private_key_filename, new_key).is_ok() { return Ok(()); @@ -218,17 +216,17 @@ fn sign_mut(args: &ArgMatches) -> Result<(), std::io::Error> { let keyname = get_parameter(ARG_KEYNAME, args); let message_name = get_parameter(ARG_MESSAGE, args); - let private_key_name = get_private_key_filename(&keyname); + let private_key_name = get_private_key_filename(&keyname, None); - let signature_name_mut = get_signature_mut_name(&message_name); - let message_name_mut = get_message_mut_name(&message_name); + let signature_name_mut = get_signature_mut_filename(&message_name); + let message_name_mut = get_message_mut_filename(&message_name); let private_key_data = read_file(&private_key_name); let mut message_data = read_file(&message_name); message_data.extend_from_slice(&[0u8; 32]); - let aux_data_name = get_aux_filename(&keyname); + let aux_data_name = get_aux_filename(&keyname, None); let mut aux_data = read(aux_data_name).ok(); let mut private_key_update_function = |new_key: &[u8]| { @@ -392,7 +390,7 @@ fn prepare_keygen(args: &ArgMatches) -> Result<(), Box> { // create our private key let (signing_key, intermed_node_hashval) = prepare_sst_keygen(&ssts_param, &seed, Some(aux_slice), &mut tree_ident_data) - .unwrap_or_else(|_| panic!("Could not generate keys")); + .unwrap_or_else(|_| panic!("Could not generate keys")); let private_key_filename = get_private_key_filename(&keyname, Some(ssts_param.get_signing_entity_idx())); @@ -422,7 +420,6 @@ fn prepare_keygen(args: &ArgMatches) -> Result<(), Box> { get_aux_filename(&keyname, Some(ssts_param.get_signing_entity_idx())); write(&aux_filename, aux_slice)?; - write(&treeident_filename, &tree_ident_data)?; Ok(()) @@ -484,8 +481,13 @@ fn finalize_keygen(args: &ArgMatches) -> Result<(), Box> let mut tree_ident_data: [u8; ILEN] = [0; ILEN]; tree_ident_data.clone_from_slice(&tree_ident_filedata); - let verifying_key = finalize_sst_keygen::(&private_key_data, &node_array, Some(aux_slice), &tree_ident_data) - .unwrap_or_else(|_| panic!("Could not generate verifying key")); + let verifying_key = finalize_sst_keygen::( + &private_key_data, + &node_array, + Some(aux_slice), + &tree_ident_data, + ) + .unwrap_or_else(|_| panic!("Could not generate verifying key")); write(&aux_filename, aux_slice)?; diff --git a/res/dist_state_mgmt.py b/res/dist_state_mgmt.py index 7aef505a..29fdbdb0 100755 --- a/res/dist_state_mgmt.py +++ b/res/dist_state_mgmt.py @@ -3,10 +3,11 @@ import sys, subprocess, shlex, math, argparse, os # w/o time measurement -#demo_binary = "cargo run --release --example sst_demo -- " +# demo_binary = "cargo run --release --example sst_demo -- " # show timings demo_binary = "time -p target/release/examples/sst_demo " + def main(): args = parse() args = vars(args) @@ -46,15 +47,24 @@ def parse(): ) parser.add_argument( - "--se", dest="se", type=int, help="number of signing entities (power of 2)" + "--se", + dest="se", + type=int, + help="number of signing entities (power of 2)", + required=True, ) parser.add_argument( - "--keyname", dest="keyname", type=ascii, help="keyname for storing files" + "--keyname", + dest="keyname", + type=ascii, + help="keyname for storing files", + required=True, ) parser.add_argument( "--hss", dest="hss", help="HSS parameters; e.g. 10/2,15/4 [LMS-height/Winternitz-param.]", + required=True, ) parser.add_argument( "--auxsize", @@ -62,6 +72,7 @@ def parse(): nargs="?", default="0", help="Max AUX data file, size in bytes", + required=True, ) args = parser.parse_args() @@ -79,6 +90,7 @@ def genkey1(number_of_signing_entities, hss_params, auxsize, keyname): init_tree_ident = True for signing_entity in range(1, number_of_signing_entities + 1): + print("GenKey1 for signing entity: ", signing_entity) seed = os.urandom(32).hex() cmd = ( @@ -103,9 +115,7 @@ def genkey2(number_of_signing_entities, keyname): # 2. read other intermediate node values and create public key for signing_entity in range(1, number_of_signing_entities + 1): - cmd = ( - f"{demo_binary} finalize_keygen {keyname} {signing_entity}" - ) + cmd = f"{demo_binary} finalize_keygen {keyname} {signing_entity}" result = subprocess.run( shlex.split(cmd), shell=False, capture_output=True, text=True ) diff --git a/src/hss/aux.rs b/src/hss/aux.rs index afc0d862..20ef04f1 100644 --- a/src/hss/aux.rs +++ b/src/hss/aux.rs @@ -80,7 +80,7 @@ pub fn hss_optimal_aux_level( max_length -= min_length; - let h0 = lms_parameter.get_tree_height().into(); + let h0 = lms_parameter.get_tree_height(); for level in (min_top_level..=h0).rev().step_by(MIN_SUBTREE) { let len_this_level = size_hash << level; diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index 8204a644..e622e438 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -4,14 +4,13 @@ use tinyvec::ArrayVec; use crate::{ constants::{ - MAX_ALLOWED_HSS_LEVELS, MAX_HASH_SIZE, MAX_HSS_PUBLIC_KEY_LENGTH, MAX_SSTS_SIGNING_ENTITIES, - ILEN, + ILEN, MAX_ALLOWED_HSS_LEVELS, MAX_HASH_SIZE, MAX_HSS_PUBLIC_KEY_LENGTH, + MAX_SSTS_SIGNING_ENTITIES, }, hasher::HashChain, hss::aux::{ - hss_expand_aux_data, hss_finalize_aux_data, hss_optimal_aux_level, hss_save_aux_data, - hss_store_aux_marker, hss_get_aux_data_len, hss_is_aux_data_used, - MutableExpandedAuxData, + hss_expand_aux_data, hss_finalize_aux_data, hss_get_aux_data_len, hss_is_aux_data_used, + hss_optimal_aux_level, hss_save_aux_data, hss_store_aux_marker, MutableExpandedAuxData, }, lms::{ self, @@ -20,14 +19,14 @@ use crate::{ parameters::LmsParameter, signing::LmsSignature, }, - sst::parameters::SstExtension, sst::helper::get_subtree_node_idx, + sst::parameters::SstExtension, util::helper::read_and_advance, }; use super::reference_impl_private_key::{ - generate_child_seed_and_lms_tree_identifier, generate_signature_randomizer, - ReferenceImplPrivateKey, + generate_child_seed_and_lms_tree_identifier, generate_signature_randomizer, + ReferenceImplPrivateKey, }; #[derive(Debug, Default, PartialEq)] @@ -45,14 +44,16 @@ impl HssPrivateKey { pub fn from( private_key: &ReferenceImplPrivateKey, aux_data: &mut Option, - tree_identifier: Option<& [u8; ILEN]>, + tree_identifier: Option<&[u8; ILEN]>, ) -> Result { let mut hss_private_key: HssPrivateKey = Default::default(); let mut current_seed = private_key.generate_root_seed_and_lms_tree_identifier(); if let Some(tree_identifier) = tree_identifier { - current_seed.lms_tree_identifier.clone_from_slice(tree_identifier); + current_seed + .lms_tree_identifier + .clone_from_slice(tree_identifier); } let parameters = private_key.compressed_parameter.to::()?; @@ -229,14 +230,13 @@ impl HssPublicKey { }) } - // same as above, but to keep the function's signature, we add a variant for SSTS + // same as "from()" above, but to keep the original function's signature, we add a variant for SSTS pub fn from_with_sst( private_key: &ReferenceImplPrivateKey, aux_data: Option<&mut &mut [u8]>, intermed_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_SSTS_SIGNING_ENTITIES]>, tree_identifier: &[u8; ILEN], ) -> Result { - if private_key.sst_ext.signing_entity_idx == 0 || private_key.sst_ext.top_div_height == 0 { return Err(()); }; @@ -260,12 +260,14 @@ impl HssPublicKey { is_aux_data_used, ); - if let None = opt_expanded_aux_data.as_mut() { + if opt_expanded_aux_data.as_mut().is_none() { return Err(()); }; let mut current_seed = private_key.generate_root_seed_and_lms_tree_identifier(); - current_seed.lms_tree_identifier.copy_from_slice(tree_identifier); + current_seed + .lms_tree_identifier + .copy_from_slice(tree_identifier); // TODO/Rework: how do we get rid of those repeated "if let Some"? // Additions for SSTS: add "intermediate node values" from other signing entities to AUX data @@ -292,7 +294,7 @@ impl HssPublicKey { ¶meters[0], &used_leafs_indexes[0], &mut opt_expanded_aux_data, - None, //sst_ext_option, + None, ); // calc. new AUX HMAC diff --git a/src/hss/mod.rs b/src/hss/mod.rs index 702af420..732cde52 100644 --- a/src/hss/mod.rs +++ b/src/hss/mod.rs @@ -10,10 +10,10 @@ use core::{convert::TryFrom, marker::PhantomData}; use tinyvec::ArrayVec; use crate::{ - constants::{MAX_HSS_PUBLIC_KEY_LENGTH, REF_IMPL_MAX_PRIVATE_KEY_SIZE, ILEN}, + constants::{ILEN, MAX_HSS_PUBLIC_KEY_LENGTH, REF_IMPL_MAX_PRIVATE_KEY_SIZE}, hss::{aux::hss_is_aux_data_used, reference_impl_private_key::Seed}, - sst::parameters::SstsParameter, signature::{Error, SignerMut, Verifier}, + sst::parameters::SstsParameter, HashChain, Signature, VerifierSignature, }; @@ -54,7 +54,8 @@ impl SigningKey { let rfc_sk = ReferenceImplPrivateKey::from_binary_representation(self.bytes.as_slice()) .map_err(|_| Error::new())?; - let parsed_sk = HssPrivateKey::::from(&rfc_sk, &mut None, None).map_err(|_| Error::new())?; + let parsed_sk = + HssPrivateKey::::from(&rfc_sk, &mut None, None).map_err(|_| Error::new())?; Ok(parsed_sk.get_lifetime()) } @@ -159,7 +160,7 @@ pub fn hss_sign( private_key: &[u8], private_key_update_function: &mut dyn FnMut(&[u8]) -> Result<(), ()>, aux_data: Option<&mut &mut [u8]>, - tree_identifier: Option<& [u8; ILEN]>, + tree_identifier: Option<&[u8; ILEN]>, ) -> Result { hss_sign_core::( Some(message), @@ -193,6 +194,7 @@ pub fn hss_sign_mut( private_key, private_key_update_function, aux_data, + None, ) } @@ -202,7 +204,7 @@ fn hss_sign_core( private_key: &[u8], private_key_update_function: &mut dyn FnMut(&[u8]) -> Result<(), ()>, aux_data: Option<&mut &mut [u8]>, - tree_identifier: Option<& [u8; ILEN]>, + tree_identifier: Option<&[u8; ILEN]>, ) -> Result { let mut rfc_private_key = ReferenceImplPrivateKey::from_binary_representation(private_key) .map_err(|_| Error::new())?; @@ -224,8 +226,9 @@ fn hss_sign_core( is_aux_data_used, ); - let mut private_key = HssPrivateKey::::from(&rfc_private_key, &mut expanded_aux_data, tree_identifier) - .map_err(|_| Error::new())?; + let mut private_key = + HssPrivateKey::::from(&rfc_private_key, &mut expanded_aux_data, tree_identifier) + .map_err(|_| Error::new())?; let hss_signature = HssSignature::sign( &mut private_key, @@ -341,7 +344,7 @@ mod tests { signing_key_const.as_slice(), &mut update_private_key, None, - None + None, ) .expect("Signing should complete without error."); @@ -407,7 +410,7 @@ mod tests { signing_key_const.as_slice(), &mut update_private_key, None, - None + None, ) .expect("Signing should complete without error."); @@ -560,7 +563,7 @@ mod tests { signing_key_const.as_slice(), &mut update_private_key, None, - None + None, ) .expect("Signing should complete without error."); diff --git a/src/hss/reference_impl_private_key.rs b/src/hss/reference_impl_private_key.rs index e45df5a7..6a9c4fc9 100644 --- a/src/hss/reference_impl_private_key.rs +++ b/src/hss/reference_impl_private_key.rs @@ -124,7 +124,7 @@ impl ReferenceImplPrivateKey { arr[0] = used_leafs_index; let private_key: ReferenceImplPrivateKey = ReferenceImplPrivateKey { - compressed_used_leafs_indexes: CompressedUsedLeafsIndexes::from(&arr, &hss_params), + compressed_used_leafs_indexes: CompressedUsedLeafsIndexes::from(&arr, hss_params), compressed_parameter: CompressedParameterSet::from(parameters.get_hss_parameters())?, sst_ext, seed: seed.clone(), diff --git a/src/lib.rs b/src/lib.rs index f80fbef8..7fc97c43 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -121,20 +121,20 @@ pub use crate::hss::{SigningKey, VerifyingKey}; // TODO/Review: API for distributed state management (SST, SingleSubTree) // should not contain anything else, while crate's modules get to use more of "sst" -pub use crate::constants::MAX_SSTS_SIGNING_ENTITIES; pub use crate::constants::ILEN; +pub use crate::constants::MAX_SSTS_SIGNING_ENTITIES; -pub use crate::sst::parameters::SstsParameter; -pub use crate::sst::prepare_sst_keygen; pub use crate::sst::finalize_sst_keygen; pub use crate::sst::get_num_signing_entities; +pub use crate::sst::parameters::SstsParameter; +pub use crate::sst::prepare_sst_keygen; use core::convert::TryFrom; use signature::Error; use tinyvec::ArrayVec; -use constants::MAX_HSS_SIGNATURE_LENGTH; pub use crate::constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS; +use constants::MAX_HSS_SIGNATURE_LENGTH; /** * Implementation of [`signature::Signature`]. diff --git a/src/lms/definitions.rs b/src/lms/definitions.rs index 3af9b79d..2c882309 100644 --- a/src/lms/definitions.rs +++ b/src/lms/definitions.rs @@ -35,7 +35,7 @@ impl LmsPrivateKey { used_leafs_index: u32, lmots_parameter: LmotsParameter, lms_parameter: LmsParameter, - sst_ext: Option + sst_ext: Option, ) -> Self { LmsPrivateKey { seed, @@ -90,7 +90,7 @@ impl LmsPublicKey { private_key: &LmsPrivateKey, aux_data: &mut Option, ) -> Self { - let public_key = get_tree_element(1 as usize, private_key, aux_data); + let public_key = get_tree_element(1_usize, private_key, aux_data); Self { key: public_key, diff --git a/src/lms/mod.rs b/src/lms/mod.rs index 3544c290..e41e3336 100644 --- a/src/lms/mod.rs +++ b/src/lms/mod.rs @@ -22,7 +22,7 @@ pub fn generate_key_pair( hss_param: &HssParameter, used_leafs_index: &u32, aux_data: &mut Option, - sst_ext: Option, + sst_ext: Option, // TODO/Review: all calls are with "None"...why is that? ) -> LmsKeyPair { let lmots_parameter = hss_param.get_lmots_parameter(); let lms_parameter = hss_param.get_lms_parameter(); diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index 90fee462..15085c08 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -1,6 +1,6 @@ use crate::signature::Error; use crate::{ - constants::{MAX_HASH_SIZE, MAX_SSTS_SIGNING_ENTITIES, ILEN}, + constants::{ILEN, MAX_HASH_SIZE, MAX_SSTS_SIGNING_ENTITIES}, hasher::HashChain, hss::{ aux::{hss_finalize_aux_data, hss_is_aux_data_used}, @@ -56,14 +56,17 @@ pub fn prepare_sst_keygen( sst_param.get_hss_parameters()[0] .get_lms_parameter() .get_tree_height(), - sst_param.get_top_div_height()); + sst_param.get_top_div_height(), + ); let mut seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); if tree_identifier.iter().all(|&byte| byte == 0) { tree_identifier.clone_from_slice(&seed_and_lms_tree_ident.lms_tree_identifier); } else { - seed_and_lms_tree_ident.lms_tree_identifier.clone_from_slice(tree_identifier); + seed_and_lms_tree_ident + .lms_tree_identifier + .clone_from_slice(tree_identifier); } let sst_ext = SstExtension { diff --git a/tests/reference_implementation.rs b/tests/reference_implementation.rs index 76e2d32a..62310ad7 100644 --- a/tests/reference_implementation.rs +++ b/tests/reference_implementation.rs @@ -191,6 +191,7 @@ fn own_signing( &private_key_before, &mut update_private_key, Some(aux_slice), + None, ) .expect("Signing should succed."); save_file( From 42f1ea3810b4d295edc3a798ed5af4b81e50a7ef Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Fri, 31 May 2024 17:02:39 +0200 Subject: [PATCH 42/43] sst: rename variable; add comments - rename "top_div_height" -> "l0_top_div" - comments to indicate TODOs, review, questions... --- examples/sst_demo.rs | 8 ++++---- src/constants.rs | 8 ++++---- src/hss/aux.rs | 20 ++++++++++---------- src/hss/definitions.rs | 20 ++++++++++---------- src/hss/reference_impl_private_key.rs | 12 +++++++----- src/lms/definitions.rs | 5 +++-- src/lms/helper.rs | 1 + src/sst/gen_key.rs | 10 +++++----- src/sst/mod.rs | 1 + src/sst/parameters.rs | 23 +++++++++++++---------- 10 files changed, 58 insertions(+), 50 deletions(-) diff --git a/examples/sst_demo.rs b/examples/sst_demo.rs index 4ba4e7b5..6b588e0e 100644 --- a/examples/sst_demo.rs +++ b/examples/sst_demo.rs @@ -551,15 +551,15 @@ fn parse_genkey1_parameter(hss_params: &str, ssts_params: &str, auxsize: &str) - .parse() .expect("Total number of signing instances invalid"); - let top_div_height = (total_num_si as f32).log2(); - if top_div_height.fract() != 0.0 { + let l0_top_div = (total_num_si as f32).log2(); + if l0_top_div.fract() != 0.0 { panic!("Provided number of signing instances is not a power of 2"); } - let top_div_height = top_div_height as u8; + let l0_top_div = l0_top_div as u8; // @TODO how do I know whether this "vec_hss_params" is a move, and if not, how to achieve (avoid implicit "Copy")? // ArrayVec implements trait "Clone", but I'm not sure about "Copy" (implicit) - let param = SstsParameter::new(vec_hss_params, top_div_height, si_idx); + let param = SstsParameter::new(vec_hss_params, l0_top_div, si_idx); // this here shouldn't be possible in case of "move", because then we don't have ownership anymore: //let vec_hss_param_test: HssParameter = HssParameter::new(LmotsAlgorithm::LmotsW1, LmsAlgorithm::LmsH5); //vec_hss_params.push(vec_hss_param_test); diff --git a/src/constants.rs b/src/constants.rs index edd8fbb1..7ef96525 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -47,10 +47,10 @@ pub const HSS_COMPRESSED_USED_LEAFS_SIZE: usize = size_of::(); pub const REF_IMPL_MAX_ALLOWED_HSS_LEVELS: usize = 8; pub const REF_IMPL_SSTS_EXT_SIGNING_ENTITY_IDX_SIZE: usize = size_of::(); -pub const REF_IMPL_SSTS_EXT_TOP_DIV_HEIGHT_SIZE: usize = size_of::(); +pub const REF_IMPL_SSTS_EXT_L0_TOP_DIV_SIZE: usize = size_of::(); pub const REF_IMPL_SSTS_EXT_SIZE: usize = - REF_IMPL_SSTS_EXT_SIGNING_ENTITY_IDX_SIZE + REF_IMPL_SSTS_EXT_TOP_DIV_HEIGHT_SIZE; + REF_IMPL_SSTS_EXT_SIGNING_ENTITY_IDX_SIZE + REF_IMPL_SSTS_EXT_L0_TOP_DIV_SIZE; pub const REF_IMPL_MAX_PRIVATE_KEY_SIZE: usize = REF_IMPL_SSTS_EXT_SIZE + HSS_COMPRESSED_USED_LEAFS_SIZE @@ -78,8 +78,8 @@ pub const MAX_HSS_SIGNED_PUBLIC_KEY_LENGTH: usize = hss_signed_public_key_length(MAX_HASH_SIZE, MAX_NUM_WINTERNITZ_CHAINS, MAX_TREE_HEIGHT); pub const MAX_HSS_SIGNATURE_LENGTH: usize = get_hss_signature_length(); -pub const MAX_SSTS_TOP_DIV_HEIGHT: u32 = 8; // top division height for Single-Subtree-scheme -pub const MAX_SSTS_SIGNING_ENTITIES: usize = 2usize.pow(MAX_SSTS_TOP_DIV_HEIGHT); +pub const MAX_SSTS_L0_TOP_DIV: u32 = 8; // top division height for Single-Subtree-scheme +pub const MAX_SSTS_SIGNING_ENTITIES: usize = 2usize.pow(MAX_SSTS_L0_TOP_DIV); /// Calculated using the formula from RFC 8554 Appendix B /// https://datatracker.ietf.org/doc/html/rfc8554#appendix-B diff --git a/src/hss/aux.rs b/src/hss/aux.rs index 20ef04f1..542fe10e 100644 --- a/src/hss/aux.rs +++ b/src/hss/aux.rs @@ -41,7 +41,7 @@ pub fn hss_optimal_aux_level( mut max_length: usize, lms_parameter: LmsParameter, actual_len: Option<&mut usize>, - top_div_height: Option, + l0_top_div: Option, ) -> AuxLevel { let mut aux_level = AuxLevel::default(); @@ -53,23 +53,23 @@ pub fn hss_optimal_aux_level( // if SST is used, leave space for signing entity node values depending on their level! let mut size_for_signing_entity_nodes: usize = 0; - if let Some(top_div_height) = top_div_height { - size_for_signing_entity_nodes = 2usize.pow(top_div_height as u32) * size_hash; + if let Some(l0_top_div) = l0_top_div { + size_for_signing_entity_nodes = 2usize.pow(l0_top_div as u32) * size_hash; // don't populate levels above the "intermediate node" values in first keygen step (those would be wrong) // TODO/Rework: maybe populate the levels above intermed. node values in the second keygen step // -> given the max. of 256 signing entities, that should result in a minor performance improvement - min_top_level = top_div_height + 1; + min_top_level = l0_top_div + 1; // add level to level bit, later abort if max_length too small - aux_level |= 0x80000000 | (1 << top_div_height); + aux_level |= 0x80000000 | (1 << l0_top_div); } let min_length = AUX_DATA_HASHES + size_hash + size_for_signing_entity_nodes; if max_length < min_length { - if let Some(top_div_height) = top_div_height { - panic!("AUX data size = {} too small to store intermediate node values for dist. state mgmt with top_div_height {}.", - orig_max_length, top_div_height); + if let Some(l0_top_div) = l0_top_div { + panic!("AUX data size = {} too small to store intermediate node values for dist. state mgmt with l0_top_div {}.", + orig_max_length, l0_top_div); } else { if let Some(actual_len) = actual_len { *actual_len = 1; // ?? @@ -161,11 +161,11 @@ pub fn hss_expand_aux_data<'a, H: HashChain>( pub fn hss_get_aux_data_len( max_length: usize, lms_parameter: LmsParameter, - top_div_height: Option, + l0_top_div: Option, ) -> usize { let mut len = 0; - if hss_optimal_aux_level(max_length, lms_parameter, Some(&mut len), top_div_height) == 0 { + if hss_optimal_aux_level(max_length, lms_parameter, Some(&mut len), l0_top_div) == 0 { return 1; } diff --git a/src/hss/definitions.rs b/src/hss/definitions.rs index e622e438..f6ca11fd 100644 --- a/src/hss/definitions.rs +++ b/src/hss/definitions.rs @@ -62,7 +62,7 @@ impl HssPrivateKey { let mut sst_ext_option = None; let sst_ext = SstExtension { signing_entity_idx: private_key.sst_ext.signing_entity_idx, - top_div_height: private_key.sst_ext.top_div_height, + l0_top_div: private_key.sst_ext.l0_top_div, }; if private_key.sst_ext.signing_entity_idx != 0 { sst_ext_option = Some(sst_ext); @@ -121,23 +121,23 @@ impl HssPrivateKey { let aux_data = aux_data?; if is_aux_data_used { + // has been created, shrinked, populated and provided with HMAC before return hss_expand_aux_data::(Some(aux_data), Some(private_key.seed.as_slice())); } - let top_div_height = private_key.sst_ext.top_div_height; - let opt_top_div_height = if 0 == top_div_height { + let l0_top_div = private_key.sst_ext.l0_top_div; + let opt_l0_top_div = if 0 == l0_top_div { None } else { - Some(top_div_height) + Some(l0_top_div) }; // Shrink input slice - let aux_len = hss_get_aux_data_len(aux_data.len(), *top_lms_parameter, opt_top_div_height); + let aux_len = hss_get_aux_data_len(aux_data.len(), *top_lms_parameter, opt_l0_top_div); let moved = core::mem::take(aux_data); *aux_data = &mut moved[..aux_len]; - let aux_level = - hss_optimal_aux_level(aux_len, *top_lms_parameter, None, opt_top_div_height); + let aux_level = hss_optimal_aux_level(aux_len, *top_lms_parameter, None, opt_l0_top_div); hss_store_aux_marker(aux_data, aux_level); hss_expand_aux_data::(Some(aux_data), None) @@ -237,7 +237,7 @@ impl HssPublicKey { intermed_nodes: &ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_SSTS_SIGNING_ENTITIES]>, tree_identifier: &[u8; ILEN], ) -> Result { - if private_key.sst_ext.signing_entity_idx == 0 || private_key.sst_ext.top_div_height == 0 { + if private_key.sst_ext.signing_entity_idx == 0 || private_key.sst_ext.l0_top_div == 0 { return Err(()); }; @@ -272,13 +272,13 @@ impl HssPublicKey { // TODO/Rework: how do we get rid of those repeated "if let Some"? // Additions for SSTS: add "intermediate node values" from other signing entities to AUX data if let Some(expanded_aux_data) = opt_expanded_aux_data.as_mut() { - let num_signing_entities = 2usize.pow(private_key.sst_ext.top_div_height as u32); + let num_signing_entities = 2usize.pow(private_key.sst_ext.l0_top_div as u32); for si in 1..=num_signing_entities as u8 { // node index of SI intermed node in whole tree: let idx: usize = get_subtree_node_idx( si, top_lms_parameter.get_tree_height(), - private_key.sst_ext.top_div_height, + private_key.sst_ext.l0_top_div, ) as usize; hss_save_aux_data::( expanded_aux_data, diff --git a/src/hss/reference_impl_private_key.rs b/src/hss/reference_impl_private_key.rs index 6a9c4fc9..573c7270 100644 --- a/src/hss/reference_impl_private_key.rs +++ b/src/hss/reference_impl_private_key.rs @@ -105,18 +105,18 @@ impl ReferenceImplPrivateKey { pub fn generate(parameters: &SstsParameter, seed: &Seed) -> Result { let sst_ext = SstExtension { signing_entity_idx: parameters.get_signing_entity_idx(), - top_div_height: parameters.get_top_div_height(), + l0_top_div: parameters.get_l0_top_div(), }; let hss_params = parameters.get_hss_parameters(); let top_lms_parameter = hss_params[0].get_lms_parameter(); let mut used_leafs_index: u32 = 0; - if parameters.get_top_div_height() != 0 { + if parameters.get_l0_top_div() != 0 { used_leafs_index = helper::get_sst_first_leaf_idx( sst_ext.signing_entity_idx, top_lms_parameter.get_tree_height(), - sst_ext.top_div_height, + sst_ext.l0_top_div, ); } @@ -137,7 +137,7 @@ impl ReferenceImplPrivateKey { let mut result = ArrayVec::new(); result.extend_from_slice(&self.sst_ext.signing_entity_idx.to_be_bytes()); - result.extend_from_slice(&self.sst_ext.top_div_height.to_be_bytes()); + result.extend_from_slice(&self.sst_ext.l0_top_div.to_be_bytes()); result.extend_from_slice(&self.compressed_used_leafs_indexes.count.to_be_bytes()); result.extend_from_slice(&self.compressed_parameter.0); result.extend_from_slice(self.seed.as_slice()); @@ -147,6 +147,7 @@ impl ReferenceImplPrivateKey { pub fn from_binary_representation(data: &[u8]) -> Result { if data.len() != REF_IMPL_MAX_PRIVATE_KEY_SIZE - MAX_SEED_LEN + H::OUTPUT_SIZE as usize { + // TODO/Review: why don't we just use REF_IMPL_MAX_PRIVATE_KEY_SIZE? (as in "SigningKey")? return Err(()); } @@ -200,8 +201,9 @@ impl ReferenceImplPrivateKey { hash_preimage[TOPSEED_WHICH] = 0x02; hasher.update(&hash_preimage); - // TODO/Rework: maybe provide the LmsTreeIdentifier as an Option-argument for this function // The root LmsTreeIdentifier needs to be the same for all signing entities for signing and verification + // TODO/Rework: maybe provide the LmsTreeIdentifier as an Option-argument for this function + // instead of replacing it after calling the function let mut lms_tree_identifier = LmsTreeIdentifier::default(); lms_tree_identifier.copy_from_slice(&hasher.finalize_reset()[..ILEN]); diff --git a/src/lms/definitions.rs b/src/lms/definitions.rs index 2c882309..de71d995 100644 --- a/src/lms/definitions.rs +++ b/src/lms/definitions.rs @@ -35,7 +35,7 @@ impl LmsPrivateKey { used_leafs_index: u32, lmots_parameter: LmotsParameter, lms_parameter: LmsParameter, - sst_ext: Option, + sst_ext: Option, // TODO/Review: probably better as non-option?! ) -> Self { LmsPrivateKey { seed, @@ -54,7 +54,7 @@ impl LmsPrivateKey { 1 + get_sst_last_leaf_idx( my_sst_ext.signing_entity_idx, self.lms_parameter.get_tree_height(), - my_sst_ext.top_div_height, + my_sst_ext.l0_top_div, ) } else { self.lms_parameter.number_of_lm_ots_keys() as u32 @@ -71,6 +71,7 @@ impl LmsPrivateKey { self.seed.clone(), self.lmots_parameter, ); + self.used_leafs_index += 1; Ok(key) diff --git a/src/lms/helper.rs b/src/lms/helper.rs index 2a99cce0..a483d012 100644 --- a/src/lms/helper.rs +++ b/src/lms/helper.rs @@ -12,6 +12,7 @@ pub fn get_tree_element( private_key: &LmsPrivateKey, aux_data: &mut Option, ) -> ArrayVec<[u8; MAX_HASH_SIZE]> { + // TODO/Rework: use "Node" struct as return value? // Check if we already have the value cached if let Some(aux_data) = aux_data { if let Some(result) = hss_extract_aux_data::(aux_data, index) { diff --git a/src/sst/gen_key.rs b/src/sst/gen_key.rs index 15085c08..7f8d6e32 100644 --- a/src/sst/gen_key.rs +++ b/src/sst/gen_key.rs @@ -24,7 +24,7 @@ pub fn prepare_sst_keygen( aux_data: Option<&mut &mut [u8]>, tree_identifier: &mut [u8; ILEN], ) -> Result<(SigningKey, ArrayVec<[u8; MAX_HASH_SIZE]>), Error> { - if sst_param.get_signing_entity_idx() == 0 || sst_param.get_top_div_height() == 0 { + if sst_param.get_signing_entity_idx() == 0 || sst_param.get_l0_top_div() == 0 { return Err(Error::new()); } @@ -56,7 +56,7 @@ pub fn prepare_sst_keygen( sst_param.get_hss_parameters()[0] .get_lms_parameter() .get_tree_height(), - sst_param.get_top_div_height(), + sst_param.get_l0_top_div(), ); let mut seed_and_lms_tree_ident = rfc_private_key.generate_root_seed_and_lms_tree_identifier(); @@ -71,7 +71,7 @@ pub fn prepare_sst_keygen( let sst_ext = SstExtension { signing_entity_idx: rfc_private_key.sst_ext.signing_entity_idx, - top_div_height: rfc_private_key.sst_ext.top_div_height, + l0_top_div: rfc_private_key.sst_ext.l0_top_div, }; let sst_ext_option = Some(sst_ext); @@ -81,7 +81,7 @@ pub fn prepare_sst_keygen( sst_param.get_hss_parameters()[0] .get_lms_parameter() .get_tree_height(), - sst_param.get_top_div_height(), + sst_param.get_l0_top_div(), ); let lms_private_key = LmsPrivateKey::::new( @@ -109,7 +109,7 @@ pub fn get_num_signing_entities(private_key: &[u8]) -> Result::from_binary_representation(private_key) .map_err(|_| Error::new())?; - let num_signing_entities = 2u32.pow(rfc_private_key.sst_ext.top_div_height as u32); + let num_signing_entities = 2u32.pow(rfc_private_key.sst_ext.l0_top_div as u32); Ok(num_signing_entities) } diff --git a/src/sst/mod.rs b/src/sst/mod.rs index 7f5a3da2..1317ef83 100644 --- a/src/sst/mod.rs +++ b/src/sst/mod.rs @@ -1,5 +1,6 @@ //! Module sst +// TODO/Review: not sure whether that's an elegant solution mod gen_key; pub use gen_key::*; diff --git a/src/sst/parameters.rs b/src/sst/parameters.rs index 1dc7cc75..67e01be9 100644 --- a/src/sst/parameters.rs +++ b/src/sst/parameters.rs @@ -6,9 +6,9 @@ use zeroize::{Zeroize, ZeroizeOnDrop}; #[derive(Clone, PartialEq, Eq)] pub struct SstsParameter { hss_parameters: ArrayVec<[HssParameter; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]>, - // TODO use SstExtension here? - top_div_height: u8, - signing_entity_idx: u8, // starting with 1 + // TODO/Rework: use SstExtension? + l0_top_div: u8, + signing_entity_idx: u8, } impl Copy for SstsParameter {} @@ -16,12 +16,12 @@ impl Copy for SstsParameter {} impl SstsParameter { pub fn new( hss_params: ArrayVec<[HssParameter; constants::REF_IMPL_MAX_ALLOWED_HSS_LEVELS]>, - top_div_height: u8, + l0_top_div: u8, signing_entity_idx: u8, ) -> Self { SstsParameter { hss_parameters: hss_params, - top_div_height, // e.g. LMS height of 5 and top_div_height 3: division top/bottom is 3/2 which would result in 2^3 = 8 signing entities + l0_top_div, signing_entity_idx, } } @@ -32,8 +32,8 @@ impl SstsParameter { &self.hss_parameters } - pub fn get_top_div_height(&self) -> u8 { - self.top_div_height + pub fn get_l0_top_div(&self) -> u8 { + self.l0_top_div } pub fn get_signing_entity_idx(&self) -> u8 { @@ -43,11 +43,14 @@ impl SstsParameter { #[derive(Debug, Default, Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)] pub struct SstExtension { - pub signing_entity_idx: u8, - pub top_div_height: u8, + pub signing_entity_idx: u8, // from 1 to (2^l0_top_div) + pub l0_top_div: u8, // e.g. L-0 LMS height of 5 and l0_top_div = 3: division top/bottom is 3/2 -> 2^3 = 8 signing entities } impl SstExtension { + // TODO/Review: unlike in all other locations, clippy reports + // "this returns a `Result<_, ()>`" and "use a custom `Error` type instead" + // see "Result" in "hss/reference_impl_private_key.rs" -> CompressedParameterSet pub fn from_slice(data: &[u8]) -> Result { if data.len() != constants::REF_IMPL_SSTS_EXT_SIZE { return Err(()); @@ -55,7 +58,7 @@ impl SstExtension { Ok(SstExtension { signing_entity_idx: data[0], - top_div_height: data[1], + l0_top_div: data[1], }) } } From dcfe4f775a35f454b8366d567d9a59411de04dd9 Mon Sep 17 00:00:00 2001 From: Stephan Schwarzmann Date: Fri, 7 Jun 2024 14:41:20 +0200 Subject: [PATCH 43/43] Add config files cross-build environment All files under " res/nrf52-arm/". See res/nrf52-arm/README.md for instructions. --- res/nrf52-arm/Cargo.toml | 69 + res/nrf52-arm/README.md | 49 + res/nrf52-arm/config.toml | 24 + res/nrf52-arm/launch.json | 50 + res/nrf52-arm/nrf52840.svd | 54981 +++++++++++++++++++++++++++++++++ res/nrf52-arm/nrf52840_2.svd | 51572 +++++++++++++++++++++++++++++++ res/nrf52-arm/tasks.json | 53 + 7 files changed, 106798 insertions(+) create mode 100644 res/nrf52-arm/Cargo.toml create mode 100644 res/nrf52-arm/README.md create mode 100644 res/nrf52-arm/config.toml create mode 100644 res/nrf52-arm/launch.json create mode 100644 res/nrf52-arm/nrf52840.svd create mode 100644 res/nrf52-arm/nrf52840_2.svd create mode 100644 res/nrf52-arm/tasks.json diff --git a/res/nrf52-arm/Cargo.toml b/res/nrf52-arm/Cargo.toml new file mode 100644 index 00000000..eb64552c --- /dev/null +++ b/res/nrf52-arm/Cargo.toml @@ -0,0 +1,69 @@ +[package] +name = "hbs-lms" +version = "0.1.1" +rust-version = "1.57" +authors = ["Fraunhofer AISEC"] +description = """ +Pure Rust implementation of the Leighton Micali Signature scheme with support for key generation, signature generation and verification. +""" +edition = "2018" +repository = "https://github.com/Fraunhofer-AISEC/hbs-lms-rust" +license = "Apache-2.0" +readme = "README.md" +keywords = ["crypto", "post-quantum", "signature", "lms"] +categories = ["cryptography", "no-std"] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +tinyvec = { version = "1.5.1", features = ["rustc_1_55"] } +subtle = { version = "2.4.1", default-features = false } +zeroize = { version = "1.5.1", default-features = false, features = ["zeroize_derive"] } +signature = { version = "1.4.0", default-features = false } +digest = { version = "0.10.2", default-features = false } +sha2 = { version = "0.10.0", default-features = false } +sha3 = { version = "0.10.0", default-features = false } +crossbeam = {version = "0.8", optional = true } +rand = { version = "0.8.3", optional = true } +# from Ferrous Systems exercises to support Nordicsemi +cortex-m = {version = "0.7", features = ["critical-section-single-core"]} +cortex-m-rt = "0.7" +dk = { path = "./rust-exercises/nrf52-code/boards/dk", features = ["radio"] } +heapless = "0.8" +panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "0.3.5" +defmt-rtt = "0.4" + + + +[dev-dependencies] +#clap = "3.0.0" +#tempfile = "3.2.0" +#hex = "0.4.3" +#rand = "0.8.3" +rand = { version = "0.8.3", default-features = false } + +[features] +default = [] +std = [] +fast_verify = ["std", "rand", "crossbeam"] +verbose = [] + +# from Ferrous Systems exercises to support Nordicsemi +[profile.dev] +codegen-units = 1 +debug = 2 +debug-assertions = true # ! +incremental = false +lto = "fat" +opt-level = 0 # 0 -> no optim.; "z" -> optim. for size +overflow-checks = false +# from Ferrous Systems exercises to support Nordicsemi +[profile.release] +codegen-units = 1 +debug = 2 +debug-assertions = false +incremental = false +lto = "fat" +opt-level = 3 +overflow-checks = false diff --git a/res/nrf52-arm/README.md b/res/nrf52-arm/README.md new file mode 100644 index 00000000..1b22fc40 --- /dev/null +++ b/res/nrf52-arm/README.md @@ -0,0 +1,49 @@ +Cross build for nrf52840 / ARM +============================== + +This folder contains some configuration files for cross building. + +# Problem + +I could not figure out how to combine the different configurations for x86 and ARM builds in one `.cargo/Cargo.toml` and one `.cargo/config.toml`. +In particular, the `dev-dependencies` for x86 tests and benches seemed to cause issues, becasue they use `std` which can't be used for the cross build. +So in order to build for ARM, those files have to be copied from `./res/nrf52-arm/` to `.cargo/config.toml` and `./Cargo.toml`. + +# VS code + +The files `res/nrf52-arm/launch.json` and `res/nrf52-arm/tasks.json` can be moved to a folder `.vscode` (in the root folder of the project) +to support debugging within VS code. +`launch.json` refers to a svd file in `./res/` (so the svd file has to be moved there, or `launch.json` to be adapted). + + +# Build, flash and run + +- a symlink `rust-exercises` in the root folder of the project needs to link to a checkout of + `https://github.com/ferrous-systems/rust-exercises.git` (git tag v1.10.0) +- the relevant cargo toolchain needs to be installed + `rustup target add thumbv7em-none-eabihf` + +$ cargo run --target=thumbv7em-none-eabihf --example lms_demo_nrf52 -- --allow-erase-all + + +# Debugging + +Here the relevant software may not be completely described... + +- `gdb-multiarch` is needed +- `probe-rs` was installed via `cargo install probe-rs --locked --features cli` + +Start the tools: + +``` + probe-rs gdb --chip nRF52840_xxAA + gdb-multiarch +``` + +In `gdb`, connect, load executable and reset: + +``` + target remote :1337 + file target/thumbv7em-none-eabihf/debug/examples/lms_demo_nrf52 + mon reset halt +``` diff --git a/res/nrf52-arm/config.toml b/res/nrf52-arm/config.toml new file mode 100644 index 00000000..90305b3d --- /dev/null +++ b/res/nrf52-arm/config.toml @@ -0,0 +1,24 @@ +[env] +HBS_LMS_MAX_HASH_OPTIMIZATIONS = "10000" +HBS_LMS_THREADS = "1" +HBS_LMS_MAX_ALLOWED_HSS_LEVELS = "8" +HBS_LMS_TREE_HEIGHTS = "25, 25, 25, 25, 25, 25, 25, 25" +HBS_LMS_WINTERNITZ_PARAMETERS = "1, 1, 1, 1, 1, 1, 1, 1" +RUST_MIN_STACK = "8000000" + +[profile.release] +overflow-checks = true + +[target.thumbv7em-none-eabihf] +# set custom cargo runner to flash & run on embedded target when we call `cargo run` +# for more information, check out https://github.com/probe-rs +runner = "probe-rs run --chip nRF52840_xxAA" +rustflags = [ + "-C", "link-arg=-Tlink.x", # use the cortex-m-rt linker script + "-C", "linker=flip-link", # adds stack overflow protection + "-C", "link-arg=-Tdefmt.x", # defmt support +] + +[build] +# cross-compile to this target +target = "thumbv7em-none-eabihf" # = ARM Cortex-M4 with FPU diff --git a/res/nrf52-arm/launch.json b/res/nrf52-arm/launch.json new file mode 100644 index 00000000..7da9323f --- /dev/null +++ b/res/nrf52-arm/launch.json @@ -0,0 +1,50 @@ +{ + "version": "0.2.0", + "configurations": [ + { + // see https://probe.rs/docs/tools/debugger/ for more info + "type": "probe-rs-debug", + "request": "launch", + "name": "probe_rs", + "cwd": "${workspaceFolder}", + "preLaunchTask": "cargo build", + "runtimeExecutable": "/home/sn/.cargo/bin/probe-rs", //!MODIFY + "runtimeArgs": ["dap-server"], + "chip": "nRF52840_xxAA", //!MODIFY + "flashingConfig": { + "flashingEnabled": true, + "haltAfterReset": false, + "formatOptions": { + "format": "elf" //Valid values are: 'bin', 'hex', 'elf'(default), 'idf' + } + }, + "coreConfigs": [ + { + "coreIndex": 0, + "programBinary": "${workspaceFolder}/target/thumbv7em-none-eabihf/debug/examples/lms_demo_nrf52", //!MODIFY + "svdFile": "${workspaceFolder}/res/nrf52840.svd", //!MODIFY , required for register view + "rttEnabled": true, + "rttChannelFormats": [ + { + "channelNumber": 0, + // Format RTT data as String data + "dataFormat": "String", + // Include host-side timestamps for every line of data transferred from the target RTT output + "showTimestamps": true + }, + { + "channelNumber": 1, + // Treat data as raw binary data, and do not format in any way + "dataFormat": "BinaryLE" + } + ] + } + ], + "env": { + //!MODIFY (or remove) + "RUST_LOG": "info" // If you set this variable, check the VSCode console log window for the location of the log file. + }, + "consoleLogLevel": "Console" //Info, Debug + } + ] +} diff --git a/res/nrf52-arm/nrf52840.svd b/res/nrf52-arm/nrf52840.svd new file mode 100644 index 00000000..85ce629a --- /dev/null +++ b/res/nrf52-arm/nrf52840.svd @@ -0,0 +1,54981 @@ + + + + Nordic Semiconductor + Nordic + nrf52840 + nrf52 + 1 + nRF52840 reference description for radio MCU with ARM 32-bit Cortex-M4 Microcontroller + +Copyright (c) 2010 - 2024, Nordic Semiconductor ASA All rights reserved.\n +\n +SPDX-License-Identifier: BSD-3-Clause\n +\n +Redistribution and use in source and binary forms, with or without\n +modification, are permitted provided that the following conditions are met:\n +\n +1. Redistributions of source code must retain the above copyright notice, this\n + list of conditions and the following disclaimer.\n +\n +2. Redistributions in binary form must reproduce the above copyright\n + notice, this list of conditions and the following disclaimer in the\n + documentation and/or other materials provided with the distribution.\n +\n +3. Neither the name of Nordic Semiconductor ASA nor the names of its\n + contributors may be used to endorse or promote products derived from this\n + software without specific prior written permission.\n +\n +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\n +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n +IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE\n +ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE\n +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n +POSSIBILITY OF SUCH DAMAGE.\n + + 8 + 32 + 32 + 0x00000000 + 0xFFFFFFFF + + CM4 + r0p1 + little + 1 + 1 + 3 + 0 + + system_nrf52 + NRF_ + + 2048 + 2048 + 112 + + + + FICR + Factory information configuration registers + 0x10000000 + + 0 + 0x1000 + registers + + FICR + 0x20 + + + CODEPAGESIZE + Code memory page size + 0x010 + read-only + 0xFFFFFFFF + + + CODEPAGESIZE + Code memory page size + 0 + 31 + + + + + CODESIZE + Code memory size + 0x014 + read-only + 0xFFFFFFFF + + + CODESIZE + Code memory size in number of pages + 0 + 31 + + + + + 0x2 + 0x4 + DEVICEID[%s] + Description collection: Device identifier + 0x060 + read-only + 0xFFFFFFFF + + + DEVICEID + 64 bit unique device identifier + 0 + 31 + + + + + 0x4 + 0x4 + ER[%s] + Description collection: Encryption root, word n + 0x080 + read-only + 0xFFFFFFFF + + + ER + Encryption root, word n + 0 + 31 + + + + + 0x4 + 0x4 + IR[%s] + Description collection: Identity Root, word n + 0x090 + read-only + 0xFFFFFFFF + + + IR + Identity Root, word n + 0 + 31 + + + + + DEVICEADDRTYPE + Device address type + 0x0A0 + read-only + 0xFFFFFFFF + + + DEVICEADDRTYPE + Device address type + 0 + 0 + + + Public + Public address + 0 + + + Random + Random address + 1 + + + + + + + 0x2 + 0x4 + DEVICEADDR[%s] + Description collection: Device address n + 0x0A4 + read-only + 0xFFFFFFFF + + + DEVICEADDR + 48 bit device address + 0 + 31 + + + + + INFO + Device info + FICR_INFO + read-only + 0x100 + + PART + Part code + 0x000 + read-only + 0x00052840 + + + PART + Part code + 0 + 31 + + + N52820 + nRF52820 + 0x52820 + + + N52833 + nRF52833 + 0x52833 + + + N52840 + nRF52840 + 0x52840 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + VARIANT + Build code (hardware version and production configuration) + 0x004 + read-only + 0xFFFFFFFF + + + VARIANT + Build code (hardware version and production configuration). Encoded as ASCII. + 0 + 31 + + + AAAA + AAAA + 0x41414141 + + + BAAA + BAAA + 0x42414141 + + + CAAA + CAAA + 0x43414141 + + + AABA + AABA + 0x41414241 + + + AABB + AABB + 0x41414242 + + + AACA + AACA + 0x41414341 + + + AAAB + AAAB + 0x41414142 + + + AAC0 + AAC0 + 0x41414330 + + + AADA + AADA + 0x41414441 + + + AAD0 + AAD0 + 0x41414430 + + + AAD1 + AAD1 + 0x41414431 + + + AAEA + AAEA + 0x41414541 + + + AAF0 + AAF0 + 0x41414630 + + + AAFA + AAFA + 0x41414641 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + PACKAGE + Package option + 0x008 + read-only + 0xFFFFFFFF + + + PACKAGE + Package option + 0 + 31 + + + QI + QIxx - 7x7 73-pin aQFN + 0x2004 + + + QF + QFxx - 6x6 48-pin QFN + 0x2000 + + + CK + CKxx - 3.544 x 3.607 WLCSP + 0x2005 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + RAM + RAM variant + 0x00C + read-only + 0xFFFFFFFF + + + RAM + RAM variant + 0 + 31 + + + K16 + 16 kB RAM + 0x10 + + + K32 + 32 kB RAM + 0x20 + + + K64 + 64 kB RAM + 0x40 + + + K128 + 128 kB RAM + 0x80 + + + K256 + 256 kB RAM + 0x100 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + FLASH + Flash variant + 0x010 + read-only + 0xFFFFFFFF + + + FLASH + Flash variant + 0 + 31 + + + K128 + 128 kB FLASH + 0x80 + + + K256 + 256 kB FLASH + 0x100 + + + K512 + 512 kB FLASH + 0x200 + + + K1024 + 1 MB FLASH + 0x400 + + + K2048 + 2 MB FLASH + 0x800 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + + 0x3 + 0x4 + PRODTEST[%s] + Description collection: Production test signature n + 0x350 + read-only + 0xFFFFFFFF + + + PRODTEST + Production test signature n + 0 + 31 + + + Done + Production tests done + 0xBB42319F + + + NotDone + Production tests not done + 0xFFFFFFFF + + + + + + + TEMP + Registers storing factory TEMP module linearization coefficients + FICR_TEMP + read-only + 0x404 + + A0 + Slope definition A0 + 0x000 + read-only + 0xFFFFFFFF + + + A + A (slope definition) register. + 0 + 11 + + + + + A1 + Slope definition A1 + 0x004 + read-only + 0xFFFFFFFF + + + A + A (slope definition) register. + 0 + 11 + + + + + A2 + Slope definition A2 + 0x008 + read-only + 0xFFFFFFFF + + + A + A (slope definition) register. + 0 + 11 + + + + + A3 + Slope definition A3 + 0x00C + read-only + 0xFFFFFFFF + + + A + A (slope definition) register. + 0 + 11 + + + + + A4 + Slope definition A4 + 0x010 + read-only + 0xFFFFFFFF + + + A + A (slope definition) register. + 0 + 11 + + + + + A5 + Slope definition A5 + 0x014 + read-only + 0xFFFFFFFF + + + A + A (slope definition) register. + 0 + 11 + + + + + B0 + Y-intercept B0 + 0x018 + read-only + 0xFFFFFFFF + + + B + B (y-intercept) + 0 + 13 + + + + + B1 + Y-intercept B1 + 0x01C + read-only + 0xFFFFFFFF + + + B + B (y-intercept) + 0 + 13 + + + + + B2 + Y-intercept B2 + 0x020 + read-only + 0xFFFFFFFF + + + B + B (y-intercept) + 0 + 13 + + + + + B3 + Y-intercept B3 + 0x024 + read-only + 0xFFFFFFFF + + + B + B (y-intercept) + 0 + 13 + + + + + B4 + Y-intercept B4 + 0x028 + read-only + 0xFFFFFFFF + + + B + B (y-intercept) + 0 + 13 + + + + + B5 + Y-intercept B5 + 0x02C + read-only + 0xFFFFFFFF + + + B + B (y-intercept) + 0 + 13 + + + + + T0 + Segment end T0 + 0x030 + read-only + 0xFFFFFFFF + + + T + T (segment end) register + 0 + 7 + + + + + T1 + Segment end T1 + 0x034 + read-only + 0xFFFFFFFF + + + T + T (segment end) register + 0 + 7 + + + + + T2 + Segment end T2 + 0x038 + read-only + 0xFFFFFFFF + + + T + T (segment end) register + 0 + 7 + + + + + T3 + Segment end T3 + 0x03C + read-only + 0xFFFFFFFF + + + T + T (segment end) register + 0 + 7 + + + + + T4 + Segment end T4 + 0x040 + read-only + 0xFFFFFFFF + + + T + T (segment end) register + 0 + 7 + + + + + + NFC + Unspecified + FICR_NFC + read-write + 0x450 + + TAGHEADER0 + Default header for NFC tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST, and NFCID1_LAST. + 0x000 + read-only + 0xFFFFFF5F + + + MFGID + Default Manufacturer ID: Nordic Semiconductor ASA has ICM 0x5F + 0 + 7 + + + UD1 + Unique identifier byte 1 + 8 + 15 + + + UD2 + Unique identifier byte 2 + 16 + 23 + + + UD3 + Unique identifier byte 3 + 24 + 31 + + + + + TAGHEADER1 + Default header for NFC tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST, and NFCID1_LAST. + 0x004 + read-only + 0xFFFFFFFF + + + UD4 + Unique identifier byte 4 + 0 + 7 + + + UD5 + Unique identifier byte 5 + 8 + 15 + + + UD6 + Unique identifier byte 6 + 16 + 23 + + + UD7 + Unique identifier byte 7 + 24 + 31 + + + + + TAGHEADER2 + Default header for NFC tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST, and NFCID1_LAST. + 0x008 + read-only + 0xFFFFFFFF + + + UD8 + Unique identifier byte 8 + 0 + 7 + + + UD9 + Unique identifier byte 9 + 8 + 15 + + + UD10 + Unique identifier byte 10 + 16 + 23 + + + UD11 + Unique identifier byte 11 + 24 + 31 + + + + + TAGHEADER3 + Default header for NFC tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST, and NFCID1_LAST. + 0x00C + read-only + 0xFFFFFFFF + + + UD12 + Unique identifier byte 12 + 0 + 7 + + + UD13 + Unique identifier byte 13 + 8 + 15 + + + UD14 + Unique identifier byte 14 + 16 + 23 + + + UD15 + Unique identifier byte 15 + 24 + 31 + + + + + + TRNG90B + NIST800-90B RNG calibration data + FICR_TRNG90B + read-write + 0xC00 + + BYTES + Amount of bytes for the required entropy bits + 0x000 + read-only + 0xFFFFFFFF + + + BYTES + Amount of bytes for the required entropy bits + 0 + 31 + + + + + RCCUTOFF + Repetition counter cutoff + 0x004 + read-only + 0xFFFFFFFF + + + RCCUTOFF + Repetition counter cutoff + 0 + 31 + + + + + APCUTOFF + Adaptive proportion cutoff + 0x008 + read-only + 0xFFFFFFFF + + + APCUTOFF + Adaptive proportion cutoff + 0 + 31 + + + + + STARTUP + Amount of bytes for the startup tests + 0x00C + read-only + 0xFFFFFFFF + + + STARTUP + Amount of bytes for the startup tests + 0 + 31 + + + + + ROSC1 + Sample count for ring oscillator 1 + 0x010 + read-only + 0xFFFFFFFF + + + ROSC1 + Sample count for ring oscillator 1 + 0 + 31 + + + + + ROSC2 + Sample count for ring oscillator 2 + 0x014 + read-only + 0xFFFFFFFF + + + ROSC2 + Sample count for ring oscillator 2 + 0 + 31 + + + + + ROSC3 + Sample count for ring oscillator 3 + 0x018 + read-only + 0xFFFFFFFF + + + ROSC3 + Sample count for ring oscillator 3 + 0 + 31 + + + + + ROSC4 + Sample count for ring oscillator 4 + 0x01C + read-only + 0xFFFFFFFF + + + ROSC4 + Sample count for ring oscillator 4 + 0 + 31 + + + + + + + + UICR + User information configuration registers + 0x10001000 + + 0 + 0x1000 + registers + + UICR + 0x20 + + + 0xD + 0x4 + NRFFW[%s] + Description collection: Reserved for Nordic firmware design + 0x014 + read-write + 0xFFFFFFFF + + + NRFFW + Reserved for Nordic firmware design + 0 + 31 + + + + + 0xC + 0x4 + NRFHW[%s] + Description collection: Reserved for Nordic hardware design + 0x050 + read-write + 0xFFFFFFFF + + + NRFHW + Reserved for Nordic hardware design + 0 + 31 + + + + + 0x20 + 0x4 + CUSTOMER[%s] + Description collection: Reserved for customer + 0x080 + read-write + 0xFFFFFFFF + + + CUSTOMER + Reserved for customer + 0 + 31 + + + + + 0x2 + 0x4 + PSELRESET[%s] + Description collection: Mapping of the nRESET function (see POWER chapter for details) + 0x200 + read-write + 0xFFFFFFFF + + + PIN + GPIO pin number onto which nRESET is exposed + 0 + 4 + + + PORT + Port number onto which nRESET is exposed + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + APPROTECT + Access port protection + 0x208 + read-write + 0xFFFFFFFF + + + PALL + Enable or disable access port protection. + 0 + 7 + + + Disabled + Hardware disable of access port protection for devices where access port protection is controlled by hardware + 0xFF + + + HwDisabled + Hardware disable of access port protection for devices where access port protection is controlled by hardware and software + 0x5A + + + Enabled + Enable + 0x00 + + + + + + + NFCPINS + Setting of pins dedicated to NFC functionality: NFC antenna or GPIO + 0x20C + read-write + 0xFFFFFFFF + + + PROTECT + Setting of pins dedicated to NFC functionality + 0 + 0 + + + Disabled + Operation as GPIO pins. Same protection as normal GPIO pins. + 0 + + + NFC + Operation as NFC antenna pins. Configures the protection for NFC operation. + 1 + + + + + + + DEBUGCTRL + Processor debug control + 0x210 + read-write + 0xFFFFFFFF + + + CPUNIDEN + Configure CPU non-intrusive debug features + 0 + 7 + + + Enabled + Enable CPU ITM and ETM functionality (default behavior) + 0xFF + + + Disabled + Disable CPU ITM and ETM functionality + 0x00 + + + + + CPUFPBEN + Configure CPU flash patch and breakpoint (FPB) unit behavior + 8 + 15 + + + Enabled + Enable CPU FPB unit (default behavior) + 0xFF + + + Disabled + Disable CPU FPB unit. Writes into the FPB registers will be ignored. + 0x00 + + + + + + + REGOUT0 + Output voltage from REG0 regulator stage. The maximum output voltage from this stage is given as VDDH - V_VDDH-VDD. + 0x304 + read-write + 0xFFFFFFFF + + + VOUT + Output voltage from REG0 regulator stage. + 0 + 2 + + + 1V8 + 1.8 V + 0 + + + 2V1 + 2.1 V + 1 + + + 2V4 + 2.4 V + 2 + + + 2V7 + 2.7 V + 3 + + + 3V0 + 3.0 V + 4 + + + 3V3 + 3.3 V + 5 + + + DEFAULT + Default voltage: 1.8 V + 7 + + + + + + + + + APPROTECT + Access Port Protection + 0x40000000 + + 0 + 0x1000 + registers + + APPROTECT + 0x20 + + + FORCEPROTECT + Software force enable APPROTECT mechanism until next reset. + 0x550 + read-writeonce + 0xFFFFFFFF + + + FORCEPROTECT + Write 0x0 to force enable APPROTECT mechanism + 0 + 7 + + write + + Force + Software force enable APPROTECT mechanism + 0x0 + + + + + + + DISABLE + Software disable APPROTECT mechanism + 0x558 + read-write + 0x00000000 + + + DISABLE + Software disable APPROTECT mechanism + 0 + 7 + + + SwDisable + Software disable APPROTECT mechanism + 0x5A + + + + + + + + + CLOCK + Clock control + 0x40000000 + APPROTECT + + 0 + 0x1000 + registers + + + POWER_CLOCK + 0 + + CLOCK + 0x20 + + + TASKS_HFCLKSTART + Start HFXO crystal oscillator + 0x000 + write-only + + + TASKS_HFCLKSTART + Start HFXO crystal oscillator + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_HFCLKSTOP + Stop HFXO crystal oscillator + 0x004 + write-only + + + TASKS_HFCLKSTOP + Stop HFXO crystal oscillator + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_LFCLKSTART + Start LFCLK + 0x008 + write-only + + + TASKS_LFCLKSTART + Start LFCLK + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_LFCLKSTOP + Stop LFCLK + 0x00C + write-only + + + TASKS_LFCLKSTOP + Stop LFCLK + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_CAL + Start calibration of LFRC + 0x010 + write-only + + + TASKS_CAL + Start calibration of LFRC + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_CTSTART + Start calibration timer + 0x014 + write-only + + + TASKS_CTSTART + Start calibration timer + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_CTSTOP + Stop calibration timer + 0x018 + write-only + + + TASKS_CTSTOP + Stop calibration timer + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_HFCLKSTARTED + HFXO crystal oscillator started + 0x100 + read-write + + + EVENTS_HFCLKSTARTED + HFXO crystal oscillator started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_LFCLKSTARTED + LFCLK started + 0x104 + read-write + + + EVENTS_LFCLKSTARTED + LFCLK started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_DONE + Calibration of LFRC completed + 0x10C + read-write + + + EVENTS_DONE + Calibration of LFRC completed + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_CTTO + Calibration timer timeout + 0x110 + read-write + + + EVENTS_CTTO + Calibration timer timeout + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_CTSTARTED + Calibration timer has been started and is ready to process new tasks + 0x128 + read-write + + + EVENTS_CTSTARTED + Calibration timer has been started and is ready to process new tasks + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_CTSTOPPED + Calibration timer has been stopped and is ready to process new tasks + 0x12C + read-write + + + EVENTS_CTSTOPPED + Calibration timer has been stopped and is ready to process new tasks + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + HFCLKSTARTED + Write '1' to enable interrupt for event HFCLKSTARTED + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + LFCLKSTARTED + Write '1' to enable interrupt for event LFCLKSTARTED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DONE + Write '1' to enable interrupt for event DONE + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CTTO + Write '1' to enable interrupt for event CTTO + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CTSTARTED + Write '1' to enable interrupt for event CTSTARTED + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CTSTOPPED + Write '1' to enable interrupt for event CTSTOPPED + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + HFCLKSTARTED + Write '1' to disable interrupt for event HFCLKSTARTED + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + LFCLKSTARTED + Write '1' to disable interrupt for event LFCLKSTARTED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DONE + Write '1' to disable interrupt for event DONE + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CTTO + Write '1' to disable interrupt for event CTTO + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CTSTARTED + Write '1' to disable interrupt for event CTSTARTED + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CTSTOPPED + Write '1' to disable interrupt for event CTSTOPPED + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + HFCLKRUN + Status indicating that HFCLKSTART task has been triggered + 0x408 + read-only + + + STATUS + HFCLKSTART task triggered or not + 0 + 0 + + + NotTriggered + Task not triggered + 0 + + + Triggered + Task triggered + 1 + + + + + + + HFCLKSTAT + HFCLK status + 0x40C + read-only + + + SRC + Source of HFCLK + 0 + 0 + + + RC + 64 MHz internal oscillator (HFINT) + 0 + + + Xtal + 64 MHz crystal oscillator (HFXO) + 1 + + + + + STATE + HFCLK state + 16 + 16 + + + NotRunning + HFCLK not running + 0 + + + Running + HFCLK running + 1 + + + + + + + LFCLKRUN + Status indicating that LFCLKSTART task has been triggered + 0x414 + read-only + + + STATUS + LFCLKSTART task triggered or not + 0 + 0 + + + NotTriggered + Task not triggered + 0 + + + Triggered + Task triggered + 1 + + + + + + + LFCLKSTAT + LFCLK status + 0x418 + read-only + + + SRC + Source of LFCLK + 0 + 1 + + + RC + 32.768 kHz RC oscillator (LFRC) + 0 + + + Xtal + 32.768 kHz crystal oscillator (LFXO) + 1 + + + Synth + 32.768 kHz synthesized from HFCLK (LFSYNT) + 2 + + + + + STATE + LFCLK state + 16 + 16 + + + NotRunning + LFCLK not running + 0 + + + Running + LFCLK running + 1 + + + + + + + LFCLKSRCCOPY + Copy of LFCLKSRC register, set when LFCLKSTART task was triggered + 0x41C + read-only + + + SRC + Clock source + 0 + 1 + + + RC + 32.768 kHz RC oscillator (LFRC) + 0 + + + Xtal + 32.768 kHz crystal oscillator (LFXO) + 1 + + + Synth + 32.768 kHz synthesized from HFCLK (LFSYNT) + 2 + + + + + + + LFCLKSRC + Clock source for the LFCLK + 0x518 + read-write + + + SRC + Clock source + 0 + 1 + + + RC + 32.768 kHz RC oscillator (LFRC) + 0 + + + Xtal + 32.768 kHz crystal oscillator (LFXO) + 1 + + + Synth + 32.768 kHz synthesized from HFCLK (LFSYNT) + 2 + + + + + BYPASS + Enable or disable bypass of LFCLK crystal oscillator with external clock source + 16 + 16 + + + Disabled + Disable (use with Xtal or low-swing external source) + 0 + + + Enabled + Enable (use with rail-to-rail external source) + 1 + + + + + EXTERNAL + Enable or disable external source for LFCLK + 17 + 17 + + + Disabled + Disable external source (use with Xtal) + 0 + + + Enabled + Enable use of external source instead of Xtal (SRC needs to be set to Xtal) + 1 + + + + + + + HFXODEBOUNCE + HFXO debounce time. The HFXO is started by triggering the TASKS_HFCLKSTART task. + 0x528 + read-write + 0x00000010 + + + HFXODEBOUNCE + HFXO debounce time. Debounce time = HFXODEBOUNCE * 16 us. + 0 + 7 + + + Db256us + 256 us debounce time. Recommended for TSX-3225, FA-20H and FA-128 crystals. + 0x10 + + + Db1024us + 1024 us debounce time. Recommended for NX1612AA and NX1210AB crystals. + 0x40 + + + + + + + CTIV + Calibration timer interval + 0x538 + read-write + + + CTIV + Calibration timer interval in multiple of 0.25 seconds. Range: 0.25 seconds to 31.75 seconds. + 0 + 6 + + + + + TRACECONFIG + Clocking options for the trace port debug interface + 0x55C + read-write + 0x00000000 + + + TRACEPORTSPEED + Speed of trace port clock. Note that the TRACECLK pin will output this clock divided by two. + 0 + 1 + + + 32MHz + 32 MHz trace port clock (TRACECLK = 16 MHz) + 0 + + + 16MHz + 16 MHz trace port clock (TRACECLK = 8 MHz) + 1 + + + 8MHz + 8 MHz trace port clock (TRACECLK = 4 MHz) + 2 + + + 4MHz + 4 MHz trace port clock (TRACECLK = 2 MHz) + 3 + + + + + TRACEMUX + Pin multiplexing of trace signals. See pin assignment chapter for more details. + 16 + 17 + + + GPIO + No trace signals routed to pins. All pins can be used as regular GPIOs. + 0 + + + Serial + SWO trace signal routed to pin. Remaining pins can be used as regular GPIOs. + 1 + + + Parallel + All trace signals (TRACECLK and TRACEDATA[n]) routed to pins. + 2 + + + + + + + LFRCMODE + LFRC mode configuration + 0x5B4 + read-write + 0x00000000 + + + MODE + Set LFRC mode + 0 + 0 + + + Normal + Normal mode + 0 + + + ULP + Ultra-low power mode (ULP) + 1 + + + + + STATUS + Active LFRC mode. This field is read only. + 16 + 16 + + + Normal + Normal mode + 0 + + + ULP + Ultra-low power mode (ULP) + 1 + + + + + + + + + POWER + Power control + 0x40000000 + APPROTECT + + 0 + 0x1000 + registers + + + POWER_CLOCK + 0 + + POWER + 0x20 + + + TASKS_CONSTLAT + Enable Constant Latency mode + 0x78 + write-only + + + TASKS_CONSTLAT + Enable Constant Latency mode + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_LOWPWR + Enable Low-power mode (variable latency) + 0x7C + write-only + + + TASKS_LOWPWR + Enable Low-power mode (variable latency) + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_POFWARN + Power failure warning + 0x108 + read-write + + + EVENTS_POFWARN + Power failure warning + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_SLEEPENTER + CPU entered WFI/WFE sleep + 0x114 + read-write + + + EVENTS_SLEEPENTER + CPU entered WFI/WFE sleep + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_SLEEPEXIT + CPU exited WFI/WFE sleep + 0x118 + read-write + + + EVENTS_SLEEPEXIT + CPU exited WFI/WFE sleep + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_USBDETECTED + Voltage supply detected on VBUS + 0x11C + read-write + + + EVENTS_USBDETECTED + Voltage supply detected on VBUS + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_USBREMOVED + Voltage supply removed from VBUS + 0x120 + read-write + + + EVENTS_USBREMOVED + Voltage supply removed from VBUS + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_USBPWRRDY + USB 3.3 V supply ready + 0x124 + read-write + + + EVENTS_USBPWRRDY + USB 3.3 V supply ready + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + POFWARN + Write '1' to enable interrupt for event POFWARN + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SLEEPENTER + Write '1' to enable interrupt for event SLEEPENTER + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SLEEPEXIT + Write '1' to enable interrupt for event SLEEPEXIT + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + USBDETECTED + Write '1' to enable interrupt for event USBDETECTED + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + USBREMOVED + Write '1' to enable interrupt for event USBREMOVED + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + USBPWRRDY + Write '1' to enable interrupt for event USBPWRRDY + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + POFWARN + Write '1' to disable interrupt for event POFWARN + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SLEEPENTER + Write '1' to disable interrupt for event SLEEPENTER + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SLEEPEXIT + Write '1' to disable interrupt for event SLEEPEXIT + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + USBDETECTED + Write '1' to disable interrupt for event USBDETECTED + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + USBREMOVED + Write '1' to disable interrupt for event USBREMOVED + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + USBPWRRDY + Write '1' to disable interrupt for event USBPWRRDY + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + RESETREAS + Reset reason + 0x400 + read-write + + + RESETPIN + Reset from pin-reset detected + 0 + 0 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + DOG + Reset from watchdog detected + 1 + 1 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + SREQ + Reset from soft reset detected + 2 + 2 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + LOCKUP + Reset from CPU lock-up detected + 3 + 3 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + OFF + Reset due to wake up from System OFF mode when wakeup is triggered from DETECT signal from GPIO + 16 + 16 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + LPCOMP + Reset due to wake up from System OFF mode when wakeup is triggered from ANADETECT signal from LPCOMP + 17 + 17 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + DIF + Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode + 18 + 18 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + NFC + Reset due to wake up from System OFF mode by NFC field detect + 19 + 19 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + VBUS + Reset due to wake up from System OFF mode by VBUS rising into valid range + 20 + 20 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + + + RAMSTATUS + Deprecated register - RAM status register + 0x428 + read-only + 0x00000000 + + + RAMBLOCK0 + RAM block 0 is on or off/powering up + 0 + 0 + + + Off + Off + 0 + + + On + On + 1 + + + + + RAMBLOCK1 + RAM block 1 is on or off/powering up + 1 + 1 + + + Off + Off + 0 + + + On + On + 1 + + + + + RAMBLOCK2 + RAM block 2 is on or off/powering up + 2 + 2 + + + Off + Off + 0 + + + On + On + 1 + + + + + RAMBLOCK3 + RAM block 3 is on or off/powering up + 3 + 3 + + + Off + Off + 0 + + + On + On + 1 + + + + + + + USBREGSTATUS + USB supply status + 0x438 + read-only + 0x00000000 + + + VBUSDETECT + VBUS input detection status (USBDETECTED and USBREMOVED events are derived from this information) + 0 + 0 + + + NoVbus + VBUS voltage below valid threshold + 0 + + + VbusPresent + VBUS voltage above valid threshold + 1 + + + + + OUTPUTRDY + USB supply output settling time elapsed + 1 + 1 + + + NotReady + USBREG output settling time not elapsed + 0 + + + Ready + USBREG output settling time elapsed (same information as USBPWRRDY event) + 1 + + + + + + + SYSTEMOFF + System OFF register + 0x500 + write-only + + + SYSTEMOFF + Enable System OFF mode + 0 + 0 + + + Enter + Enable System OFF mode + 1 + + + + + + + POFCON + Power-fail comparator configuration + 0x510 + read-write + + + POF + Enable or disable power failure warning + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + THRESHOLD + Power-fail comparator threshold setting. This setting applies both for normal voltage mode (supply connected to both VDD and VDDH) and high voltage mode (supply connected to VDDH only). Values 0-3 set threshold below 1.7 V and should not be used as brown out detection will be activated before power failure warning on such low voltages. + 1 + 4 + + + V17 + Set threshold to 1.7 V + 4 + + + V18 + Set threshold to 1.8 V + 5 + + + V19 + Set threshold to 1.9 V + 6 + + + V20 + Set threshold to 2.0 V + 7 + + + V21 + Set threshold to 2.1 V + 8 + + + V22 + Set threshold to 2.2 V + 9 + + + V23 + Set threshold to 2.3 V + 10 + + + V24 + Set threshold to 2.4 V + 11 + + + V25 + Set threshold to 2.5 V + 12 + + + V26 + Set threshold to 2.6 V + 13 + + + V27 + Set threshold to 2.7 V + 14 + + + V28 + Set threshold to 2.8 V + 15 + + + + + THRESHOLDVDDH + Power-fail comparator threshold setting for high voltage mode (supply connected to VDDH only). This setting does not apply for normal voltage mode (supply connected to both VDD and VDDH). + 8 + 11 + + + V27 + Set threshold to 2.7 V + 0 + + + V28 + Set threshold to 2.8 V + 1 + + + V29 + Set threshold to 2.9 V + 2 + + + V30 + Set threshold to 3.0 V + 3 + + + V31 + Set threshold to 3.1 V + 4 + + + V32 + Set threshold to 3.2 V + 5 + + + V33 + Set threshold to 3.3 V + 6 + + + V34 + Set threshold to 3.4 V + 7 + + + V35 + Set threshold to 3.5 V + 8 + + + V36 + Set threshold to 3.6 V + 9 + + + V37 + Set threshold to 3.7 V + 10 + + + V38 + Set threshold to 3.8 V + 11 + + + V39 + Set threshold to 3.9 V + 12 + + + V40 + Set threshold to 4.0 V + 13 + + + V41 + Set threshold to 4.1 V + 14 + + + V42 + Set threshold to 4.2 V + 15 + + + + + + + GPREGRET + General purpose retention register + 0x51C + read-write + + + GPREGRET + General purpose retention register + 0 + 7 + + + + + GPREGRET2 + General purpose retention register + 0x520 + read-write + + + GPREGRET + General purpose retention register + 0 + 7 + + + + + DCDCEN + Enable DC/DC converter for REG1 stage + 0x578 + read-write + + + DCDCEN + Enable DC/DC converter for REG1 stage. + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + DCDCEN0 + Enable DC/DC converter for REG0 stage + 0x580 + read-write + + + DCDCEN + Enable DC/DC converter for REG0 stage. + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + MAINREGSTATUS + Main supply status + 0x640 + read-only + 0x00000000 + + + MAINREGSTATUS + Main supply status + 0 + 0 + + + Normal + Normal voltage mode. Voltage supplied on VDD. + 0 + + + High + High voltage mode. Voltage supplied on VDDH. + 1 + + + + + + + 9 + 0x010 + RAM[%s] + Unspecified + POWER_RAM + read-write + 0x900 + + POWER + Description cluster: RAMn power control register + 0x000 + read-write + 0x0000FFFF + + + S0POWER + Keep RAM section S0 on or off in System ON mode. + 0 + 0 + + + Off + Off + 0 + + + On + On + 1 + + + + + S1POWER + Keep RAM section S1 on or off in System ON mode. + 1 + 1 + + + Off + Off + 0 + + + On + On + 1 + + + + + S2POWER + Keep RAM section S2 on or off in System ON mode. + 2 + 2 + + + Off + Off + 0 + + + On + On + 1 + + + + + S3POWER + Keep RAM section S3 on or off in System ON mode. + 3 + 3 + + + Off + Off + 0 + + + On + On + 1 + + + + + S4POWER + Keep RAM section S4 on or off in System ON mode. + 4 + 4 + + + Off + Off + 0 + + + On + On + 1 + + + + + S5POWER + Keep RAM section S5 on or off in System ON mode. + 5 + 5 + + + Off + Off + 0 + + + On + On + 1 + + + + + S6POWER + Keep RAM section S6 on or off in System ON mode. + 6 + 6 + + + Off + Off + 0 + + + On + On + 1 + + + + + S7POWER + Keep RAM section S7 on or off in System ON mode. + 7 + 7 + + + Off + Off + 0 + + + On + On + 1 + + + + + S8POWER + Keep RAM section S8 on or off in System ON mode. + 8 + 8 + + + Off + Off + 0 + + + On + On + 1 + + + + + S9POWER + Keep RAM section S9 on or off in System ON mode. + 9 + 9 + + + Off + Off + 0 + + + On + On + 1 + + + + + S10POWER + Keep RAM section S10 on or off in System ON mode. + 10 + 10 + + + Off + Off + 0 + + + On + On + 1 + + + + + S11POWER + Keep RAM section S11 on or off in System ON mode. + 11 + 11 + + + Off + Off + 0 + + + On + On + 1 + + + + + S12POWER + Keep RAM section S12 on or off in System ON mode. + 12 + 12 + + + Off + Off + 0 + + + On + On + 1 + + + + + S13POWER + Keep RAM section S13 on or off in System ON mode. + 13 + 13 + + + Off + Off + 0 + + + On + On + 1 + + + + + S14POWER + Keep RAM section S14 on or off in System ON mode. + 14 + 14 + + + Off + Off + 0 + + + On + On + 1 + + + + + S15POWER + Keep RAM section S15 on or off in System ON mode. + 15 + 15 + + + Off + Off + 0 + + + On + On + 1 + + + + + S0RETENTION + Keep retention on RAM section S0 when RAM section is off + 16 + 16 + + + Off + Off + 0 + + + On + On + 1 + + + + + S1RETENTION + Keep retention on RAM section S1 when RAM section is off + 17 + 17 + + + Off + Off + 0 + + + On + On + 1 + + + + + S2RETENTION + Keep retention on RAM section S2 when RAM section is off + 18 + 18 + + + Off + Off + 0 + + + On + On + 1 + + + + + S3RETENTION + Keep retention on RAM section S3 when RAM section is off + 19 + 19 + + + Off + Off + 0 + + + On + On + 1 + + + + + S4RETENTION + Keep retention on RAM section S4 when RAM section is off + 20 + 20 + + + Off + Off + 0 + + + On + On + 1 + + + + + S5RETENTION + Keep retention on RAM section S5 when RAM section is off + 21 + 21 + + + Off + Off + 0 + + + On + On + 1 + + + + + S6RETENTION + Keep retention on RAM section S6 when RAM section is off + 22 + 22 + + + Off + Off + 0 + + + On + On + 1 + + + + + S7RETENTION + Keep retention on RAM section S7 when RAM section is off + 23 + 23 + + + Off + Off + 0 + + + On + On + 1 + + + + + S8RETENTION + Keep retention on RAM section S8 when RAM section is off + 24 + 24 + + + Off + Off + 0 + + + On + On + 1 + + + + + S9RETENTION + Keep retention on RAM section S9 when RAM section is off + 25 + 25 + + + Off + Off + 0 + + + On + On + 1 + + + + + S10RETENTION + Keep retention on RAM section S10 when RAM section is off + 26 + 26 + + + Off + Off + 0 + + + On + On + 1 + + + + + S11RETENTION + Keep retention on RAM section S11 when RAM section is off + 27 + 27 + + + Off + Off + 0 + + + On + On + 1 + + + + + S12RETENTION + Keep retention on RAM section S12 when RAM section is off + 28 + 28 + + + Off + Off + 0 + + + On + On + 1 + + + + + S13RETENTION + Keep retention on RAM section S13 when RAM section is off + 29 + 29 + + + Off + Off + 0 + + + On + On + 1 + + + + + S14RETENTION + Keep retention on RAM section S14 when RAM section is off + 30 + 30 + + + Off + Off + 0 + + + On + On + 1 + + + + + S15RETENTION + Keep retention on RAM section S15 when RAM section is off + 31 + 31 + + + Off + Off + 0 + + + On + On + 1 + + + + + + + POWERSET + Description cluster: RAMn power control set register + 0x004 + write-only + 0x0000FFFF + + + S0POWER + Keep RAM section S0 of RAMn on or off in System ON mode + 0 + 0 + + + On + On + 1 + + + + + S1POWER + Keep RAM section S1 of RAMn on or off in System ON mode + 1 + 1 + + + On + On + 1 + + + + + S2POWER + Keep RAM section S2 of RAMn on or off in System ON mode + 2 + 2 + + + On + On + 1 + + + + + S3POWER + Keep RAM section S3 of RAMn on or off in System ON mode + 3 + 3 + + + On + On + 1 + + + + + S4POWER + Keep RAM section S4 of RAMn on or off in System ON mode + 4 + 4 + + + On + On + 1 + + + + + S5POWER + Keep RAM section S5 of RAMn on or off in System ON mode + 5 + 5 + + + On + On + 1 + + + + + S6POWER + Keep RAM section S6 of RAMn on or off in System ON mode + 6 + 6 + + + On + On + 1 + + + + + S7POWER + Keep RAM section S7 of RAMn on or off in System ON mode + 7 + 7 + + + On + On + 1 + + + + + S8POWER + Keep RAM section S8 of RAMn on or off in System ON mode + 8 + 8 + + + On + On + 1 + + + + + S9POWER + Keep RAM section S9 of RAMn on or off in System ON mode + 9 + 9 + + + On + On + 1 + + + + + S10POWER + Keep RAM section S10 of RAMn on or off in System ON mode + 10 + 10 + + + On + On + 1 + + + + + S11POWER + Keep RAM section S11 of RAMn on or off in System ON mode + 11 + 11 + + + On + On + 1 + + + + + S12POWER + Keep RAM section S12 of RAMn on or off in System ON mode + 12 + 12 + + + On + On + 1 + + + + + S13POWER + Keep RAM section S13 of RAMn on or off in System ON mode + 13 + 13 + + + On + On + 1 + + + + + S14POWER + Keep RAM section S14 of RAMn on or off in System ON mode + 14 + 14 + + + On + On + 1 + + + + + S15POWER + Keep RAM section S15 of RAMn on or off in System ON mode + 15 + 15 + + + On + On + 1 + + + + + S0RETENTION + Keep retention on RAM section S0 when RAM section is switched off + 16 + 16 + + + On + On + 1 + + + + + S1RETENTION + Keep retention on RAM section S1 when RAM section is switched off + 17 + 17 + + + On + On + 1 + + + + + S2RETENTION + Keep retention on RAM section S2 when RAM section is switched off + 18 + 18 + + + On + On + 1 + + + + + S3RETENTION + Keep retention on RAM section S3 when RAM section is switched off + 19 + 19 + + + On + On + 1 + + + + + S4RETENTION + Keep retention on RAM section S4 when RAM section is switched off + 20 + 20 + + + On + On + 1 + + + + + S5RETENTION + Keep retention on RAM section S5 when RAM section is switched off + 21 + 21 + + + On + On + 1 + + + + + S6RETENTION + Keep retention on RAM section S6 when RAM section is switched off + 22 + 22 + + + On + On + 1 + + + + + S7RETENTION + Keep retention on RAM section S7 when RAM section is switched off + 23 + 23 + + + On + On + 1 + + + + + S8RETENTION + Keep retention on RAM section S8 when RAM section is switched off + 24 + 24 + + + On + On + 1 + + + + + S9RETENTION + Keep retention on RAM section S9 when RAM section is switched off + 25 + 25 + + + On + On + 1 + + + + + S10RETENTION + Keep retention on RAM section S10 when RAM section is switched off + 26 + 26 + + + On + On + 1 + + + + + S11RETENTION + Keep retention on RAM section S11 when RAM section is switched off + 27 + 27 + + + On + On + 1 + + + + + S12RETENTION + Keep retention on RAM section S12 when RAM section is switched off + 28 + 28 + + + On + On + 1 + + + + + S13RETENTION + Keep retention on RAM section S13 when RAM section is switched off + 29 + 29 + + + On + On + 1 + + + + + S14RETENTION + Keep retention on RAM section S14 when RAM section is switched off + 30 + 30 + + + On + On + 1 + + + + + S15RETENTION + Keep retention on RAM section S15 when RAM section is switched off + 31 + 31 + + + On + On + 1 + + + + + + + POWERCLR + Description cluster: RAMn power control clear register + 0x008 + write-only + 0x0000FFFF + + + S0POWER + Keep RAM section S0 of RAMn on or off in System ON mode + 0 + 0 + + + Off + Off + 1 + + + + + S1POWER + Keep RAM section S1 of RAMn on or off in System ON mode + 1 + 1 + + + Off + Off + 1 + + + + + S2POWER + Keep RAM section S2 of RAMn on or off in System ON mode + 2 + 2 + + + Off + Off + 1 + + + + + S3POWER + Keep RAM section S3 of RAMn on or off in System ON mode + 3 + 3 + + + Off + Off + 1 + + + + + S4POWER + Keep RAM section S4 of RAMn on or off in System ON mode + 4 + 4 + + + Off + Off + 1 + + + + + S5POWER + Keep RAM section S5 of RAMn on or off in System ON mode + 5 + 5 + + + Off + Off + 1 + + + + + S6POWER + Keep RAM section S6 of RAMn on or off in System ON mode + 6 + 6 + + + Off + Off + 1 + + + + + S7POWER + Keep RAM section S7 of RAMn on or off in System ON mode + 7 + 7 + + + Off + Off + 1 + + + + + S8POWER + Keep RAM section S8 of RAMn on or off in System ON mode + 8 + 8 + + + Off + Off + 1 + + + + + S9POWER + Keep RAM section S9 of RAMn on or off in System ON mode + 9 + 9 + + + Off + Off + 1 + + + + + S10POWER + Keep RAM section S10 of RAMn on or off in System ON mode + 10 + 10 + + + Off + Off + 1 + + + + + S11POWER + Keep RAM section S11 of RAMn on or off in System ON mode + 11 + 11 + + + Off + Off + 1 + + + + + S12POWER + Keep RAM section S12 of RAMn on or off in System ON mode + 12 + 12 + + + Off + Off + 1 + + + + + S13POWER + Keep RAM section S13 of RAMn on or off in System ON mode + 13 + 13 + + + Off + Off + 1 + + + + + S14POWER + Keep RAM section S14 of RAMn on or off in System ON mode + 14 + 14 + + + Off + Off + 1 + + + + + S15POWER + Keep RAM section S15 of RAMn on or off in System ON mode + 15 + 15 + + + Off + Off + 1 + + + + + S0RETENTION + Keep retention on RAM section S0 when RAM section is switched off + 16 + 16 + + + Off + Off + 1 + + + + + S1RETENTION + Keep retention on RAM section S1 when RAM section is switched off + 17 + 17 + + + Off + Off + 1 + + + + + S2RETENTION + Keep retention on RAM section S2 when RAM section is switched off + 18 + 18 + + + Off + Off + 1 + + + + + S3RETENTION + Keep retention on RAM section S3 when RAM section is switched off + 19 + 19 + + + Off + Off + 1 + + + + + S4RETENTION + Keep retention on RAM section S4 when RAM section is switched off + 20 + 20 + + + Off + Off + 1 + + + + + S5RETENTION + Keep retention on RAM section S5 when RAM section is switched off + 21 + 21 + + + Off + Off + 1 + + + + + S6RETENTION + Keep retention on RAM section S6 when RAM section is switched off + 22 + 22 + + + Off + Off + 1 + + + + + S7RETENTION + Keep retention on RAM section S7 when RAM section is switched off + 23 + 23 + + + Off + Off + 1 + + + + + S8RETENTION + Keep retention on RAM section S8 when RAM section is switched off + 24 + 24 + + + Off + Off + 1 + + + + + S9RETENTION + Keep retention on RAM section S9 when RAM section is switched off + 25 + 25 + + + Off + Off + 1 + + + + + S10RETENTION + Keep retention on RAM section S10 when RAM section is switched off + 26 + 26 + + + Off + Off + 1 + + + + + S11RETENTION + Keep retention on RAM section S11 when RAM section is switched off + 27 + 27 + + + Off + Off + 1 + + + + + S12RETENTION + Keep retention on RAM section S12 when RAM section is switched off + 28 + 28 + + + Off + Off + 1 + + + + + S13RETENTION + Keep retention on RAM section S13 when RAM section is switched off + 29 + 29 + + + Off + Off + 1 + + + + + S14RETENTION + Keep retention on RAM section S14 when RAM section is switched off + 30 + 30 + + + Off + Off + 1 + + + + + S15RETENTION + Keep retention on RAM section S15 when RAM section is switched off + 31 + 31 + + + Off + Off + 1 + + + + + + + + + + P0 + GPIO Port 1 + 0x50000000 + GPIO + + 0 + 0x1000 + registers + + GPIO + 0x20 + + + OUT + Write GPIO port + 0x504 + read-write + + + PIN0 + Pin 0 + 0 + 0 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + + + OUTSET + Set individual bits in GPIO port + 0x508 + read-write + oneToSet + + + PIN0 + Pin 0 + 0 + 0 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: a '1' sets the pin high; a '0' has no effect + 1 + + + + + + + OUTCLR + Clear individual bits in GPIO port + 0x50C + read-write + oneToClear + + + PIN0 + Pin 0 + 0 + 0 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: a '1' sets the pin low; a '0' has no effect + 1 + + + + + + + IN + Read GPIO port + 0x510 + read-only + + + PIN0 + Pin 0 + 0 + 0 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + + + DIR + Direction of GPIO pins + 0x514 + read-write + + + PIN0 + Pin 0 + 0 + 0 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + + + DIRSET + DIR set register + 0x518 + read-write + oneToSet + + + PIN0 + Set as output pin 0 + 0 + 0 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN1 + Set as output pin 1 + 1 + 1 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN2 + Set as output pin 2 + 2 + 2 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN3 + Set as output pin 3 + 3 + 3 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN4 + Set as output pin 4 + 4 + 4 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN5 + Set as output pin 5 + 5 + 5 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN6 + Set as output pin 6 + 6 + 6 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN7 + Set as output pin 7 + 7 + 7 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN8 + Set as output pin 8 + 8 + 8 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN9 + Set as output pin 9 + 9 + 9 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN10 + Set as output pin 10 + 10 + 10 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN11 + Set as output pin 11 + 11 + 11 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN12 + Set as output pin 12 + 12 + 12 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN13 + Set as output pin 13 + 13 + 13 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN14 + Set as output pin 14 + 14 + 14 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN15 + Set as output pin 15 + 15 + 15 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN16 + Set as output pin 16 + 16 + 16 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN17 + Set as output pin 17 + 17 + 17 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN18 + Set as output pin 18 + 18 + 18 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN19 + Set as output pin 19 + 19 + 19 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN20 + Set as output pin 20 + 20 + 20 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN21 + Set as output pin 21 + 21 + 21 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN22 + Set as output pin 22 + 22 + 22 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN23 + Set as output pin 23 + 23 + 23 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN24 + Set as output pin 24 + 24 + 24 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN25 + Set as output pin 25 + 25 + 25 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN26 + Set as output pin 26 + 26 + 26 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN27 + Set as output pin 27 + 27 + 27 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN28 + Set as output pin 28 + 28 + 28 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN29 + Set as output pin 29 + 29 + 29 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN30 + Set as output pin 30 + 30 + 30 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + PIN31 + Set as output pin 31 + 31 + 31 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: a '1' sets pin to output; a '0' has no effect + 1 + + + + + + + DIRCLR + DIR clear register + 0x51C + read-write + oneToClear + + + PIN0 + Set as input pin 0 + 0 + 0 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN1 + Set as input pin 1 + 1 + 1 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN2 + Set as input pin 2 + 2 + 2 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN3 + Set as input pin 3 + 3 + 3 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN4 + Set as input pin 4 + 4 + 4 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN5 + Set as input pin 5 + 5 + 5 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN6 + Set as input pin 6 + 6 + 6 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN7 + Set as input pin 7 + 7 + 7 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN8 + Set as input pin 8 + 8 + 8 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN9 + Set as input pin 9 + 9 + 9 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN10 + Set as input pin 10 + 10 + 10 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN11 + Set as input pin 11 + 11 + 11 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN12 + Set as input pin 12 + 12 + 12 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN13 + Set as input pin 13 + 13 + 13 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN14 + Set as input pin 14 + 14 + 14 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN15 + Set as input pin 15 + 15 + 15 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN16 + Set as input pin 16 + 16 + 16 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN17 + Set as input pin 17 + 17 + 17 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN18 + Set as input pin 18 + 18 + 18 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN19 + Set as input pin 19 + 19 + 19 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN20 + Set as input pin 20 + 20 + 20 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN21 + Set as input pin 21 + 21 + 21 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN22 + Set as input pin 22 + 22 + 22 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN23 + Set as input pin 23 + 23 + 23 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN24 + Set as input pin 24 + 24 + 24 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN25 + Set as input pin 25 + 25 + 25 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN26 + Set as input pin 26 + 26 + 26 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN27 + Set as input pin 27 + 27 + 27 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN28 + Set as input pin 28 + 28 + 28 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN29 + Set as input pin 29 + 29 + 29 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN30 + Set as input pin 30 + 30 + 30 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + PIN31 + Set as input pin 31 + 31 + 31 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: a '1' sets pin to input; a '0' has no effect + 1 + + + + + + + LATCH + Latch register indicating what GPIO pins that have met the criteria set in the PIN_CNF[n].SENSE registers + 0x520 + read-write + + + PIN0 + Status on whether PIN0 has met criteria set in PIN_CNF0.SENSE register. Write '1' to clear. + 0 + 0 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN1 + Status on whether PIN1 has met criteria set in PIN_CNF1.SENSE register. Write '1' to clear. + 1 + 1 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN2 + Status on whether PIN2 has met criteria set in PIN_CNF2.SENSE register. Write '1' to clear. + 2 + 2 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN3 + Status on whether PIN3 has met criteria set in PIN_CNF3.SENSE register. Write '1' to clear. + 3 + 3 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN4 + Status on whether PIN4 has met criteria set in PIN_CNF4.SENSE register. Write '1' to clear. + 4 + 4 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN5 + Status on whether PIN5 has met criteria set in PIN_CNF5.SENSE register. Write '1' to clear. + 5 + 5 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN6 + Status on whether PIN6 has met criteria set in PIN_CNF6.SENSE register. Write '1' to clear. + 6 + 6 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN7 + Status on whether PIN7 has met criteria set in PIN_CNF7.SENSE register. Write '1' to clear. + 7 + 7 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN8 + Status on whether PIN8 has met criteria set in PIN_CNF8.SENSE register. Write '1' to clear. + 8 + 8 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN9 + Status on whether PIN9 has met criteria set in PIN_CNF9.SENSE register. Write '1' to clear. + 9 + 9 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN10 + Status on whether PIN10 has met criteria set in PIN_CNF10.SENSE register. Write '1' to clear. + 10 + 10 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN11 + Status on whether PIN11 has met criteria set in PIN_CNF11.SENSE register. Write '1' to clear. + 11 + 11 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN12 + Status on whether PIN12 has met criteria set in PIN_CNF12.SENSE register. Write '1' to clear. + 12 + 12 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN13 + Status on whether PIN13 has met criteria set in PIN_CNF13.SENSE register. Write '1' to clear. + 13 + 13 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN14 + Status on whether PIN14 has met criteria set in PIN_CNF14.SENSE register. Write '1' to clear. + 14 + 14 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN15 + Status on whether PIN15 has met criteria set in PIN_CNF15.SENSE register. Write '1' to clear. + 15 + 15 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN16 + Status on whether PIN16 has met criteria set in PIN_CNF16.SENSE register. Write '1' to clear. + 16 + 16 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN17 + Status on whether PIN17 has met criteria set in PIN_CNF17.SENSE register. Write '1' to clear. + 17 + 17 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN18 + Status on whether PIN18 has met criteria set in PIN_CNF18.SENSE register. Write '1' to clear. + 18 + 18 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN19 + Status on whether PIN19 has met criteria set in PIN_CNF19.SENSE register. Write '1' to clear. + 19 + 19 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN20 + Status on whether PIN20 has met criteria set in PIN_CNF20.SENSE register. Write '1' to clear. + 20 + 20 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN21 + Status on whether PIN21 has met criteria set in PIN_CNF21.SENSE register. Write '1' to clear. + 21 + 21 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN22 + Status on whether PIN22 has met criteria set in PIN_CNF22.SENSE register. Write '1' to clear. + 22 + 22 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN23 + Status on whether PIN23 has met criteria set in PIN_CNF23.SENSE register. Write '1' to clear. + 23 + 23 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN24 + Status on whether PIN24 has met criteria set in PIN_CNF24.SENSE register. Write '1' to clear. + 24 + 24 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN25 + Status on whether PIN25 has met criteria set in PIN_CNF25.SENSE register. Write '1' to clear. + 25 + 25 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN26 + Status on whether PIN26 has met criteria set in PIN_CNF26.SENSE register. Write '1' to clear. + 26 + 26 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN27 + Status on whether PIN27 has met criteria set in PIN_CNF27.SENSE register. Write '1' to clear. + 27 + 27 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN28 + Status on whether PIN28 has met criteria set in PIN_CNF28.SENSE register. Write '1' to clear. + 28 + 28 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN29 + Status on whether PIN29 has met criteria set in PIN_CNF29.SENSE register. Write '1' to clear. + 29 + 29 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN30 + Status on whether PIN30 has met criteria set in PIN_CNF30.SENSE register. Write '1' to clear. + 30 + 30 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN31 + Status on whether PIN31 has met criteria set in PIN_CNF31.SENSE register. Write '1' to clear. + 31 + 31 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + + + DETECTMODE + Select between default DETECT signal behavior and LDETECT mode + 0x524 + read-write + + + DETECTMODE + Select between default DETECT signal behavior and LDETECT mode + 0 + 0 + + + Default + DETECT directly connected to PIN DETECT signals + 0 + + + LDETECT + Use the latched LDETECT behavior + 1 + + + + + + + 0x20 + 0x4 + PIN_CNF[%s] + Description collection: Configuration of GPIO pins + 0x700 + read-write + 0x00000002 + + + DIR + Pin direction. Same physical register as DIR register + 0 + 0 + + + Input + Configure pin as an input pin + 0 + + + Output + Configure pin as an output pin + 1 + + + + + INPUT + Connect or disconnect input buffer + 1 + 1 + + + Connect + Connect input buffer + 0 + + + Disconnect + Disconnect input buffer + 1 + + + + + PULL + Pull configuration + 2 + 3 + + + Disabled + No pull + 0 + + + Pulldown + Pull down on pin + 1 + + + Pullup + Pull up on pin + 3 + + + + + DRIVE + Drive configuration + 8 + 10 + + + S0S1 + Standard '0', standard '1' + 0 + + + H0S1 + High drive '0', standard '1' + 1 + + + S0H1 + Standard '0', high drive '1' + 2 + + + H0H1 + High drive '0', high 'drive '1'' + 3 + + + D0S1 + Disconnect '0' standard '1' (normally used for wired-or connections) + 4 + + + D0H1 + Disconnect '0', high drive '1' (normally used for wired-or connections) + 5 + + + S0D1 + Standard '0'. disconnect '1' (normally used for wired-and connections) + 6 + + + H0D1 + High drive '0', disconnect '1' (normally used for wired-and connections) + 7 + + + + + SENSE + Pin sensing mechanism + 16 + 17 + + + Disabled + Disabled + 0 + + + High + Sense for high level + 2 + + + Low + Sense for low level + 3 + + + + + + + + + P1 + GPIO Port 2 + 0x50000300 + P0 + + + RADIO + 2.4 GHz radio + 0x40001000 + + 0 + 0x1000 + registers + + + RADIO + 1 + + RADIO + 0x20 + + + TASKS_TXEN + Enable RADIO in TX mode + 0x000 + write-only + + + TASKS_TXEN + Enable RADIO in TX mode + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_RXEN + Enable RADIO in RX mode + 0x004 + write-only + + + TASKS_RXEN + Enable RADIO in RX mode + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_START + Start RADIO + 0x008 + write-only + + + TASKS_START + Start RADIO + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stop RADIO + 0x00C + write-only + + + TASKS_STOP + Stop RADIO + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_DISABLE + Disable RADIO + 0x010 + write-only + + + TASKS_DISABLE + Disable RADIO + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_RSSISTART + Start the RSSI and take one single sample of the receive signal strength + 0x014 + write-only + + + TASKS_RSSISTART + Start the RSSI and take one single sample of the receive signal strength + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_RSSISTOP + Stop the RSSI measurement + 0x018 + write-only + + + TASKS_RSSISTOP + Stop the RSSI measurement + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_BCSTART + Start the bit counter + 0x01C + write-only + + + TASKS_BCSTART + Start the bit counter + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_BCSTOP + Stop the bit counter + 0x020 + write-only + + + TASKS_BCSTOP + Stop the bit counter + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_EDSTART + Start the energy detect measurement used in IEEE 802.15.4 mode + 0x024 + write-only + + + TASKS_EDSTART + Start the energy detect measurement used in IEEE 802.15.4 mode + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_EDSTOP + Stop the energy detect measurement + 0x028 + write-only + + + TASKS_EDSTOP + Stop the energy detect measurement + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_CCASTART + Start the clear channel assessment used in IEEE 802.15.4 mode + 0x02C + write-only + + + TASKS_CCASTART + Start the clear channel assessment used in IEEE 802.15.4 mode + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_CCASTOP + Stop the clear channel assessment + 0x030 + write-only + + + TASKS_CCASTOP + Stop the clear channel assessment + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_READY + RADIO has ramped up and is ready to be started + 0x100 + read-write + + + EVENTS_READY + RADIO has ramped up and is ready to be started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ADDRESS + Address sent or received + 0x104 + read-write + + + EVENTS_ADDRESS + Address sent or received + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_PAYLOAD + Packet payload sent or received + 0x108 + read-write + + + EVENTS_PAYLOAD + Packet payload sent or received + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_END + Packet sent or received + 0x10C + read-write + + + EVENTS_END + Packet sent or received + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_DISABLED + RADIO has been disabled + 0x110 + read-write + + + EVENTS_DISABLED + RADIO has been disabled + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_DEVMATCH + A device address match occurred on the last received packet + 0x114 + read-write + + + EVENTS_DEVMATCH + A device address match occurred on the last received packet + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_DEVMISS + No device address match occurred on the last received packet + 0x118 + read-write + + + EVENTS_DEVMISS + No device address match occurred on the last received packet + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RSSIEND + Sampling of receive signal strength complete + 0x11C + read-write + + + EVENTS_RSSIEND + Sampling of receive signal strength complete + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_BCMATCH + Bit counter reached bit count value + 0x128 + read-write + + + EVENTS_BCMATCH + Bit counter reached bit count value + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_CRCOK + Packet received with CRC ok + 0x130 + read-write + + + EVENTS_CRCOK + Packet received with CRC ok + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_CRCERROR + Packet received with CRC error + 0x134 + read-write + + + EVENTS_CRCERROR + Packet received with CRC error + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_FRAMESTART + IEEE 802.15.4 length field received + 0x138 + read-write + + + EVENTS_FRAMESTART + IEEE 802.15.4 length field received + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_EDEND + Sampling of energy detection complete. A new ED sample is ready for readout from the RADIO.EDSAMPLE register. + 0x13C + read-write + + + EVENTS_EDEND + Sampling of energy detection complete. A new ED sample is ready for readout from the RADIO.EDSAMPLE register. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_EDSTOPPED + The sampling of energy detection has stopped + 0x140 + read-write + + + EVENTS_EDSTOPPED + The sampling of energy detection has stopped + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_CCAIDLE + Wireless medium in idle - clear to send + 0x144 + read-write + + + EVENTS_CCAIDLE + Wireless medium in idle - clear to send + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_CCABUSY + Wireless medium busy - do not send + 0x148 + read-write + + + EVENTS_CCABUSY + Wireless medium busy - do not send + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_CCASTOPPED + The CCA has stopped + 0x14C + read-write + + + EVENTS_CCASTOPPED + The CCA has stopped + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RATEBOOST + Ble_LR CI field received, receive mode is changed from Ble_LR125Kbit to Ble_LR500Kbit. + 0x150 + read-write + + + EVENTS_RATEBOOST + Ble_LR CI field received, receive mode is changed from Ble_LR125Kbit to Ble_LR500Kbit. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_TXREADY + RADIO has ramped up and is ready to be started TX path + 0x154 + read-write + + + EVENTS_TXREADY + RADIO has ramped up and is ready to be started TX path + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RXREADY + RADIO has ramped up and is ready to be started RX path + 0x158 + read-write + + + EVENTS_RXREADY + RADIO has ramped up and is ready to be started RX path + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_MHRMATCH + MAC header match found + 0x15C + read-write + + + EVENTS_MHRMATCH + MAC header match found + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_SYNC + Preamble indicator. + 0x168 + read-write + + + EVENTS_SYNC + Preamble indicator. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_PHYEND + Generated in Ble_LR125Kbit, Ble_LR500Kbit and Ieee802154_250Kbit modes when last bit is sent on air. + 0x16C + read-write + + + EVENTS_PHYEND + Generated in Ble_LR125Kbit, Ble_LR500Kbit and Ieee802154_250Kbit modes when last bit is sent on air. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + READY_START + Shortcut between event READY and task START + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + END_DISABLE + Shortcut between event END and task DISABLE + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DISABLED_TXEN + Shortcut between event DISABLED and task TXEN + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DISABLED_RXEN + Shortcut between event DISABLED and task RXEN + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ADDRESS_RSSISTART + Shortcut between event ADDRESS and task RSSISTART + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + END_START + Shortcut between event END and task START + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ADDRESS_BCSTART + Shortcut between event ADDRESS and task BCSTART + 6 + 6 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DISABLED_RSSISTOP + Shortcut between event DISABLED and task RSSISTOP + 8 + 8 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + RXREADY_CCASTART + Shortcut between event RXREADY and task CCASTART + 11 + 11 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + CCAIDLE_TXEN + Shortcut between event CCAIDLE and task TXEN + 12 + 12 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + CCABUSY_DISABLE + Shortcut between event CCABUSY and task DISABLE + 13 + 13 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + FRAMESTART_BCSTART + Shortcut between event FRAMESTART and task BCSTART + 14 + 14 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + READY_EDSTART + Shortcut between event READY and task EDSTART + 15 + 15 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + EDEND_DISABLE + Shortcut between event EDEND and task DISABLE + 16 + 16 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + CCAIDLE_STOP + Shortcut between event CCAIDLE and task STOP + 17 + 17 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + TXREADY_START + Shortcut between event TXREADY and task START + 18 + 18 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + RXREADY_START + Shortcut between event RXREADY and task START + 19 + 19 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + PHYEND_DISABLE + Shortcut between event PHYEND and task DISABLE + 20 + 20 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + PHYEND_START + Shortcut between event PHYEND and task START + 21 + 21 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to enable interrupt for event READY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ADDRESS + Write '1' to enable interrupt for event ADDRESS + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PAYLOAD + Write '1' to enable interrupt for event PAYLOAD + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + END + Write '1' to enable interrupt for event END + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DISABLED + Write '1' to enable interrupt for event DISABLED + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DEVMATCH + Write '1' to enable interrupt for event DEVMATCH + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DEVMISS + Write '1' to enable interrupt for event DEVMISS + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RSSIEND + Write '1' to enable interrupt for event RSSIEND + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + BCMATCH + Write '1' to enable interrupt for event BCMATCH + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CRCOK + Write '1' to enable interrupt for event CRCOK + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CRCERROR + Write '1' to enable interrupt for event CRCERROR + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + FRAMESTART + Write '1' to enable interrupt for event FRAMESTART + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + EDEND + Write '1' to enable interrupt for event EDEND + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + EDSTOPPED + Write '1' to enable interrupt for event EDSTOPPED + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CCAIDLE + Write '1' to enable interrupt for event CCAIDLE + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CCABUSY + Write '1' to enable interrupt for event CCABUSY + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CCASTOPPED + Write '1' to enable interrupt for event CCASTOPPED + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RATEBOOST + Write '1' to enable interrupt for event RATEBOOST + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXREADY + Write '1' to enable interrupt for event TXREADY + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXREADY + Write '1' to enable interrupt for event RXREADY + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + MHRMATCH + Write '1' to enable interrupt for event MHRMATCH + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SYNC + Write '1' to enable interrupt for event SYNC + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PHYEND + Write '1' to enable interrupt for event PHYEND + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to disable interrupt for event READY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ADDRESS + Write '1' to disable interrupt for event ADDRESS + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PAYLOAD + Write '1' to disable interrupt for event PAYLOAD + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + END + Write '1' to disable interrupt for event END + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DISABLED + Write '1' to disable interrupt for event DISABLED + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DEVMATCH + Write '1' to disable interrupt for event DEVMATCH + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DEVMISS + Write '1' to disable interrupt for event DEVMISS + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RSSIEND + Write '1' to disable interrupt for event RSSIEND + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + BCMATCH + Write '1' to disable interrupt for event BCMATCH + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CRCOK + Write '1' to disable interrupt for event CRCOK + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CRCERROR + Write '1' to disable interrupt for event CRCERROR + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + FRAMESTART + Write '1' to disable interrupt for event FRAMESTART + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + EDEND + Write '1' to disable interrupt for event EDEND + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + EDSTOPPED + Write '1' to disable interrupt for event EDSTOPPED + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CCAIDLE + Write '1' to disable interrupt for event CCAIDLE + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CCABUSY + Write '1' to disable interrupt for event CCABUSY + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CCASTOPPED + Write '1' to disable interrupt for event CCASTOPPED + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RATEBOOST + Write '1' to disable interrupt for event RATEBOOST + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXREADY + Write '1' to disable interrupt for event TXREADY + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXREADY + Write '1' to disable interrupt for event RXREADY + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + MHRMATCH + Write '1' to disable interrupt for event MHRMATCH + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SYNC + Write '1' to disable interrupt for event SYNC + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PHYEND + Write '1' to disable interrupt for event PHYEND + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + CRCSTATUS + CRC status + 0x400 + read-only + + + CRCSTATUS + CRC status of packet received + 0 + 0 + + + CRCError + Packet received with CRC error + 0 + + + CRCOk + Packet received with CRC ok + 1 + + + + + + + RXMATCH + Received address + 0x408 + read-only + + + RXMATCH + Received address + 0 + 2 + + + + + RXCRC + CRC field of previously received packet + 0x40C + read-only + + + RXCRC + CRC field of previously received packet + 0 + 23 + + + + + DAI + Device address match index + 0x410 + read-only + + + DAI + Device address match index + 0 + 2 + + + + + PDUSTAT + Payload status + 0x414 + read-only + + + PDUSTAT + Status on payload length vs. PCNF1.MAXLEN + 0 + 0 + + + LessThan + Payload less than PCNF1.MAXLEN + 0 + + + GreaterThan + Payload greater than PCNF1.MAXLEN + 1 + + + + + CISTAT + Status on what rate packet is received with in Long Range + 1 + 2 + + + LR125kbit + Frame is received at 125kbps + 0 + + + LR500kbit + Frame is received at 500kbps + 1 + + + + + + + PACKETPTR + Packet pointer + 0x504 + read-write + + + PACKETPTR + Packet pointer + 0 + 31 + + + + + FREQUENCY + Frequency + 0x508 + read-write + 0x00000002 + + + FREQUENCY + Radio channel frequency + 0 + 6 + + + MAP + Channel map selection. + 8 + 8 + + + Default + Channel map between 2400 MHZ .. 2500 MHz + 0 + + + Low + Channel map between 2360 MHZ .. 2460 MHz + 1 + + + + + + + TXPOWER + Output power + 0x50C + read-write + + + TXPOWER + RADIO output power + 0 + 7 + + + Pos8dBm + +8 dBm + 0x8 + + + Pos7dBm + +7 dBm + 0x7 + + + Pos6dBm + +6 dBm + 0x6 + + + Pos5dBm + +5 dBm + 0x5 + + + Pos4dBm + +4 dBm + 0x4 + + + Pos3dBm + +3 dBm + 0x3 + + + Pos2dBm + +2 dBm + 0x2 + + + 0dBm + 0 dBm + 0x0 + + + Neg4dBm + -4 dBm + 0xFC + + + Neg8dBm + -8 dBm + 0xF8 + + + Neg12dBm + -12 dBm + 0xF4 + + + Neg16dBm + -16 dBm + 0xF0 + + + Neg20dBm + -20 dBm + 0xEC + + + Neg30dBm + Deprecated enumerator - -40 dBm + 0xE2 + + + Neg40dBm + -40 dBm + 0xD8 + + + + + + + MODE + Data rate and modulation + 0x510 + read-write + + + MODE + Radio data rate and modulation setting. The radio supports frequency-shift keying (FSK) modulation. + 0 + 3 + + + Nrf_1Mbit + 1 Mbit/s Nordic proprietary radio mode + 0 + + + Nrf_2Mbit + 2 Mbit/s Nordic proprietary radio mode + 1 + + + Ble_1Mbit + 1 Mbit/s BLE + 3 + + + Ble_2Mbit + 2 Mbit/s BLE + 4 + + + Ble_LR125Kbit + Long range 125 kbit/s TX, 125 kbit/s and 500 kbit/s RX + 5 + + + Ble_LR500Kbit + Long range 500 kbit/s TX, 125 kbit/s and 500 kbit/s RX + 6 + + + Ieee802154_250Kbit + IEEE 802.15.4-2006 250 kbit/s + 15 + + + + + + + PCNF0 + Packet configuration register 0 + 0x514 + read-write + + + LFLEN + Length on air of LENGTH field in number of bits. + 0 + 3 + + + S0LEN + Length on air of S0 field in number of bytes. + 8 + 8 + + + S1LEN + Length on air of S1 field in number of bits. + 16 + 19 + + + S1INCL + Include or exclude S1 field in RAM + 20 + 20 + + + Automatic + Include S1 field in RAM only if S1LEN &gt; 0 + 0 + + + Include + Always include S1 field in RAM independent of S1LEN + 1 + + + + + CILEN + Length of code indicator - long range + 22 + 23 + + + PLEN + Length of preamble on air. Decision point: TASKS_START task + 24 + 25 + + + 8bit + 8-bit preamble + 0 + + + 16bit + 16-bit preamble + 1 + + + 32bitZero + 32-bit zero preamble - used for IEEE 802.15.4 + 2 + + + LongRange + Preamble - used for BLE long range + 3 + + + + + CRCINC + Indicates if LENGTH field contains CRC or not + 26 + 26 + + + Exclude + LENGTH does not contain CRC + 0 + + + Include + LENGTH includes CRC + 1 + + + + + TERMLEN + Length of TERM field in Long Range operation + 29 + 30 + + + + + PCNF1 + Packet configuration register 1 + 0x518 + read-write + + + MAXLEN + Maximum length of packet payload. If the packet payload is larger than MAXLEN, the radio will truncate the payload to MAXLEN. + 0 + 7 + + + STATLEN + Static length in number of bytes + 8 + 15 + + + BALEN + Base address length in number of bytes + 16 + 18 + + + ENDIAN + On air endianness of packet, this applies to the S0, LENGTH, S1 and the PAYLOAD fields. + 24 + 24 + + + Little + Least significant bit on air first + 0 + + + Big + Most significant bit on air first + 1 + + + + + WHITEEN + Enable or disable packet whitening + 25 + 25 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + BASE0 + Base address 0 + 0x51C + read-write + + + BASE0 + Base address 0 + 0 + 31 + + + + + BASE1 + Base address 1 + 0x520 + read-write + + + BASE1 + Base address 1 + 0 + 31 + + + + + PREFIX0 + Prefixes bytes for logical addresses 0-3 + 0x524 + read-write + + + AP0 + Address prefix 0. + 0 + 7 + + + AP1 + Address prefix 1. + 8 + 15 + + + AP2 + Address prefix 2. + 16 + 23 + + + AP3 + Address prefix 3. + 24 + 31 + + + + + PREFIX1 + Prefixes bytes for logical addresses 4-7 + 0x528 + read-write + + + AP4 + Address prefix 4. + 0 + 7 + + + AP5 + Address prefix 5. + 8 + 15 + + + AP6 + Address prefix 6. + 16 + 23 + + + AP7 + Address prefix 7. + 24 + 31 + + + + + TXADDRESS + Transmit address select + 0x52C + read-write + + + TXADDRESS + Transmit address select + 0 + 2 + + + + + RXADDRESSES + Receive address select + 0x530 + read-write + + + ADDR0 + Enable or disable reception on logical address 0. + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR1 + Enable or disable reception on logical address 1. + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR2 + Enable or disable reception on logical address 2. + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR3 + Enable or disable reception on logical address 3. + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR4 + Enable or disable reception on logical address 4. + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR5 + Enable or disable reception on logical address 5. + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR6 + Enable or disable reception on logical address 6. + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR7 + Enable or disable reception on logical address 7. + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + CRCCNF + CRC configuration + 0x534 + read-write + + + LEN + CRC length in number of bytes. + 0 + 1 + + + Disabled + CRC length is zero and CRC calculation is disabled + 0 + + + One + CRC length is one byte and CRC calculation is enabled + 1 + + + Two + CRC length is two bytes and CRC calculation is enabled + 2 + + + Three + CRC length is three bytes and CRC calculation is enabled + 3 + + + + + SKIPADDR + Include or exclude packet address field out of CRC calculation. + 8 + 9 + + + Include + CRC calculation includes address field + 0 + + + Skip + CRC calculation does not include address field. The CRC calculation will start at the first byte after the address. + 1 + + + Ieee802154 + CRC calculation as per 802.15.4 standard. Starting at first byte after length field. + 2 + + + + + + + CRCPOLY + CRC polynomial + 0x538 + read-write + 0x00000000 + + + CRCPOLY + CRC polynomial + 0 + 23 + + + + + CRCINIT + CRC initial value + 0x53C + read-write + + + CRCINIT + CRC initial value + 0 + 23 + + + + + TIFS + Interframe spacing in us + 0x544 + read-write + + + TIFS + Interframe spacing in us + 0 + 9 + + + + + RSSISAMPLE + RSSI sample + 0x548 + read-only + + + RSSISAMPLE + RSSI sample + 0 + 6 + + + + + STATE + Current radio state + 0x550 + read-only + + + STATE + Current radio state + 0 + 3 + + + Disabled + RADIO is in the Disabled state + 0 + + + RxRu + RADIO is in the RXRU state + 1 + + + RxIdle + RADIO is in the RXIDLE state + 2 + + + Rx + RADIO is in the RX state + 3 + + + RxDisable + RADIO is in the RXDISABLED state + 4 + + + TxRu + RADIO is in the TXRU state + 9 + + + TxIdle + RADIO is in the TXIDLE state + 10 + + + Tx + RADIO is in the TX state + 11 + + + TxDisable + RADIO is in the TXDISABLED state + 12 + + + + + + + DATAWHITEIV + Data whitening initial value + 0x554 + read-write + 0x00000040 + + + DATAWHITEIV + Data whitening initial value. Bit 6 is hard-wired to '1', writing '0' to it has no effect, and it will always be read back and used by the device as '1'. + 0 + 6 + + + + + BCC + Bit counter compare + 0x560 + read-write + + + BCC + Bit counter compare + 0 + 31 + + + + + 0x8 + 0x4 + DAB[%s] + Description collection: Device address base segment n + 0x600 + read-write + + + DAB + Device address base segment n + 0 + 31 + + + + + 0x8 + 0x4 + DAP[%s] + Description collection: Device address prefix n + 0x620 + read-write + + + DAP + Device address prefix n + 0 + 15 + + + + + DACNF + Device address match configuration + 0x640 + read-write + + + ENA0 + Enable or disable device address matching using device address 0 + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA1 + Enable or disable device address matching using device address 1 + 1 + 1 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA2 + Enable or disable device address matching using device address 2 + 2 + 2 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA3 + Enable or disable device address matching using device address 3 + 3 + 3 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA4 + Enable or disable device address matching using device address 4 + 4 + 4 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA5 + Enable or disable device address matching using device address 5 + 5 + 5 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA6 + Enable or disable device address matching using device address 6 + 6 + 6 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA7 + Enable or disable device address matching using device address 7 + 7 + 7 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + TXADD0 + TxAdd for device address 0 + 8 + 8 + + + TXADD1 + TxAdd for device address 1 + 9 + 9 + + + TXADD2 + TxAdd for device address 2 + 10 + 10 + + + TXADD3 + TxAdd for device address 3 + 11 + 11 + + + TXADD4 + TxAdd for device address 4 + 12 + 12 + + + TXADD5 + TxAdd for device address 5 + 13 + 13 + + + TXADD6 + TxAdd for device address 6 + 14 + 14 + + + TXADD7 + TxAdd for device address 7 + 15 + 15 + + + + + MHRMATCHCONF + Search pattern configuration + 0x644 + read-write + + + MHRMATCHCONF + Search pattern configuration + 0 + 31 + + + + + MHRMATCHMAS + Pattern mask + 0x648 + read-write + + + MHRMATCHMAS + Pattern mask + 0 + 31 + + + + + MODECNF0 + Radio mode configuration register 0 + 0x650 + read-write + 0x00000200 + + + RU + Radio ramp-up time + 0 + 0 + + + Default + Default ramp-up time (tRXEN and tTXEN), compatible with firmware written for nRF51 + 0 + + + Fast + Fast ramp-up (tRXEN,FAST and tTXEN,FAST), see electrical specification for more information + 1 + + + + + DTX + Default TX value + 8 + 9 + + + B1 + Transmit '1' + 0 + + + B0 + Transmit '0' + 1 + + + Center + Transmit center frequency + 2 + + + + + + + SFD + IEEE 802.15.4 start of frame delimiter + 0x660 + read-write + 0x000000A7 + + + SFD + IEEE 802.15.4 start of frame delimiter + 0 + 7 + + + + + EDCNT + IEEE 802.15.4 energy detect loop count + 0x664 + read-write + 0x00000000 + + + EDCNT + IEEE 802.15.4 energy detect loop count + 0 + 20 + + + + + EDSAMPLE + IEEE 802.15.4 energy detect level + 0x668 + read-write + 0x00000000 + + + EDLVL + IEEE 802.15.4 energy detect level + 0 + 7 + + + + + CCACTRL + IEEE 802.15.4 clear channel assessment control + 0x66C + read-write + 0x052D0000 + + + CCAMODE + CCA mode of operation + 0 + 2 + + + EdMode + Energy above threshold + 0 + + + CarrierMode + Carrier seen + 1 + + + CarrierAndEdMode + Energy above threshold AND carrier seen + 2 + + + CarrierOrEdMode + Energy above threshold OR carrier seen + 3 + + + EdModeTest1 + Energy above threshold test mode that will abort when first ED measurement over threshold is seen. No averaging. + 4 + + + + + CCAEDTHRES + CCA energy busy threshold. Used in all the CCA modes except CarrierMode. + 8 + 15 + + + CCACORRTHRES + CCA correlator busy threshold. Only relevant to CarrierMode, CarrierAndEdMode and CarrierOrEdMode. + 16 + 23 + + + CCACORRCNT + Limit for occurances above CCACORRTHRES. When not equal to zero the corrolator based signal detect is enabled. + 24 + 31 + + + + + POWER + Peripheral power control + 0xFFC + read-write + 0x00000001 + + + POWER + Peripheral power control. The peripheral and its registers will be reset to its initial state by switching the peripheral off and then back on again. + 0 + 0 + + + Disabled + Peripheral is powered off + 0 + + + Enabled + Peripheral is powered on + 1 + + + + + + + + + UART0 + Universal Asynchronous Receiver/Transmitter + 0x40002000 + UART + + 0 + 0x1000 + registers + + + UARTE0_UART0 + 2 + + UART + 0x20 + + + TASKS_STARTRX + Start UART receiver + 0x000 + write-only + + + TASKS_STARTRX + Start UART receiver + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOPRX + Stop UART receiver + 0x004 + write-only + + + TASKS_STOPRX + Stop UART receiver + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STARTTX + Start UART transmitter + 0x008 + write-only + + + TASKS_STARTTX + Start UART transmitter + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOPTX + Stop UART transmitter + 0x00C + write-only + + + TASKS_STOPTX + Stop UART transmitter + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_SUSPEND + Suspend UART + 0x01C + write-only + + + TASKS_SUSPEND + Suspend UART + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_CTS + CTS is activated (set low). Clear To Send. + 0x100 + read-write + + + EVENTS_CTS + CTS is activated (set low). Clear To Send. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_NCTS + CTS is deactivated (set high). Not Clear To Send. + 0x104 + read-write + + + EVENTS_NCTS + CTS is deactivated (set high). Not Clear To Send. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RXDRDY + Data received in RXD + 0x108 + read-write + + + EVENTS_RXDRDY + Data received in RXD + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_TXDRDY + Data sent from TXD + 0x11C + read-write + + + EVENTS_TXDRDY + Data sent from TXD + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ERROR + Error detected + 0x124 + read-write + + + EVENTS_ERROR + Error detected + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RXTO + Receiver timeout + 0x144 + read-write + + + EVENTS_RXTO + Receiver timeout + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + CTS_STARTRX + Shortcut between event CTS and task STARTRX + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + NCTS_STOPRX + Shortcut between event NCTS and task STOPRX + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + CTS + Write '1' to enable interrupt for event CTS + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + NCTS + Write '1' to enable interrupt for event NCTS + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXDRDY + Write '1' to enable interrupt for event RXDRDY + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXDRDY + Write '1' to enable interrupt for event TXDRDY + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for event ERROR + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXTO + Write '1' to enable interrupt for event RXTO + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + CTS + Write '1' to disable interrupt for event CTS + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + NCTS + Write '1' to disable interrupt for event NCTS + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXDRDY + Write '1' to disable interrupt for event RXDRDY + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXDRDY + Write '1' to disable interrupt for event TXDRDY + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for event ERROR + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXTO + Write '1' to disable interrupt for event RXTO + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x480 + read-write + oneToClear + + + OVERRUN + Overrun error + 0 + 0 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + PARITY + Parity error + 1 + 1 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + FRAMING + Framing error occurred + 2 + 2 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + BREAK + Break condition + 3 + 3 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + + + ENABLE + Enable UART + 0x500 + read-write + + + ENABLE + Enable or disable UART + 0 + 3 + + + Disabled + Disable UART + 0 + + + Enabled + Enable UART + 4 + + + + + + + PSEL + Unspecified + UART_PSEL + read-write + 0x508 + + RTS + Pin select for RTS + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + TXD + Pin select for TXD + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + CTS + Pin select for CTS + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + RXD + Pin select for RXD + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + RXD + RXD register + 0x518 + read-only + modifyExternal + + + RXD + RX data received in previous transfers, double buffered + 0 + 7 + + + + + TXD + TXD register + 0x51C + write-only + + + TXD + TX data to be transferred + 0 + 7 + + + + + BAUDRATE + Baud rate. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + BAUDRATE + Baud rate + 0 + 31 + + + Baud1200 + 1200 baud (actual rate: 1205) + 0x0004F000 + + + Baud2400 + 2400 baud (actual rate: 2396) + 0x0009D000 + + + Baud4800 + 4800 baud (actual rate: 4808) + 0x0013B000 + + + Baud9600 + 9600 baud (actual rate: 9598) + 0x00275000 + + + Baud14400 + 14400 baud (actual rate: 14414) + 0x003B0000 + + + Baud19200 + 19200 baud (actual rate: 19208) + 0x004EA000 + + + Baud28800 + 28800 baud (actual rate: 28829) + 0x0075F000 + + + Baud31250 + 31250 baud + 0x00800000 + + + Baud38400 + 38400 baud (actual rate: 38462) + 0x009D5000 + + + Baud56000 + 56000 baud (actual rate: 55944) + 0x00E50000 + + + Baud57600 + 57600 baud (actual rate: 57762) + 0x00EBF000 + + + Baud76800 + 76800 baud (actual rate: 76923) + 0x013A9000 + + + Baud115200 + 115200 baud (actual rate: 115942) + 0x01D7E000 + + + Baud230400 + 230400 baud (actual rate: 231884) + 0x03AFB000 + + + Baud250000 + 250000 baud + 0x04000000 + + + Baud460800 + 460800 baud (actual rate: 470588) + 0x075F7000 + + + Baud921600 + 921600 baud (actual rate: 941176) + 0x0EBED000 + + + Baud1M + 1Mega baud + 0x10000000 + + + + + + + CONFIG + Configuration of parity and hardware flow control + 0x56C + read-write + + + HWFC + Hardware flow control + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + PARITY + Parity + 1 + 3 + + + Excluded + Exclude parity bit + 0x0 + + + Included + Include parity bit + 0x7 + + + + + STOP + Stop bits + 4 + 4 + + + One + One stop bit + 0 + + + Two + Two stop bits + 1 + + + + + + + + + UARTE0 + UART with EasyDMA 0 + 0x40002000 + UART0 + UARTE + + 0 + 0x1000 + registers + + + UARTE0_UART0 + 2 + + UARTE + 0x20 + + + TASKS_STARTRX + Start UART receiver + 0x000 + write-only + + + TASKS_STARTRX + Start UART receiver + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOPRX + Stop UART receiver + 0x004 + write-only + + + TASKS_STOPRX + Stop UART receiver + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STARTTX + Start UART transmitter + 0x008 + write-only + + + TASKS_STARTTX + Start UART transmitter + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOPTX + Stop UART transmitter + 0x00C + write-only + + + TASKS_STOPTX + Stop UART transmitter + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_FLUSHRX + Flush RX FIFO into RX buffer + 0x02C + write-only + + + TASKS_FLUSHRX + Flush RX FIFO into RX buffer + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_CTS + CTS is activated (set low). Clear To Send. + 0x100 + read-write + + + EVENTS_CTS + CTS is activated (set low). Clear To Send. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_NCTS + CTS is deactivated (set high). Not Clear To Send. + 0x104 + read-write + + + EVENTS_NCTS + CTS is deactivated (set high). Not Clear To Send. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RXDRDY + Data received in RXD (but potentially not yet transferred to Data RAM) + 0x108 + read-write + + + EVENTS_RXDRDY + Data received in RXD (but potentially not yet transferred to Data RAM) + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ENDRX + Receive buffer is filled up + 0x110 + read-write + + + EVENTS_ENDRX + Receive buffer is filled up + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_TXDRDY + Data sent from TXD + 0x11C + read-write + + + EVENTS_TXDRDY + Data sent from TXD + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ENDTX + Last TX byte transmitted + 0x120 + read-write + + + EVENTS_ENDTX + Last TX byte transmitted + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ERROR + Error detected + 0x124 + read-write + + + EVENTS_ERROR + Error detected + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RXTO + Receiver timeout + 0x144 + read-write + + + EVENTS_RXTO + Receiver timeout + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RXSTARTED + UART receiver has started + 0x14C + read-write + + + EVENTS_RXSTARTED + UART receiver has started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_TXSTARTED + UART transmitter has started + 0x150 + read-write + + + EVENTS_TXSTARTED + UART transmitter has started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_TXSTOPPED + Transmitter stopped + 0x158 + read-write + + + EVENTS_TXSTOPPED + Transmitter stopped + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + ENDRX_STARTRX + Shortcut between event ENDRX and task STARTRX + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ENDRX_STOPRX + Shortcut between event ENDRX and task STOPRX + 6 + 6 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + CTS + Enable or disable interrupt for event CTS + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + NCTS + Enable or disable interrupt for event NCTS + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXDRDY + Enable or disable interrupt for event RXDRDY + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDRX + Enable or disable interrupt for event ENDRX + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXDRDY + Enable or disable interrupt for event TXDRDY + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDTX + Enable or disable interrupt for event ENDTX + 8 + 8 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ERROR + Enable or disable interrupt for event ERROR + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXTO + Enable or disable interrupt for event RXTO + 17 + 17 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXSTARTED + Enable or disable interrupt for event RXSTARTED + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXSTARTED + Enable or disable interrupt for event TXSTARTED + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXSTOPPED + Enable or disable interrupt for event TXSTOPPED + 22 + 22 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + CTS + Write '1' to enable interrupt for event CTS + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + NCTS + Write '1' to enable interrupt for event NCTS + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXDRDY + Write '1' to enable interrupt for event RXDRDY + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDRX + Write '1' to enable interrupt for event ENDRX + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXDRDY + Write '1' to enable interrupt for event TXDRDY + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDTX + Write '1' to enable interrupt for event ENDTX + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for event ERROR + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXTO + Write '1' to enable interrupt for event RXTO + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXSTARTED + Write '1' to enable interrupt for event RXSTARTED + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXSTARTED + Write '1' to enable interrupt for event TXSTARTED + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXSTOPPED + Write '1' to enable interrupt for event TXSTOPPED + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + CTS + Write '1' to disable interrupt for event CTS + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + NCTS + Write '1' to disable interrupt for event NCTS + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXDRDY + Write '1' to disable interrupt for event RXDRDY + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDRX + Write '1' to disable interrupt for event ENDRX + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXDRDY + Write '1' to disable interrupt for event TXDRDY + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDTX + Write '1' to disable interrupt for event ENDTX + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for event ERROR + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXTO + Write '1' to disable interrupt for event RXTO + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXSTARTED + Write '1' to disable interrupt for event RXSTARTED + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXSTARTED + Write '1' to disable interrupt for event TXSTARTED + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXSTOPPED + Write '1' to disable interrupt for event TXSTOPPED + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source This register is read/write one to clear. + 0x480 + read-write + oneToClear + + + OVERRUN + Overrun error + 0 + 0 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + PARITY + Parity error + 1 + 1 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + FRAMING + Framing error occurred + 2 + 2 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + BREAK + Break condition + 3 + 3 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + + + ENABLE + Enable UART + 0x500 + read-write + + + ENABLE + Enable or disable UARTE + 0 + 3 + + + Disabled + Disable UARTE + 0 + + + Enabled + Enable UARTE + 8 + + + + + + + PSEL + Unspecified + UARTE_PSEL + read-write + 0x508 + + RTS + Pin select for RTS signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + TXD + Pin select for TXD signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + CTS + Pin select for CTS signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + RXD + Pin select for RXD signal + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + BAUDRATE + Baud rate. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + BAUDRATE + Baud rate + 0 + 31 + + + Baud1200 + 1200 baud (actual rate: 1205) + 0x0004F000 + + + Baud2400 + 2400 baud (actual rate: 2396) + 0x0009D000 + + + Baud4800 + 4800 baud (actual rate: 4808) + 0x0013B000 + + + Baud9600 + 9600 baud (actual rate: 9598) + 0x00275000 + + + Baud14400 + 14400 baud (actual rate: 14401) + 0x003AF000 + + + Baud19200 + 19200 baud (actual rate: 19208) + 0x004EA000 + + + Baud28800 + 28800 baud (actual rate: 28777) + 0x0075C000 + + + Baud31250 + 31250 baud + 0x00800000 + + + Baud38400 + 38400 baud (actual rate: 38369) + 0x009D0000 + + + Baud56000 + 56000 baud (actual rate: 55944) + 0x00E50000 + + + Baud57600 + 57600 baud (actual rate: 57554) + 0x00EB0000 + + + Baud76800 + 76800 baud (actual rate: 76923) + 0x013A9000 + + + Baud115200 + 115200 baud (actual rate: 115108) + 0x01D60000 + + + Baud230400 + 230400 baud (actual rate: 231884) + 0x03B00000 + + + Baud250000 + 250000 baud + 0x04000000 + + + Baud460800 + 460800 baud (actual rate: 457143) + 0x07400000 + + + Baud921600 + 921600 baud (actual rate: 941176) + 0x0F000000 + + + Baud1M + 1 megabaud + 0x10000000 + + + + + + + RXD + RXD EasyDMA channel + UARTE_RXD + read-write + 0x534 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in receive buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in receive buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 15 + + + + + + TXD + TXD EasyDMA channel + UARTE_TXD + read-write + 0x544 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in transmit buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in transmit buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 15 + + + + + + CONFIG + Configuration of parity and hardware flow control + 0x56C + read-write + + + HWFC + Hardware flow control + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + PARITY + Parity + 1 + 3 + + + Excluded + Exclude parity bit + 0x0 + + + Included + Include even parity bit + 0x7 + + + + + STOP + Stop bits + 4 + 4 + + + One + One stop bit + 0 + + + Two + Two stop bits + 1 + + + + + + + + + SPI0 + Serial Peripheral Interface 0 + 0x40003000 + SPI + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + SPI + 0x20 + + + EVENTS_READY + TXD byte sent and RXD byte received + 0x108 + read-write + + + EVENTS_READY + TXD byte sent and RXD byte received + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to enable interrupt for event READY + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to disable interrupt for event READY + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + Enable SPI + 0x500 + read-write + + + ENABLE + Enable or disable SPI + 0 + 3 + + + Disabled + Disable SPI + 0 + + + Enabled + Enable SPI + 1 + + + + + + + PSEL + Unspecified + SPI_PSEL + read-write + 0x508 + + SCK + Pin select for SCK + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MOSI + Pin select for MOSI signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MISO + Pin select for MISO signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + RXD + RXD register + 0x518 + read-only + modifyExternal + + + RXD + RX data received. Double buffered + 0 + 7 + + + + + TXD + TXD register + 0x51C + read-write + + + TXD + TX data to send. Double buffered. + 0 + 7 + + + + + FREQUENCY + SPI frequency. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + FREQUENCY + SPI master data rate + 0 + 31 + + + K125 + 125 kbps + 0x02000000 + + + K250 + 250 kbps + 0x04000000 + + + K500 + 500 kbps + 0x08000000 + + + M1 + 1 Mbps + 0x10000000 + + + M2 + 2 Mbps + 0x20000000 + + + M4 + 4 Mbps + 0x40000000 + + + M8 + 8 Mbps + 0x80000000 + + + + + + + CONFIG + Configuration register + 0x554 + read-write + + + ORDER + Bit order + 0 + 0 + + + MsbFirst + Most significant bit shifted out first + 0 + + + LsbFirst + Least significant bit shifted out first + 1 + + + + + CPHA + Serial clock (SCK) phase + 1 + 1 + + + Leading + Sample on leading edge of clock, shift serial data on trailing edge + 0 + + + Trailing + Sample on trailing edge of clock, shift serial data on leading edge + 1 + + + + + CPOL + Serial clock (SCK) polarity + 2 + 2 + + + ActiveHigh + Active high + 0 + + + ActiveLow + Active low + 1 + + + + + + + + + SPIM0 + Serial Peripheral Interface Master with EasyDMA 0 + 0x40003000 + SPI0 + SPIM + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + SPIM + 0x20 + + + TASKS_START + Start SPI transaction + 0x010 + write-only + + + TASKS_START + Start SPI transaction + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stop SPI transaction + 0x014 + write-only + + + TASKS_STOP + Stop SPI transaction + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_SUSPEND + Suspend SPI transaction + 0x01C + write-only + + + TASKS_SUSPEND + Suspend SPI transaction + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_RESUME + Resume SPI transaction + 0x020 + write-only + + + TASKS_RESUME + Resume SPI transaction + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_STOPPED + SPI transaction has stopped + 0x104 + read-write + + + EVENTS_STOPPED + SPI transaction has stopped + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ENDRX + End of RXD buffer reached + 0x110 + read-write + + + EVENTS_ENDRX + End of RXD buffer reached + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_END + End of RXD buffer and TXD buffer reached + 0x118 + read-write + + + EVENTS_END + End of RXD buffer and TXD buffer reached + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ENDTX + End of TXD buffer reached + 0x120 + read-write + + + EVENTS_ENDTX + End of TXD buffer reached + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_STARTED + Transaction started + 0x14C + read-write + + + EVENTS_STARTED + Transaction started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + END_START + Shortcut between event END and task START + 17 + 17 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to enable interrupt for event STOPPED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDRX + Write '1' to enable interrupt for event ENDRX + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + END + Write '1' to enable interrupt for event END + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDTX + Write '1' to enable interrupt for event ENDTX + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STARTED + Write '1' to enable interrupt for event STARTED + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to disable interrupt for event STOPPED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDRX + Write '1' to disable interrupt for event ENDRX + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + END + Write '1' to disable interrupt for event END + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDTX + Write '1' to disable interrupt for event ENDTX + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STARTED + Write '1' to disable interrupt for event STARTED + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + STALLSTAT + Stall status for EasyDMA RAM accesses. The fields in this register are set to STALL by hardware whenever a stall occurs and can be cleared (set to NOSTALL) by the CPU. + 0x400 + read-write + 0x00000000 + + + TX + Stall status for EasyDMA RAM reads + 0 + 0 + + + NOSTALL + No stall + 0 + + + STALL + A stall has occurred + 1 + + + + + RX + Stall status for EasyDMA RAM writes + 1 + 1 + + + NOSTALL + No stall + 0 + + + STALL + A stall has occurred + 1 + + + + + + + ENABLE + Enable SPIM + 0x500 + read-write + + + ENABLE + Enable or disable SPIM + 0 + 3 + + + Disabled + Disable SPIM + 0 + + + Enabled + Enable SPIM + 7 + + + + + + + PSEL + Unspecified + SPIM_PSEL + read-write + 0x508 + + SCK + Pin select for SCK + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MOSI + Pin select for MOSI signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MISO + Pin select for MISO signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + CSN + Pin select for CSN + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + FREQUENCY + SPI frequency. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + FREQUENCY + SPI master data rate + 0 + 31 + + + K125 + 125 kbps + 0x02000000 + + + K250 + 250 kbps + 0x04000000 + + + K500 + 500 kbps + 0x08000000 + + + M1 + 1 Mbps + 0x10000000 + + + M2 + 2 Mbps + 0x20000000 + + + M4 + 4 Mbps + 0x40000000 + + + M8 + 8 Mbps + 0x80000000 + + + M16 + 16 Mbps + 0x0A000000 + + + M32 + 32 Mbps + 0x14000000 + + + + + + + RXD + RXD EasyDMA channel + SPIM_RXD + read-write + 0x534 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in receive buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in receive buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 15 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 1 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + TXD + TXD EasyDMA channel + SPIM_TXD + read-write + 0x544 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Number of bytes in transmit buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in transmit buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 15 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 1 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + CONFIG + Configuration register + 0x554 + read-write + + + ORDER + Bit order + 0 + 0 + + + MsbFirst + Most significant bit shifted out first + 0 + + + LsbFirst + Least significant bit shifted out first + 1 + + + + + CPHA + Serial clock (SCK) phase + 1 + 1 + + + Leading + Sample on leading edge of clock, shift serial data on trailing edge + 0 + + + Trailing + Sample on trailing edge of clock, shift serial data on leading edge + 1 + + + + + CPOL + Serial clock (SCK) polarity + 2 + 2 + + + ActiveHigh + Active high + 0 + + + ActiveLow + Active low + 1 + + + + + + + IFTIMING + Unspecified + SPIM_IFTIMING + read-write + 0x560 + + RXDELAY + Sample delay for input serial data on MISO + 0x000 + read-write + 0x00000002 + + + RXDELAY + Sample delay for input serial data on MISO. The value specifies the number of 64 MHz clock cycles (15.625 ns) delay from the the sampling edge of SCK (leading edge for CONFIG.CPHA = 0, trailing edge for CONFIG.CPHA = 1) until the input serial data is sampled. As en example, if RXDELAY = 0 and CONFIG.CPHA = 0, the input serial data is sampled on the rising edge of SCK. + 0 + 2 + + + + + CSNDUR + Minimum duration between edge of CSN and edge of SCK and minimum duration CSN must stay high between transactions + 0x004 + read-write + 0x00000002 + + + CSNDUR + Minimum duration between edge of CSN and edge of SCK and minimum duration CSN must stay high between transactions. The value is specified in number of 64 MHz clock cycles (15.625 ns). + 0 + 7 + + + + + + CSNPOL + Polarity of CSN output + 0x568 + read-write + 0x00000000 + + + CSNPOL + Polarity of CSN output + 0 + 0 + + + LOW + Active low (idle state high) + 0 + + + HIGH + Active high (idle state low) + 1 + + + + + + + PSELDCX + Pin select for DCX signal + 0x56C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + DCXCNT + DCX configuration + 0x570 + read-write + + + DCXCNT + This register specifies the number of command bytes preceding the data bytes. The PSEL.DCX line will be low during transmission of command bytes and high during transmission of data bytes. Value 0xF indicates that all bytes are command bytes. + 0 + 3 + + + + + ORC + Byte transmitted after TXD.MAXCNT bytes have been transmitted in the case when RXD.MAXCNT is greater than TXD.MAXCNT + 0x5C0 + read-write + + + ORC + Byte transmitted after TXD.MAXCNT bytes have been transmitted in the case when RXD.MAXCNT is greater than TXD.MAXCNT. + 0 + 7 + + + + + + + SPIS0 + SPI Slave 0 + 0x40003000 + SPI0 + SPIS + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + SPIS + 0x20 + + + TASKS_ACQUIRE + Acquire SPI semaphore + 0x024 + write-only + + + TASKS_ACQUIRE + Acquire SPI semaphore + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_RELEASE + Release SPI semaphore, enabling the SPI slave to acquire it + 0x028 + write-only + + + TASKS_RELEASE + Release SPI semaphore, enabling the SPI slave to acquire it + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_END + Granted transaction completed + 0x104 + read-write + + + EVENTS_END + Granted transaction completed + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ENDRX + End of RXD buffer reached + 0x110 + read-write + + + EVENTS_ENDRX + End of RXD buffer reached + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ACQUIRED + Semaphore acquired + 0x128 + read-write + + + EVENTS_ACQUIRED + Semaphore acquired + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + END_ACQUIRE + Shortcut between event END and task ACQUIRE + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + END + Write '1' to enable interrupt for event END + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDRX + Write '1' to enable interrupt for event ENDRX + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ACQUIRED + Write '1' to enable interrupt for event ACQUIRED + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + END + Write '1' to disable interrupt for event END + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDRX + Write '1' to disable interrupt for event ENDRX + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ACQUIRED + Write '1' to disable interrupt for event ACQUIRED + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + SEMSTAT + Semaphore status register + 0x400 + read-only + 0x00000001 + + + SEMSTAT + Semaphore status + 0 + 1 + + + Free + Semaphore is free + 0 + + + CPU + Semaphore is assigned to CPU + 1 + + + SPIS + Semaphore is assigned to SPI slave + 2 + + + CPUPending + Semaphore is assigned to SPI but a handover to the CPU is pending + 3 + + + + + + + STATUS + Status from last transaction + 0x440 + read-write + + + OVERREAD + TX buffer over-read detected, and prevented + 0 + 0 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + write + + Clear + Write: clear error on writing '1' + 1 + + + + + OVERFLOW + RX buffer overflow detected, and prevented + 1 + 1 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + write + + Clear + Write: clear error on writing '1' + 1 + + + + + + + ENABLE + Enable SPI slave + 0x500 + read-write + + + ENABLE + Enable or disable SPI slave + 0 + 3 + + + Disabled + Disable SPI slave + 0 + + + Enabled + Enable SPI slave + 2 + + + + + + + PSEL + Unspecified + SPIS_PSEL + read-write + 0x508 + + SCK + Pin select for SCK + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MISO + Pin select for MISO signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MOSI + Pin select for MOSI signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + CSN + Pin select for CSN signal + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + RXD + Unspecified + SPIS_RXD + read-write + 0x534 + + PTR + RXD data pointer + 0x000 + read-write + + + PTR + RXD data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in receive buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in receive buffer + 0 + 15 + + + + + AMOUNT + Number of bytes received in last granted transaction + 0x008 + read-only + + + AMOUNT + Number of bytes received in the last granted transaction + 0 + 15 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 1 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + TXD + Unspecified + SPIS_TXD + read-write + 0x544 + + PTR + TXD data pointer + 0x000 + read-write + + + PTR + TXD data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in transmit buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in transmit buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transmitted in last granted transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transmitted in last granted transaction + 0 + 15 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 1 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + CONFIG + Configuration register + 0x554 + read-write + + + ORDER + Bit order + 0 + 0 + + + MsbFirst + Most significant bit shifted out first + 0 + + + LsbFirst + Least significant bit shifted out first + 1 + + + + + CPHA + Serial clock (SCK) phase + 1 + 1 + + + Leading + Sample on leading edge of clock, shift serial data on trailing edge + 0 + + + Trailing + Sample on trailing edge of clock, shift serial data on leading edge + 1 + + + + + CPOL + Serial clock (SCK) polarity + 2 + 2 + + + ActiveHigh + Active high + 0 + + + ActiveLow + Active low + 1 + + + + + + + DEF + Default character. Character clocked out in case of an ignored transaction. + 0x55C + read-write + + + DEF + Default character. Character clocked out in case of an ignored transaction. + 0 + 7 + + + + + ORC + Over-read character + 0x5C0 + read-write + + + ORC + Over-read character. Character clocked out after an over-read of the transmit buffer. + 0 + 7 + + + + + + + TWI0 + I2C compatible Two-Wire Interface 0 + 0x40003000 + SPI0 + TWI + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + TWI + 0x20 + + + TASKS_STARTRX + Start TWI receive sequence + 0x000 + write-only + + + TASKS_STARTRX + Start TWI receive sequence + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STARTTX + Start TWI transmit sequence + 0x008 + write-only + + + TASKS_STARTTX + Start TWI transmit sequence + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stop TWI transaction + 0x014 + write-only + + + TASKS_STOP + Stop TWI transaction + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_SUSPEND + Suspend TWI transaction + 0x01C + write-only + + + TASKS_SUSPEND + Suspend TWI transaction + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_RESUME + Resume TWI transaction + 0x020 + write-only + + + TASKS_RESUME + Resume TWI transaction + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_STOPPED + TWI stopped + 0x104 + read-write + + + EVENTS_STOPPED + TWI stopped + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RXDREADY + TWI RXD byte received + 0x108 + read-write + + + EVENTS_RXDREADY + TWI RXD byte received + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_TXDSENT + TWI TXD byte sent + 0x11C + read-write + + + EVENTS_TXDSENT + TWI TXD byte sent + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ERROR + TWI error + 0x124 + read-write + + + EVENTS_ERROR + TWI error + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_BB + TWI byte boundary, generated before each byte that is sent or received + 0x138 + read-write + + + EVENTS_BB + TWI byte boundary, generated before each byte that is sent or received + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_SUSPENDED + TWI entered the suspended state + 0x148 + read-write + + + EVENTS_SUSPENDED + TWI entered the suspended state + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + BB_SUSPEND + Shortcut between event BB and task SUSPEND + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + BB_STOP + Shortcut between event BB and task STOP + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to enable interrupt for event STOPPED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXDREADY + Write '1' to enable interrupt for event RXDREADY + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXDSENT + Write '1' to enable interrupt for event TXDSENT + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for event ERROR + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + BB + Write '1' to enable interrupt for event BB + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SUSPENDED + Write '1' to enable interrupt for event SUSPENDED + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to disable interrupt for event STOPPED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXDREADY + Write '1' to disable interrupt for event RXDREADY + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXDSENT + Write '1' to disable interrupt for event TXDSENT + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for event ERROR + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + BB + Write '1' to disable interrupt for event BB + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SUSPENDED + Write '1' to disable interrupt for event SUSPENDED + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x4C4 + read-write + oneToClear + + + OVERRUN + Overrun error + 0 + 0 + + read + + NotPresent + Read: no overrun occured + 0 + + + Present + Read: overrun occured + 1 + + + + + ANACK + NACK received after sending the address (write '1' to clear) + 1 + 1 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + DNACK + NACK received after sending a data byte (write '1' to clear) + 2 + 2 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + + + ENABLE + Enable TWI + 0x500 + read-write + + + ENABLE + Enable or disable TWI + 0 + 3 + + + Disabled + Disable TWI + 0 + + + Enabled + Enable TWI + 5 + + + + + + + PSEL + Unspecified + TWI_PSEL + read-write + 0x508 + + SCL + Pin select for SCL + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDA + Pin select for SDA + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + RXD + RXD register + 0x518 + read-only + modifyExternal + + + RXD + RXD register + 0 + 7 + + + + + TXD + TXD register + 0x51C + read-write + + + TXD + TXD register + 0 + 7 + + + + + FREQUENCY + TWI frequency. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + FREQUENCY + TWI master clock frequency + 0 + 31 + + + K100 + 100 kbps + 0x01980000 + + + K250 + 250 kbps + 0x04000000 + + + K400 + 400 kbps (actual rate 410.256 kbps) + 0x06680000 + + + + + + + ADDRESS + Address used in the TWI transfer + 0x588 + read-write + + + ADDRESS + Address used in the TWI transfer + 0 + 6 + + + + + + + TWIM0 + I2C compatible Two-Wire Master Interface with EasyDMA 0 + 0x40003000 + SPI0 + TWIM + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + TWIM + 0x20 + + + TASKS_STARTRX + Start TWI receive sequence + 0x000 + write-only + + + TASKS_STARTRX + Start TWI receive sequence + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STARTTX + Start TWI transmit sequence + 0x008 + write-only + + + TASKS_STARTTX + Start TWI transmit sequence + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stop TWI transaction. Must be issued while the TWI master is not suspended. + 0x014 + write-only + + + TASKS_STOP + Stop TWI transaction. Must be issued while the TWI master is not suspended. + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_SUSPEND + Suspend TWI transaction + 0x01C + write-only + + + TASKS_SUSPEND + Suspend TWI transaction + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_RESUME + Resume TWI transaction + 0x020 + write-only + + + TASKS_RESUME + Resume TWI transaction + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_STOPPED + TWI stopped + 0x104 + read-write + + + EVENTS_STOPPED + TWI stopped + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ERROR + TWI error + 0x124 + read-write + + + EVENTS_ERROR + TWI error + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_SUSPENDED + SUSPEND task has been issued, TWI traffic is now suspended. + 0x148 + read-write + + + EVENTS_SUSPENDED + SUSPEND task has been issued, TWI traffic is now suspended. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RXSTARTED + Receive sequence started + 0x14C + read-write + + + EVENTS_RXSTARTED + Receive sequence started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_TXSTARTED + Transmit sequence started + 0x150 + read-write + + + EVENTS_TXSTARTED + Transmit sequence started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_LASTRX + Byte boundary, starting to receive the last byte + 0x15C + read-write + + + EVENTS_LASTRX + Byte boundary, starting to receive the last byte + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_LASTTX + Byte boundary, starting to transmit the last byte + 0x160 + read-write + + + EVENTS_LASTTX + Byte boundary, starting to transmit the last byte + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + LASTTX_STARTRX + Shortcut between event LASTTX and task STARTRX + 7 + 7 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTTX_SUSPEND + Shortcut between event LASTTX and task SUSPEND + 8 + 8 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTTX_STOP + Shortcut between event LASTTX and task STOP + 9 + 9 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTRX_STARTTX + Shortcut between event LASTRX and task STARTTX + 10 + 10 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTRX_SUSPEND + Shortcut between event LASTRX and task SUSPEND + 11 + 11 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTRX_STOP + Shortcut between event LASTRX and task STOP + 12 + 12 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STOPPED + Enable or disable interrupt for event STOPPED + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ERROR + Enable or disable interrupt for event ERROR + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SUSPENDED + Enable or disable interrupt for event SUSPENDED + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXSTARTED + Enable or disable interrupt for event RXSTARTED + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXSTARTED + Enable or disable interrupt for event TXSTARTED + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + LASTRX + Enable or disable interrupt for event LASTRX + 23 + 23 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + LASTTX + Enable or disable interrupt for event LASTTX + 24 + 24 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to enable interrupt for event STOPPED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for event ERROR + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SUSPENDED + Write '1' to enable interrupt for event SUSPENDED + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXSTARTED + Write '1' to enable interrupt for event RXSTARTED + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXSTARTED + Write '1' to enable interrupt for event TXSTARTED + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + LASTRX + Write '1' to enable interrupt for event LASTRX + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + LASTTX + Write '1' to enable interrupt for event LASTTX + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to disable interrupt for event STOPPED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for event ERROR + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SUSPENDED + Write '1' to disable interrupt for event SUSPENDED + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXSTARTED + Write '1' to disable interrupt for event RXSTARTED + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXSTARTED + Write '1' to disable interrupt for event TXSTARTED + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + LASTRX + Write '1' to disable interrupt for event LASTRX + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + LASTTX + Write '1' to disable interrupt for event LASTTX + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x4C4 + read-write + oneToClear + + + OVERRUN + Overrun error + 0 + 0 + + + NotReceived + Error did not occur + 0 + + + Received + Error occurred + 1 + + + + + ANACK + NACK received after sending the address (write '1' to clear) + 1 + 1 + + + NotReceived + Error did not occur + 0 + + + Received + Error occurred + 1 + + + + + DNACK + NACK received after sending a data byte (write '1' to clear) + 2 + 2 + + + NotReceived + Error did not occur + 0 + + + Received + Error occurred + 1 + + + + + + + ENABLE + Enable TWIM + 0x500 + read-write + + + ENABLE + Enable or disable TWIM + 0 + 3 + + + Disabled + Disable TWIM + 0 + + + Enabled + Enable TWIM + 6 + + + + + + + PSEL + Unspecified + TWIM_PSEL + read-write + 0x508 + + SCL + Pin select for SCL signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDA + Pin select for SDA signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + FREQUENCY + TWI frequency. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + FREQUENCY + TWI master clock frequency + 0 + 31 + + + K100 + 100 kbps + 0x01980000 + + + K250 + 250 kbps + 0x04000000 + + + K400 + 400 kbps + 0x06400000 + + + + + + + RXD + RXD EasyDMA channel + TWIM_RXD + read-write + 0x534 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in receive buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in receive buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte. + 0 + 15 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 2 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + TXD + TXD EasyDMA channel + TWIM_TXD + read-write + 0x544 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in transmit buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in transmit buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte. + 0 + 15 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 2 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + ADDRESS + Address used in the TWI transfer + 0x588 + read-write + + + ADDRESS + Address used in the TWI transfer + 0 + 6 + + + + + + + TWIS0 + I2C compatible Two-Wire Slave Interface with EasyDMA 0 + 0x40003000 + SPI0 + TWIS + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + TWIS + 0x20 + + + TASKS_STOP + Stop TWI transaction + 0x014 + write-only + + + TASKS_STOP + Stop TWI transaction + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_SUSPEND + Suspend TWI transaction + 0x01C + write-only + + + TASKS_SUSPEND + Suspend TWI transaction + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_RESUME + Resume TWI transaction + 0x020 + write-only + + + TASKS_RESUME + Resume TWI transaction + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_PREPARERX + Prepare the TWI slave to respond to a write command + 0x030 + write-only + + + TASKS_PREPARERX + Prepare the TWI slave to respond to a write command + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_PREPARETX + Prepare the TWI slave to respond to a read command + 0x034 + write-only + + + TASKS_PREPARETX + Prepare the TWI slave to respond to a read command + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_STOPPED + TWI stopped + 0x104 + read-write + + + EVENTS_STOPPED + TWI stopped + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ERROR + TWI error + 0x124 + read-write + + + EVENTS_ERROR + TWI error + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RXSTARTED + Receive sequence started + 0x14C + read-write + + + EVENTS_RXSTARTED + Receive sequence started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_TXSTARTED + Transmit sequence started + 0x150 + read-write + + + EVENTS_TXSTARTED + Transmit sequence started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_WRITE + Write command received + 0x164 + read-write + + + EVENTS_WRITE + Write command received + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_READ + Read command received + 0x168 + read-write + + + EVENTS_READ + Read command received + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + WRITE_SUSPEND + Shortcut between event WRITE and task SUSPEND + 13 + 13 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + READ_SUSPEND + Shortcut between event READ and task SUSPEND + 14 + 14 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STOPPED + Enable or disable interrupt for event STOPPED + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ERROR + Enable or disable interrupt for event ERROR + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXSTARTED + Enable or disable interrupt for event RXSTARTED + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXSTARTED + Enable or disable interrupt for event TXSTARTED + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + WRITE + Enable or disable interrupt for event WRITE + 25 + 25 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + READ + Enable or disable interrupt for event READ + 26 + 26 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to enable interrupt for event STOPPED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for event ERROR + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXSTARTED + Write '1' to enable interrupt for event RXSTARTED + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXSTARTED + Write '1' to enable interrupt for event TXSTARTED + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + WRITE + Write '1' to enable interrupt for event WRITE + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + READ + Write '1' to enable interrupt for event READ + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to disable interrupt for event STOPPED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for event ERROR + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXSTARTED + Write '1' to disable interrupt for event RXSTARTED + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXSTARTED + Write '1' to disable interrupt for event TXSTARTED + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + WRITE + Write '1' to disable interrupt for event WRITE + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + READ + Write '1' to disable interrupt for event READ + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x4D0 + read-write + oneToClear + + + OVERFLOW + RX buffer overflow detected, and prevented + 0 + 0 + + + NotDetected + Error did not occur + 0 + + + Detected + Error occurred + 1 + + + + + DNACK + NACK sent after receiving a data byte + 2 + 2 + + + NotReceived + Error did not occur + 0 + + + Received + Error occurred + 1 + + + + + OVERREAD + TX buffer over-read detected, and prevented + 3 + 3 + + + NotDetected + Error did not occur + 0 + + + Detected + Error occurred + 1 + + + + + + + MATCH + Status register indicating which address had a match + 0x4D4 + read-only + + + MATCH + Indication of which address in {ADDRESS} that matched the incoming address + 0 + 0 + + + + + ENABLE + Enable TWIS + 0x500 + read-write + + + ENABLE + Enable or disable TWIS + 0 + 3 + + + Disabled + Disable TWIS + 0 + + + Enabled + Enable TWIS + 9 + + + + + + + PSEL + Unspecified + TWIS_PSEL + read-write + 0x508 + + SCL + Pin select for SCL signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDA + Pin select for SDA signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + RXD + RXD EasyDMA channel + TWIS_RXD + read-write + 0x534 + + PTR + RXD Data pointer + 0x000 + read-write + + + PTR + RXD Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in RXD buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in RXD buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last RXD transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last RXD transaction + 0 + 15 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 1 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + TXD + TXD EasyDMA channel + TWIS_TXD + read-write + 0x544 + + PTR + TXD Data pointer + 0x000 + read-write + + + PTR + TXD Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in TXD buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in TXD buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last TXD transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last TXD transaction + 0 + 15 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 1 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + 0x2 + 0x4 + ADDRESS[%s] + Description collection: TWI slave address n + 0x588 + read-write + + + ADDRESS + TWI slave address + 0 + 6 + + + + + CONFIG + Configuration register for the address match mechanism + 0x594 + read-write + 0x00000001 + + + ADDRESS0 + Enable or disable address matching on ADDRESS[0] + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ADDRESS1 + Enable or disable address matching on ADDRESS[1] + 1 + 1 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + + + ORC + Over-read character. Character sent out in case of an over-read of the transmit buffer. + 0x5C0 + read-write + + + ORC + Over-read character. Character sent out in case of an over-read of the transmit buffer. + 0 + 7 + + + + + + + SPI1 + Serial Peripheral Interface 1 + 0x40004000 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + SPIM1 + Serial Peripheral Interface Master with EasyDMA 1 + 0x40004000 + SPI1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + SPIS1 + SPI Slave 1 + 0x40004000 + SPI1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + TWI1 + I2C compatible Two-Wire Interface 1 + 0x40004000 + SPI1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + TWIM1 + I2C compatible Two-Wire Master Interface with EasyDMA 1 + 0x40004000 + SPI1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + TWIS1 + I2C compatible Two-Wire Slave Interface with EasyDMA 1 + 0x40004000 + SPI1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + NFCT + NFC-A compatible radio + 0x40005000 + + 0 + 0x1000 + registers + + + NFCT + 5 + + NFCT + 0x20 + + + TASKS_ACTIVATE + Activate NFCT peripheral for incoming and outgoing frames, change state to activated + 0x000 + write-only + + + TASKS_ACTIVATE + Activate NFCT peripheral for incoming and outgoing frames, change state to activated + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_DISABLE + Disable NFCT peripheral + 0x004 + write-only + + + TASKS_DISABLE + Disable NFCT peripheral + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_SENSE + Enable NFC sense field mode, change state to sense mode + 0x008 + write-only + + + TASKS_SENSE + Enable NFC sense field mode, change state to sense mode + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STARTTX + Start transmission of an outgoing frame, change state to transmit + 0x00C + write-only + + + TASKS_STARTTX + Start transmission of an outgoing frame, change state to transmit + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_ENABLERXDATA + Initializes the EasyDMA for receive. + 0x01C + write-only + + + TASKS_ENABLERXDATA + Initializes the EasyDMA for receive. + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_GOIDLE + Force state machine to IDLE state + 0x024 + write-only + + + TASKS_GOIDLE + Force state machine to IDLE state + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_GOSLEEP + Force state machine to SLEEP_A state + 0x028 + write-only + + + TASKS_GOSLEEP + Force state machine to SLEEP_A state + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_READY + The NFCT peripheral is ready to receive and send frames + 0x100 + read-write + + + EVENTS_READY + The NFCT peripheral is ready to receive and send frames + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_FIELDDETECTED + Remote NFC field detected + 0x104 + read-write + + + EVENTS_FIELDDETECTED + Remote NFC field detected + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_FIELDLOST + Remote NFC field lost + 0x108 + read-write + + + EVENTS_FIELDLOST + Remote NFC field lost + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_TXFRAMESTART + Marks the start of the first symbol of a transmitted frame + 0x10C + read-write + + + EVENTS_TXFRAMESTART + Marks the start of the first symbol of a transmitted frame + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_TXFRAMEEND + Marks the end of the last transmitted on-air symbol of a frame + 0x110 + read-write + + + EVENTS_TXFRAMEEND + Marks the end of the last transmitted on-air symbol of a frame + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RXFRAMESTART + Marks the end of the first symbol of a received frame + 0x114 + read-write + + + EVENTS_RXFRAMESTART + Marks the end of the first symbol of a received frame + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RXFRAMEEND + Received data has been checked (CRC, parity) and transferred to RAM, and EasyDMA has ended accessing the RX buffer + 0x118 + read-write + + + EVENTS_RXFRAMEEND + Received data has been checked (CRC, parity) and transferred to RAM, and EasyDMA has ended accessing the RX buffer + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ERROR + NFC error reported. The ERRORSTATUS register contains details on the source of the error. + 0x11C + read-write + + + EVENTS_ERROR + NFC error reported. The ERRORSTATUS register contains details on the source of the error. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RXERROR + NFC RX frame error reported. The FRAMESTATUS.RX register contains details on the source of the error. + 0x128 + read-write + + + EVENTS_RXERROR + NFC RX frame error reported. The FRAMESTATUS.RX register contains details on the source of the error. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ENDRX + RX buffer (as defined by PACKETPTR and MAXLEN) in Data RAM full. + 0x12C + read-write + + + EVENTS_ENDRX + RX buffer (as defined by PACKETPTR and MAXLEN) in Data RAM full. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ENDTX + Transmission of data in RAM has ended, and EasyDMA has ended accessing the TX buffer + 0x130 + read-write + + + EVENTS_ENDTX + Transmission of data in RAM has ended, and EasyDMA has ended accessing the TX buffer + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_AUTOCOLRESSTARTED + Auto collision resolution process has started + 0x138 + read-write + + + EVENTS_AUTOCOLRESSTARTED + Auto collision resolution process has started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_COLLISION + NFC auto collision resolution error reported. + 0x148 + read-write + + + EVENTS_COLLISION + NFC auto collision resolution error reported. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_SELECTED + NFC auto collision resolution successfully completed + 0x14C + read-write + + + EVENTS_SELECTED + NFC auto collision resolution successfully completed + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_STARTED + EasyDMA is ready to receive or send frames. + 0x150 + read-write + + + EVENTS_STARTED + EasyDMA is ready to receive or send frames. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + FIELDDETECTED_ACTIVATE + Shortcut between event FIELDDETECTED and task ACTIVATE + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + FIELDLOST_SENSE + Shortcut between event FIELDLOST and task SENSE + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + TXFRAMEEND_ENABLERXDATA + Shortcut between event TXFRAMEEND and task ENABLERXDATA + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + READY + Enable or disable interrupt for event READY + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + FIELDDETECTED + Enable or disable interrupt for event FIELDDETECTED + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + FIELDLOST + Enable or disable interrupt for event FIELDLOST + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXFRAMESTART + Enable or disable interrupt for event TXFRAMESTART + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXFRAMEEND + Enable or disable interrupt for event TXFRAMEEND + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXFRAMESTART + Enable or disable interrupt for event RXFRAMESTART + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXFRAMEEND + Enable or disable interrupt for event RXFRAMEEND + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ERROR + Enable or disable interrupt for event ERROR + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXERROR + Enable or disable interrupt for event RXERROR + 10 + 10 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDRX + Enable or disable interrupt for event ENDRX + 11 + 11 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDTX + Enable or disable interrupt for event ENDTX + 12 + 12 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + AUTOCOLRESSTARTED + Enable or disable interrupt for event AUTOCOLRESSTARTED + 14 + 14 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + COLLISION + Enable or disable interrupt for event COLLISION + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SELECTED + Enable or disable interrupt for event SELECTED + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STARTED + Enable or disable interrupt for event STARTED + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to enable interrupt for event READY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + FIELDDETECTED + Write '1' to enable interrupt for event FIELDDETECTED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + FIELDLOST + Write '1' to enable interrupt for event FIELDLOST + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXFRAMESTART + Write '1' to enable interrupt for event TXFRAMESTART + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXFRAMEEND + Write '1' to enable interrupt for event TXFRAMEEND + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXFRAMESTART + Write '1' to enable interrupt for event RXFRAMESTART + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXFRAMEEND + Write '1' to enable interrupt for event RXFRAMEEND + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for event ERROR + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXERROR + Write '1' to enable interrupt for event RXERROR + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDRX + Write '1' to enable interrupt for event ENDRX + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDTX + Write '1' to enable interrupt for event ENDTX + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + AUTOCOLRESSTARTED + Write '1' to enable interrupt for event AUTOCOLRESSTARTED + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COLLISION + Write '1' to enable interrupt for event COLLISION + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SELECTED + Write '1' to enable interrupt for event SELECTED + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STARTED + Write '1' to enable interrupt for event STARTED + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to disable interrupt for event READY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + FIELDDETECTED + Write '1' to disable interrupt for event FIELDDETECTED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + FIELDLOST + Write '1' to disable interrupt for event FIELDLOST + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXFRAMESTART + Write '1' to disable interrupt for event TXFRAMESTART + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXFRAMEEND + Write '1' to disable interrupt for event TXFRAMEEND + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXFRAMESTART + Write '1' to disable interrupt for event RXFRAMESTART + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXFRAMEEND + Write '1' to disable interrupt for event RXFRAMEEND + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for event ERROR + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXERROR + Write '1' to disable interrupt for event RXERROR + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDRX + Write '1' to disable interrupt for event ENDRX + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDTX + Write '1' to disable interrupt for event ENDTX + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + AUTOCOLRESSTARTED + Write '1' to disable interrupt for event AUTOCOLRESSTARTED + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COLLISION + Write '1' to disable interrupt for event COLLISION + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SELECTED + Write '1' to disable interrupt for event SELECTED + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STARTED + Write '1' to disable interrupt for event STARTED + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSTATUS + NFC Error Status register + 0x404 + read-write + oneToClear + + + FRAMEDELAYTIMEOUT + No STARTTX task triggered before expiration of the time set in FRAMEDELAYMAX + 0 + 0 + + + + + FRAMESTATUS + Unspecified + NFCT_FRAMESTATUS + read-write + 0x40C + + RX + Result of last incoming frame + 0x000 + read-write + oneToClear + + + CRCERROR + No valid end of frame (EoF) detected + 0 + 0 + + + CRCCorrect + Valid CRC detected + 0 + + + CRCError + CRC received does not match local check + 1 + + + + + PARITYSTATUS + Parity status of received frame + 2 + 2 + + + ParityOK + Frame received with parity OK + 0 + + + ParityError + Frame received with parity error + 1 + + + + + OVERRUN + Overrun detected + 3 + 3 + + + NoOverrun + No overrun detected + 0 + + + Overrun + Overrun error + 1 + + + + + + + + NFCTAGSTATE + NfcTag state register + 0x410 + read-only + + + NFCTAGSTATE + NfcTag state + 0 + 2 + + + Disabled + Disabled or sense + 0 + + + RampUp + RampUp + 2 + + + Idle + Idle + 3 + + + Receive + Receive + 4 + + + FrameDelay + FrameDelay + 5 + + + Transmit + Transmit + 6 + + + + + + + SLEEPSTATE + Sleep state during automatic collision resolution + 0x420 + read-only + 0x00000000 + + + SLEEPSTATE + Reflects the sleep state during automatic collision resolution. Set to IDLE + by a GOIDLE task. Set to SLEEP_A when a valid SLEEP_REQ frame is received or by a + GOSLEEP task. + 0 + 0 + + + Idle + State is IDLE. + 0 + + + SleepA + State is SLEEP_A. + 1 + + + + + + + FIELDPRESENT + Indicates the presence or not of a valid field + 0x43C + read-only + + + FIELDPRESENT + Indicates if a valid field is present. Available only in the activated state. + 0 + 0 + + + NoField + No valid field detected + 0 + + + FieldPresent + Valid field detected + 1 + + + + + LOCKDETECT + Indicates if the low level has locked to the field + 1 + 1 + + + NotLocked + Not locked to field + 0 + + + Locked + Locked to field + 1 + + + + + + + FRAMEDELAYMIN + Minimum frame delay + 0x504 + read-write + 0x00000480 + + + FRAMEDELAYMIN + Minimum frame delay in number of 13.56 MHz clocks + 0 + 15 + + + + + FRAMEDELAYMAX + Maximum frame delay + 0x508 + read-write + 0x00001000 + + + FRAMEDELAYMAX + Maximum frame delay in number of 13.56 MHz clocks + 0 + 19 + + + + + FRAMEDELAYMODE + Configuration register for the Frame Delay Timer + 0x50C + read-write + 0x00000001 + + + FRAMEDELAYMODE + Configuration register for the Frame Delay Timer + 0 + 1 + + + FreeRun + Transmission is independent of frame timer and will start when the STARTTX task is triggered. No timeout. + 0 + + + Window + Frame is transmitted between FRAMEDELAYMIN and FRAMEDELAYMAX + 1 + + + ExactVal + Frame is transmitted exactly at FRAMEDELAYMAX + 2 + + + WindowGrid + Frame is transmitted on a bit grid between FRAMEDELAYMIN and FRAMEDELAYMAX + 3 + + + + + + + PACKETPTR + Packet pointer for TXD and RXD data storage in Data RAM + 0x510 + read-write + 0x00000000 + + + PTR + Packet pointer for TXD and RXD data storage in Data RAM. This address is a byte-aligned RAM address. + 0 + 31 + + + + + MAXLEN + Size of the RAM buffer allocated to TXD and RXD data storage each + 0x514 + read-write + + + MAXLEN + Size of the RAM buffer allocated to TXD and RXD data storage each + 0 + 8 + + + + + TXD + Unspecified + NFCT_TXD + read-write + 0x518 + + FRAMECONFIG + Configuration of outgoing frames + 0x000 + read-write + 0x00000017 + + + PARITY + Indicates if parity is added to the frame + 0 + 0 + + + NoParity + Parity is not added to TX frames + 0 + + + Parity + Parity is added to TX frames + 1 + + + + + DISCARDMODE + Discarding unused bits at start or end of a frame + 1 + 1 + + + DiscardEnd + Unused bits are discarded at end of frame (EoF) + 0 + + + DiscardStart + Unused bits are discarded at start of frame (SoF) + 1 + + + + + SOF + Adding SoF or not in TX frames + 2 + 2 + + + NoSoF + SoF symbol not added + 0 + + + SoF + SoF symbol added + 1 + + + + + CRCMODETX + CRC mode for outgoing frames + 4 + 4 + + + NoCRCTX + CRC is not added to the frame + 0 + + + CRC16TX + 16 bit CRC added to the frame based on all the data read from RAM that is used in the frame + 1 + + + + + + + AMOUNT + Size of outgoing frame + 0x004 + read-write + + + TXDATABITS + Number of bits in the last or first byte read from RAM that shall be included in the frame (excluding parity bit). + 0 + 2 + + + TXDATABYTES + Number of complete bytes that shall be included in the frame, excluding CRC, parity and framing + 3 + 11 + + + + + + RXD + Unspecified + NFCT_RXD + read-write + 0x520 + + FRAMECONFIG + Configuration of incoming frames + 0x000 + read-write + 0x00000015 + + + PARITY + Indicates if parity expected in RX frame + 0 + 0 + + + NoParity + Parity is not expected in RX frames + 0 + + + Parity + Parity is expected in RX frames + 1 + + + + + SOF + SoF expected or not in RX frames + 2 + 2 + + + NoSoF + SoF symbol is not expected in RX frames + 0 + + + SoF + SoF symbol is expected in RX frames + 1 + + + + + CRCMODERX + CRC mode for incoming frames + 4 + 4 + + + NoCRCRX + CRC is not expected in RX frames + 0 + + + CRC16RX + Last 16 bits in RX frame is CRC, CRC is checked and CRCSTATUS updated + 1 + + + + + + + AMOUNT + Size of last incoming frame + 0x004 + read-only + + + RXDATABITS + Number of bits in the last byte in the frame, if less than 8 (including CRC, but excluding parity and SoF/EoF framing). + 0 + 2 + + + RXDATABYTES + Number of complete bytes received in the frame (including CRC, but excluding parity and SoF/EoF framing) + 3 + 11 + + + + + + NFCID1_LAST + Last NFCID1 part (4, 7 or 10 bytes ID) + 0x590 + read-write + 0x00006363 + + + NFCID1_Z + NFCID1 byte Z (very last byte sent) + 0 + 7 + + + NFCID1_Y + NFCID1 byte Y + 8 + 15 + + + NFCID1_X + NFCID1 byte X + 16 + 23 + + + NFCID1_W + NFCID1 byte W + 24 + 31 + + + + + NFCID1_2ND_LAST + Second last NFCID1 part (7 or 10 bytes ID) + 0x594 + read-write + + + NFCID1_V + NFCID1 byte V + 0 + 7 + + + NFCID1_U + NFCID1 byte U + 8 + 15 + + + NFCID1_T + NFCID1 byte T + 16 + 23 + + + + + NFCID1_3RD_LAST + Third last NFCID1 part (10 bytes ID) + 0x598 + read-write + + + NFCID1_S + NFCID1 byte S + 0 + 7 + + + NFCID1_R + NFCID1 byte R + 8 + 15 + + + NFCID1_Q + NFCID1 byte Q + 16 + 23 + + + + + AUTOCOLRESCONFIG + Controls the auto collision resolution function. This setting must be done before the NFCT peripheral is activated. + 0x59C + read-write + 0x00000002 + + + MODE + Enables/disables auto collision resolution + 0 + 0 + + + Enabled + Auto collision resolution enabled + 0 + + + Disabled + Auto collision resolution disabled + 1 + + + + + + + SENSRES + NFC-A SENS_RES auto-response settings + 0x5A0 + read-write + 0x00000001 + + + BITFRAMESDD + Bit frame SDD as defined by the b5:b1 of byte 1 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification + 0 + 4 + + + SDD00000 + SDD pattern 00000 + 0 + + + SDD00001 + SDD pattern 00001 + 1 + + + SDD00010 + SDD pattern 00010 + 2 + + + SDD00100 + SDD pattern 00100 + 4 + + + SDD01000 + SDD pattern 01000 + 8 + + + SDD10000 + SDD pattern 10000 + 16 + + + + + RFU5 + Reserved for future use. Shall be 0. + 5 + 5 + + + NFCIDSIZE + NFCID1 size. This value is used by the auto collision resolution engine. + 6 + 7 + + + NFCID1Single + NFCID1 size: single (4 bytes) + 0 + + + NFCID1Double + NFCID1 size: double (7 bytes) + 1 + + + NFCID1Triple + NFCID1 size: triple (10 bytes) + 2 + + + + + PLATFCONFIG + Tag platform configuration as defined by the b4:b1 of byte 2 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification + 8 + 11 + + + RFU74 + Reserved for future use. Shall be 0. + 12 + 15 + + + + + SELRES + NFC-A SEL_RES auto-response settings + 0x5A4 + read-write + + + RFU10 + Reserved for future use. Shall be 0. + 0 + 1 + + + CASCADE + Cascade as defined by the b3 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification (controlled by hardware, shall be 0) + 2 + 2 + + + RFU43 + Reserved for future use. Shall be 0. + 3 + 4 + + + PROTOCOL + Protocol as defined by the b7:b6 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification + 5 + 6 + + + RFU7 + Reserved for future use. Shall be 0. + 7 + 7 + + + + + + + GPIOTE + GPIO Tasks and Events + 0x40006000 + + 0 + 0x1000 + registers + + + GPIOTE + 6 + + GPIOTE + 0x20 + + + 0x8 + 0x4 + TASKS_OUT[%s] + Description collection: Task for writing to pin specified in CONFIG[n].PSEL. Action on pin is configured in CONFIG[n].POLARITY. + 0x000 + write-only + + + TASKS_OUT + Task for writing to pin specified in CONFIG[n].PSEL. Action on pin is configured in CONFIG[n].POLARITY. + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + 0x8 + 0x4 + TASKS_SET[%s] + Description collection: Task for writing to pin specified in CONFIG[n].PSEL. Action on pin is to set it high. + 0x030 + write-only + + + TASKS_SET + Task for writing to pin specified in CONFIG[n].PSEL. Action on pin is to set it high. + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + 0x8 + 0x4 + TASKS_CLR[%s] + Description collection: Task for writing to pin specified in CONFIG[n].PSEL. Action on pin is to set it low. + 0x060 + write-only + + + TASKS_CLR + Task for writing to pin specified in CONFIG[n].PSEL. Action on pin is to set it low. + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + 0x8 + 0x4 + EVENTS_IN[%s] + Description collection: Event generated from pin specified in CONFIG[n].PSEL + 0x100 + read-write + + + EVENTS_IN + Event generated from pin specified in CONFIG[n].PSEL + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_PORT + Event generated from multiple input GPIO pins with SENSE mechanism enabled + 0x17C + read-write + + + EVENTS_PORT + Event generated from multiple input GPIO pins with SENSE mechanism enabled + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + IN0 + Write '1' to enable interrupt for event IN[0] + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN1 + Write '1' to enable interrupt for event IN[1] + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN2 + Write '1' to enable interrupt for event IN[2] + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN3 + Write '1' to enable interrupt for event IN[3] + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN4 + Write '1' to enable interrupt for event IN[4] + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN5 + Write '1' to enable interrupt for event IN[5] + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN6 + Write '1' to enable interrupt for event IN[6] + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN7 + Write '1' to enable interrupt for event IN[7] + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PORT + Write '1' to enable interrupt for event PORT + 31 + 31 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + IN0 + Write '1' to disable interrupt for event IN[0] + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN1 + Write '1' to disable interrupt for event IN[1] + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN2 + Write '1' to disable interrupt for event IN[2] + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN3 + Write '1' to disable interrupt for event IN[3] + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN4 + Write '1' to disable interrupt for event IN[4] + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN5 + Write '1' to disable interrupt for event IN[5] + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN6 + Write '1' to disable interrupt for event IN[6] + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN7 + Write '1' to disable interrupt for event IN[7] + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PORT + Write '1' to disable interrupt for event PORT + 31 + 31 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + 0x8 + 0x4 + CONFIG[%s] + Description collection: Configuration for OUT[n], SET[n], and CLR[n] tasks and IN[n] event + 0x510 + read-write + + + MODE + Mode + 0 + 1 + + + Disabled + Disabled. Pin specified by PSEL will not be acquired by the GPIOTE module. + 0 + + + Event + Event mode + 1 + + + Task + Task mode + 3 + + + + + PSEL + GPIO number associated with SET[n], CLR[n], and OUT[n] tasks and IN[n] event + 8 + 12 + + + PORT + Port number + 13 + 13 + + + POLARITY + When In task mode: Operation to be performed on output when OUT[n] task is triggered. When In event mode: Operation on input that shall trigger IN[n] event. + 16 + 17 + + + None + Task mode: No effect on pin from OUT[n] task. Event mode: no IN[n] event generated on pin activity. + 0 + + + LoToHi + Task mode: Set pin from OUT[n] task. Event mode: Generate IN[n] event when rising edge on pin. + 1 + + + HiToLo + Task mode: Clear pin from OUT[n] task. Event mode: Generate IN[n] event when falling edge on pin. + 2 + + + Toggle + Task mode: Toggle pin from OUT[n]. Event mode: Generate IN[n] when any change on pin. + 3 + + + + + OUTINIT + When in task mode: Initial value of the output when the GPIOTE channel is configured. When in event mode: No effect. + 20 + 20 + + + Low + Task mode: Initial value of pin before task triggering is low + 0 + + + High + Task mode: Initial value of pin before task triggering is high + 1 + + + + + + + + + SAADC + Successive approximation register (SAR) analog-to-digital converter + 0x40007000 + + 0 + 0x1000 + registers + + + SAADC + 7 + + SAADC + 0x20 + + + TASKS_START + Starts the SAADC and prepares the result buffer in RAM + 0x000 + write-only + + + TASKS_START + Starts the SAADC and prepares the result buffer in RAM + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_SAMPLE + Takes one SAADC sample + 0x004 + write-only + + + TASKS_SAMPLE + Takes one SAADC sample + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stops the SAADC and terminates all on-going conversions + 0x008 + write-only + + + TASKS_STOP + Stops the SAADC and terminates all on-going conversions + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_CALIBRATEOFFSET + Starts offset auto-calibration + 0x00C + write-only + + + TASKS_CALIBRATEOFFSET + Starts offset auto-calibration + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_STARTED + The SAADC has started + 0x100 + read-write + + + EVENTS_STARTED + The SAADC has started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_END + The SAADC has filled up the result buffer + 0x104 + read-write + + + EVENTS_END + The SAADC has filled up the result buffer + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_DONE + A conversion task has been completed. Depending on the configuration, multiple conversions might be needed for a result to be transferred to RAM. + 0x108 + read-write + + + EVENTS_DONE + A conversion task has been completed. Depending on the configuration, multiple conversions might be needed for a result to be transferred to RAM. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RESULTDONE + Result ready for transfer to RAM + 0x10C + read-write + + + EVENTS_RESULTDONE + Result ready for transfer to RAM + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_CALIBRATEDONE + Calibration is complete + 0x110 + read-write + + + EVENTS_CALIBRATEDONE + Calibration is complete + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_STOPPED + The SAADC has stopped + 0x114 + read-write + + + EVENTS_STOPPED + The SAADC has stopped + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + 8 + 0x008 + EVENTS_CH[%s] + Peripheral events. + SAADC_EVENTS_CH + read-write + 0x118 + + LIMITH + Description cluster: Last result is equal or above CH[n].LIMIT.HIGH + 0x000 + read-write + + + LIMITH + Last result is equal or above CH[n].LIMIT.HIGH + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + LIMITL + Description cluster: Last result is equal or below CH[n].LIMIT.LOW + 0x004 + read-write + + + LIMITL + Last result is equal or below CH[n].LIMIT.LOW + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STARTED + Enable or disable interrupt for event STARTED + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + END + Enable or disable interrupt for event END + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + DONE + Enable or disable interrupt for event DONE + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RESULTDONE + Enable or disable interrupt for event RESULTDONE + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CALIBRATEDONE + Enable or disable interrupt for event CALIBRATEDONE + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STOPPED + Enable or disable interrupt for event STOPPED + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH0LIMITH + Enable or disable interrupt for event CH0LIMITH + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH0LIMITL + Enable or disable interrupt for event CH0LIMITL + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH1LIMITH + Enable or disable interrupt for event CH1LIMITH + 8 + 8 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH1LIMITL + Enable or disable interrupt for event CH1LIMITL + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH2LIMITH + Enable or disable interrupt for event CH2LIMITH + 10 + 10 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH2LIMITL + Enable or disable interrupt for event CH2LIMITL + 11 + 11 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH3LIMITH + Enable or disable interrupt for event CH3LIMITH + 12 + 12 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH3LIMITL + Enable or disable interrupt for event CH3LIMITL + 13 + 13 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH4LIMITH + Enable or disable interrupt for event CH4LIMITH + 14 + 14 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH4LIMITL + Enable or disable interrupt for event CH4LIMITL + 15 + 15 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH5LIMITH + Enable or disable interrupt for event CH5LIMITH + 16 + 16 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH5LIMITL + Enable or disable interrupt for event CH5LIMITL + 17 + 17 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH6LIMITH + Enable or disable interrupt for event CH6LIMITH + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH6LIMITL + Enable or disable interrupt for event CH6LIMITL + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH7LIMITH + Enable or disable interrupt for event CH7LIMITH + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH7LIMITL + Enable or disable interrupt for event CH7LIMITL + 21 + 21 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STARTED + Write '1' to enable interrupt for event STARTED + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + END + Write '1' to enable interrupt for event END + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DONE + Write '1' to enable interrupt for event DONE + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RESULTDONE + Write '1' to enable interrupt for event RESULTDONE + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CALIBRATEDONE + Write '1' to enable interrupt for event CALIBRATEDONE + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STOPPED + Write '1' to enable interrupt for event STOPPED + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH0LIMITH + Write '1' to enable interrupt for event CH0LIMITH + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH0LIMITL + Write '1' to enable interrupt for event CH0LIMITL + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH1LIMITH + Write '1' to enable interrupt for event CH1LIMITH + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH1LIMITL + Write '1' to enable interrupt for event CH1LIMITL + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH2LIMITH + Write '1' to enable interrupt for event CH2LIMITH + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH2LIMITL + Write '1' to enable interrupt for event CH2LIMITL + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH3LIMITH + Write '1' to enable interrupt for event CH3LIMITH + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH3LIMITL + Write '1' to enable interrupt for event CH3LIMITL + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH4LIMITH + Write '1' to enable interrupt for event CH4LIMITH + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH4LIMITL + Write '1' to enable interrupt for event CH4LIMITL + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH5LIMITH + Write '1' to enable interrupt for event CH5LIMITH + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH5LIMITL + Write '1' to enable interrupt for event CH5LIMITL + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH6LIMITH + Write '1' to enable interrupt for event CH6LIMITH + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH6LIMITL + Write '1' to enable interrupt for event CH6LIMITL + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH7LIMITH + Write '1' to enable interrupt for event CH7LIMITH + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH7LIMITL + Write '1' to enable interrupt for event CH7LIMITL + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STARTED + Write '1' to disable interrupt for event STARTED + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + END + Write '1' to disable interrupt for event END + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DONE + Write '1' to disable interrupt for event DONE + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RESULTDONE + Write '1' to disable interrupt for event RESULTDONE + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CALIBRATEDONE + Write '1' to disable interrupt for event CALIBRATEDONE + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STOPPED + Write '1' to disable interrupt for event STOPPED + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH0LIMITH + Write '1' to disable interrupt for event CH0LIMITH + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH0LIMITL + Write '1' to disable interrupt for event CH0LIMITL + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH1LIMITH + Write '1' to disable interrupt for event CH1LIMITH + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH1LIMITL + Write '1' to disable interrupt for event CH1LIMITL + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH2LIMITH + Write '1' to disable interrupt for event CH2LIMITH + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH2LIMITL + Write '1' to disable interrupt for event CH2LIMITL + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH3LIMITH + Write '1' to disable interrupt for event CH3LIMITH + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH3LIMITL + Write '1' to disable interrupt for event CH3LIMITL + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH4LIMITH + Write '1' to disable interrupt for event CH4LIMITH + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH4LIMITL + Write '1' to disable interrupt for event CH4LIMITL + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH5LIMITH + Write '1' to disable interrupt for event CH5LIMITH + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH5LIMITL + Write '1' to disable interrupt for event CH5LIMITL + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH6LIMITH + Write '1' to disable interrupt for event CH6LIMITH + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH6LIMITL + Write '1' to disable interrupt for event CH6LIMITL + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH7LIMITH + Write '1' to disable interrupt for event CH7LIMITH + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH7LIMITL + Write '1' to disable interrupt for event CH7LIMITL + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + STATUS + Status + 0x400 + read-only + + + STATUS + Status + 0 + 0 + + + Ready + SAADC is ready. No on-going conversions. + 0 + + + Busy + SAADC is busy. Conversion in progress. + 1 + + + + + + + ENABLE + Enable or disable SAADC + 0x500 + read-write + + + ENABLE + Enable or disable SAADC + 0 + 0 + + + Disabled + Disable SAADC + 0 + + + Enabled + Enable SAADC + 1 + + + + + + + 8 + 0x010 + CH[%s] + Unspecified + SAADC_CH + read-write + 0x510 + + PSELP + Description cluster: Input positive pin selection for CH[n] + 0x000 + read-write + 0x00000000 + + + PSELP + Analog positive input channel + 0 + 4 + + + NC + Not connected + 0 + + + AnalogInput0 + AIN0 + 1 + + + AnalogInput1 + AIN1 + 2 + + + AnalogInput2 + AIN2 + 3 + + + AnalogInput3 + AIN3 + 4 + + + AnalogInput4 + AIN4 + 5 + + + AnalogInput5 + AIN5 + 6 + + + AnalogInput6 + AIN6 + 7 + + + AnalogInput7 + AIN7 + 8 + + + VDD + VDD + 9 + + + VDDHDIV5 + VDDH/5 + 0x0D + + + + + + + PSELN + Description cluster: Input negative pin selection for CH[n] + 0x004 + read-write + 0x00000000 + + + PSELN + Analog negative input, enables differential channel + 0 + 4 + + + NC + Not connected + 0 + + + AnalogInput0 + AIN0 + 1 + + + AnalogInput1 + AIN1 + 2 + + + AnalogInput2 + AIN2 + 3 + + + AnalogInput3 + AIN3 + 4 + + + AnalogInput4 + AIN4 + 5 + + + AnalogInput5 + AIN5 + 6 + + + AnalogInput6 + AIN6 + 7 + + + AnalogInput7 + AIN7 + 8 + + + VDD + VDD + 9 + + + VDDHDIV5 + VDDH/5 + 0x0D + + + + + + + CONFIG + Description cluster: Input configuration for CH[n] + 0x008 + read-write + 0x00020000 + + + RESP + Positive channel resistor control + 0 + 1 + + + Bypass + Bypass resistor ladder + 0 + + + Pulldown + Pull-down to GND + 1 + + + Pullup + Pull-up to VDD + 2 + + + VDD1_2 + Set input at VDD/2 + 3 + + + + + RESN + Negative channel resistor control + 4 + 5 + + + Bypass + Bypass resistor ladder + 0 + + + Pulldown + Pull-down to GND + 1 + + + Pullup + Pull-up to VDD + 2 + + + VDD1_2 + Set input at VDD/2 + 3 + + + + + GAIN + Gain control + 8 + 10 + + + Gain1_6 + 1/6 + 0 + + + Gain1_5 + 1/5 + 1 + + + Gain1_4 + 1/4 + 2 + + + Gain1_3 + 1/3 + 3 + + + Gain1_2 + 1/2 + 4 + + + Gain1 + 1 + 5 + + + Gain2 + 2 + 6 + + + Gain4 + 4 + 7 + + + + + REFSEL + Reference control + 12 + 12 + + + Internal + Internal reference (0.6 V) + 0 + + + VDD1_4 + VDD/4 as reference + 1 + + + + + TACQ + Acquisition time, the time the SAADC uses to sample the input voltage + 16 + 18 + + + 3us + 3 us + 0 + + + 5us + 5 us + 1 + + + 10us + 10 us + 2 + + + 15us + 15 us + 3 + + + 20us + 20 us + 4 + + + 40us + 40 us + 5 + + + + + MODE + Enable differential mode + 20 + 20 + + + SE + Single-ended, PSELN will be ignored, negative input to SAADC shorted to GND + 0 + + + Diff + Differential + 1 + + + + + BURST + Enable burst mode + 24 + 24 + + + Disabled + Burst mode is disabled (normal operation) + 0 + + + Enabled + Burst mode is enabled. SAADC takes 2^OVERSAMPLE number of samples as fast as it can, and sends the average to Data RAM. + 1 + + + + + + + LIMIT + Description cluster: High/low limits for event monitoring of a channel + 0x00C + read-write + 0x7FFF8000 + + + LOW + Low level limit + 0 + 15 + + + HIGH + High level limit + 16 + 31 + + + + + + RESOLUTION + Resolution configuration + 0x5F0 + read-write + 0x00000001 + + + VAL + Set the resolution + 0 + 2 + + + 8bit + 8 bits + 0 + + + 10bit + 10 bits + 1 + + + 12bit + 12 bits + 2 + + + 14bit + 14 bits + 3 + + + + + + + OVERSAMPLE + Oversampling configuration. The RESOLUTION is applied before averaging, thus for high OVERSAMPLE a higher RESOLUTION should be used. + 0x5F4 + read-write + + + OVERSAMPLE + Oversample control + 0 + 3 + + + Bypass + Bypass oversampling + 0 + + + Over2x + Oversample 2x + 1 + + + Over4x + Oversample 4x + 2 + + + Over8x + Oversample 8x + 3 + + + Over16x + Oversample 16x + 4 + + + Over32x + Oversample 32x + 5 + + + Over64x + Oversample 64x + 6 + + + Over128x + Oversample 128x + 7 + + + Over256x + Oversample 256x + 8 + + + + + + + SAMPLERATE + Controls normal or continuous sample rate + 0x5F8 + read-write + + + CC + Capture and compare value. Sample rate is 16 MHz/CC + 0 + 10 + + + MODE + Select mode for sample rate control + 12 + 12 + + + Task + Rate is controlled from SAMPLE task + 0 + + + Timers + Rate is controlled from local timer (use CC to control the rate) + 1 + + + + + + + RESULT + RESULT EasyDMA channel + SAADC_RESULT + read-write + 0x62C + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of 16-bit samples to be written to output RAM buffer + 0x004 + read-write + + + MAXCNT + Maximum number of 16-bit samples to be written to output RAM buffer + 0 + 14 + + + + + AMOUNT + Number of 16-bit samples written to output RAM buffer since the previous START task + 0x008 + read-only + + + AMOUNT + Number of 16-bit samples written to output RAM buffer since the previous START task. This register can be read after an END or STOPPED event. + 0 + 14 + + + + + + + + TIMER0 + Timer/Counter 0 + 0x40008000 + TIMER + + 0 + 0x1000 + registers + + + TIMER0 + 8 + + TIMER + 0x20 + + + TASKS_START + Start Timer + 0x000 + write-only + + + TASKS_START + Start Timer + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stop Timer + 0x004 + write-only + + + TASKS_STOP + Stop Timer + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_COUNT + Increment Timer (Counter mode only) + 0x008 + write-only + + + TASKS_COUNT + Increment Timer (Counter mode only) + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_CLEAR + Clear time + 0x00C + write-only + + + TASKS_CLEAR + Clear time + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_SHUTDOWN + Deprecated register - Shut down timer + 0x010 + write-only + + + TASKS_SHUTDOWN + Deprecated field - Shut down timer + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + 0x6 + 0x4 + TASKS_CAPTURE[%s] + Description collection: Capture Timer value to CC[n] register + 0x040 + write-only + + + TASKS_CAPTURE + Capture Timer value to CC[n] register + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + 0x6 + 0x4 + EVENTS_COMPARE[%s] + Description collection: Compare event on CC[n] match + 0x140 + read-write + + + EVENTS_COMPARE + Compare event on CC[n] match + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + COMPARE0_CLEAR + Shortcut between event COMPARE[0] and task CLEAR + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE1_CLEAR + Shortcut between event COMPARE[1] and task CLEAR + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE2_CLEAR + Shortcut between event COMPARE[2] and task CLEAR + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE3_CLEAR + Shortcut between event COMPARE[3] and task CLEAR + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE4_CLEAR + Shortcut between event COMPARE[4] and task CLEAR + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE5_CLEAR + Shortcut between event COMPARE[5] and task CLEAR + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE0_STOP + Shortcut between event COMPARE[0] and task STOP + 8 + 8 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE1_STOP + Shortcut between event COMPARE[1] and task STOP + 9 + 9 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE2_STOP + Shortcut between event COMPARE[2] and task STOP + 10 + 10 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE3_STOP + Shortcut between event COMPARE[3] and task STOP + 11 + 11 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE4_STOP + Shortcut between event COMPARE[4] and task STOP + 12 + 12 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE5_STOP + Shortcut between event COMPARE[5] and task STOP + 13 + 13 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + COMPARE0 + Write '1' to enable interrupt for event COMPARE[0] + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE1 + Write '1' to enable interrupt for event COMPARE[1] + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE2 + Write '1' to enable interrupt for event COMPARE[2] + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE3 + Write '1' to enable interrupt for event COMPARE[3] + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE4 + Write '1' to enable interrupt for event COMPARE[4] + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE5 + Write '1' to enable interrupt for event COMPARE[5] + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + COMPARE0 + Write '1' to disable interrupt for event COMPARE[0] + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE1 + Write '1' to disable interrupt for event COMPARE[1] + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE2 + Write '1' to disable interrupt for event COMPARE[2] + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE3 + Write '1' to disable interrupt for event COMPARE[3] + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE4 + Write '1' to disable interrupt for event COMPARE[4] + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE5 + Write '1' to disable interrupt for event COMPARE[5] + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + MODE + Timer mode selection + 0x504 + read-write + + + MODE + Timer mode + 0 + 1 + + + Timer + Select Timer mode + 0 + + + Counter + Deprecated enumerator - Select Counter mode + 1 + + + LowPowerCounter + Select Low Power Counter mode + 2 + + + + + + + BITMODE + Configure the number of bits used by the TIMER + 0x508 + read-write + + + BITMODE + Timer bit width + 0 + 1 + + + 16Bit + 16 bit timer bit width + 0 + + + 08Bit + 8 bit timer bit width + 1 + + + 24Bit + 24 bit timer bit width + 2 + + + 32Bit + 32 bit timer bit width + 3 + + + + + + + PRESCALER + Timer prescaler register + 0x510 + read-write + 0x00000004 + + + PRESCALER + Prescaler value + 0 + 3 + + + + + 0x6 + 0x4 + CC[%s] + Description collection: Capture/Compare register n + 0x540 + read-write + + + CC + Capture/Compare value + 0 + 31 + + + + + + + TIMER1 + Timer/Counter 1 + 0x40009000 + + TIMER1 + 9 + + + + TIMER2 + Timer/Counter 2 + 0x4000A000 + + TIMER2 + 10 + + + + RTC0 + Real time counter 0 + 0x4000B000 + RTC + + 0 + 0x1000 + registers + + + RTC0 + 11 + + RTC + 0x20 + + + TASKS_START + Start RTC COUNTER + 0x000 + write-only + + + TASKS_START + Start RTC COUNTER + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stop RTC COUNTER + 0x004 + write-only + + + TASKS_STOP + Stop RTC COUNTER + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_CLEAR + Clear RTC COUNTER + 0x008 + write-only + + + TASKS_CLEAR + Clear RTC COUNTER + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_TRIGOVRFLW + Set COUNTER to 0xFFFFF0 + 0x00C + write-only + + + TASKS_TRIGOVRFLW + Set COUNTER to 0xFFFFF0 + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_TICK + Event on COUNTER increment + 0x100 + read-write + + + EVENTS_TICK + Event on COUNTER increment + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_OVRFLW + Event on COUNTER overflow + 0x104 + read-write + + + EVENTS_OVRFLW + Event on COUNTER overflow + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + 0x4 + 0x4 + EVENTS_COMPARE[%s] + Description collection: Compare event on CC[n] match + 0x140 + read-write + + + EVENTS_COMPARE + Compare event on CC[n] match + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + TICK + Write '1' to enable interrupt for event TICK + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + OVRFLW + Write '1' to enable interrupt for event OVRFLW + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE0 + Write '1' to enable interrupt for event COMPARE[0] + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE1 + Write '1' to enable interrupt for event COMPARE[1] + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE2 + Write '1' to enable interrupt for event COMPARE[2] + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE3 + Write '1' to enable interrupt for event COMPARE[3] + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + TICK + Write '1' to disable interrupt for event TICK + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + OVRFLW + Write '1' to disable interrupt for event OVRFLW + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE0 + Write '1' to disable interrupt for event COMPARE[0] + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE1 + Write '1' to disable interrupt for event COMPARE[1] + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE2 + Write '1' to disable interrupt for event COMPARE[2] + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE3 + Write '1' to disable interrupt for event COMPARE[3] + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + EVTEN + Enable or disable event routing + 0x340 + read-write + + + TICK + Enable or disable event routing for event TICK + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Disable + 1 + + + + + OVRFLW + Enable or disable event routing for event OVRFLW + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Disable + 1 + + + + + COMPARE0 + Enable or disable event routing for event COMPARE[0] + 16 + 16 + + + Disabled + Disable + 0 + + + Enabled + Disable + 1 + + + + + COMPARE1 + Enable or disable event routing for event COMPARE[1] + 17 + 17 + + + Disabled + Disable + 0 + + + Enabled + Disable + 1 + + + + + COMPARE2 + Enable or disable event routing for event COMPARE[2] + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Disable + 1 + + + + + COMPARE3 + Enable or disable event routing for event COMPARE[3] + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Disable + 1 + + + + + + + EVTENSET + Enable event routing + 0x344 + read-write + + + TICK + Write '1' to enable event routing for event TICK + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + OVRFLW + Write '1' to enable event routing for event OVRFLW + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE0 + Write '1' to enable event routing for event COMPARE[0] + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE1 + Write '1' to enable event routing for event COMPARE[1] + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE2 + Write '1' to enable event routing for event COMPARE[2] + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE3 + Write '1' to enable event routing for event COMPARE[3] + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + EVTENCLR + Disable event routing + 0x348 + read-write + + + TICK + Write '1' to disable event routing for event TICK + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + OVRFLW + Write '1' to disable event routing for event OVRFLW + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE0 + Write '1' to disable event routing for event COMPARE[0] + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE1 + Write '1' to disable event routing for event COMPARE[1] + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE2 + Write '1' to disable event routing for event COMPARE[2] + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE3 + Write '1' to disable event routing for event COMPARE[3] + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + COUNTER + Current COUNTER value + 0x504 + read-only + + + COUNTER + Counter value + 0 + 23 + + + + + PRESCALER + 12 bit prescaler for COUNTER frequency (32768/(PRESCALER+1)). Must be written when RTC is stopped. + 0x508 + read-write + + + PRESCALER + Prescaler value + 0 + 11 + + + + + 0x4 + 0x4 + CC[%s] + Description collection: Compare register n + 0x540 + read-write + + + COMPARE + Compare value + 0 + 23 + + + + + + + TEMP + Temperature Sensor + 0x4000C000 + + 0 + 0x1000 + registers + + + TEMP + 12 + + TEMP + 0x20 + + + TASKS_START + Start temperature measurement + 0x000 + write-only + + + TASKS_START + Start temperature measurement + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stop temperature measurement + 0x004 + write-only + + + TASKS_STOP + Stop temperature measurement + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_DATARDY + Temperature measurement complete, data ready + 0x100 + read-write + + + EVENTS_DATARDY + Temperature measurement complete, data ready + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + DATARDY + Write '1' to enable interrupt for event DATARDY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + DATARDY + Write '1' to disable interrupt for event DATARDY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + TEMP + Temperature in degC (0.25deg steps) + 0x508 + read-only + int32_t + + + TEMP + Temperature in degC (0.25deg steps) + 0 + 31 + + + + + A0 + Slope of first piecewise linear function + 0x520 + read-write + 0x00000326 + + + A0 + Slope of first piecewise linear function + 0 + 11 + + + + + A1 + Slope of second piecewise linear function + 0x524 + read-write + 0x00000348 + + + A1 + Slope of second piecewise linear function + 0 + 11 + + + + + A2 + Slope of third piecewise linear function + 0x528 + read-write + 0x000003AA + + + A2 + Slope of third piecewise linear function + 0 + 11 + + + + + A3 + Slope of fourth piecewise linear function + 0x52C + read-write + 0x0000040E + + + A3 + Slope of fourth piecewise linear function + 0 + 11 + + + + + A4 + Slope of fifth piecewise linear function + 0x530 + read-write + 0x000004BD + + + A4 + Slope of fifth piecewise linear function + 0 + 11 + + + + + A5 + Slope of sixth piecewise linear function + 0x534 + read-write + 0x000005A3 + + + A5 + Slope of sixth piecewise linear function + 0 + 11 + + + + + B0 + y-intercept of first piecewise linear function + 0x540 + read-write + 0x00003FEF + + + B0 + y-intercept of first piecewise linear function + 0 + 13 + + + + + B1 + y-intercept of second piecewise linear function + 0x544 + read-write + 0x00003FBE + + + B1 + y-intercept of second piecewise linear function + 0 + 13 + + + + + B2 + y-intercept of third piecewise linear function + 0x548 + read-write + 0x00003FBE + + + B2 + y-intercept of third piecewise linear function + 0 + 13 + + + + + B3 + y-intercept of fourth piecewise linear function + 0x54C + read-write + 0x00000012 + + + B3 + y-intercept of fourth piecewise linear function + 0 + 13 + + + + + B4 + y-intercept of fifth piecewise linear function + 0x550 + read-write + 0x00000124 + + + B4 + y-intercept of fifth piecewise linear function + 0 + 13 + + + + + B5 + y-intercept of sixth piecewise linear function + 0x554 + read-write + 0x0000027C + + + B5 + y-intercept of sixth piecewise linear function + 0 + 13 + + + + + T0 + End point of first piecewise linear function + 0x560 + read-write + 0x000000E2 + + + T0 + End point of first piecewise linear function + 0 + 7 + + + + + T1 + End point of second piecewise linear function + 0x564 + read-write + 0x00000000 + + + T1 + End point of second piecewise linear function + 0 + 7 + + + + + T2 + End point of third piecewise linear function + 0x568 + read-write + 0x00000019 + + + T2 + End point of third piecewise linear function + 0 + 7 + + + + + T3 + End point of fourth piecewise linear function + 0x56C + read-write + 0x0000003C + + + T3 + End point of fourth piecewise linear function + 0 + 7 + + + + + T4 + End point of fifth piecewise linear function + 0x570 + read-write + 0x00000050 + + + T4 + End point of fifth piecewise linear function + 0 + 7 + + + + + + + RNG + Random Number Generator + 0x4000D000 + + 0 + 0x1000 + registers + + + RNG + 13 + + RNG + 0x20 + + + TASKS_START + Task starting the random number generator + 0x000 + write-only + + + TASKS_START + Task starting the random number generator + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Task stopping the random number generator + 0x004 + write-only + + + TASKS_STOP + Task stopping the random number generator + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_VALRDY + Event being generated for every new random number written to the VALUE register + 0x100 + read-write + + + EVENTS_VALRDY + Event being generated for every new random number written to the VALUE register + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + VALRDY_STOP + Shortcut between event VALRDY and task STOP + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + VALRDY + Write '1' to enable interrupt for event VALRDY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + VALRDY + Write '1' to disable interrupt for event VALRDY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + CONFIG + Configuration register + 0x504 + read-write + + + DERCEN + Bias correction + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + + + VALUE + Output random number + 0x508 + read-only + + + VALUE + Generated random number + 0 + 7 + + + + + + + ECB + AES ECB Mode Encryption + 0x4000E000 + + 0 + 0x1000 + registers + + + ECB + 14 + + ECB + 0x20 + + + TASKS_STARTECB + Start ECB block encrypt + 0x000 + write-only + + + TASKS_STARTECB + Start ECB block encrypt + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOPECB + Abort a possible executing ECB operation + 0x004 + write-only + + + TASKS_STOPECB + Abort a possible executing ECB operation + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_ENDECB + ECB block encrypt complete + 0x100 + read-write + + + EVENTS_ENDECB + ECB block encrypt complete + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ERRORECB + ECB block encrypt aborted because of a STOPECB task or due to an error + 0x104 + read-write + + + EVENTS_ERRORECB + ECB block encrypt aborted because of a STOPECB task or due to an error + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + ENDECB + Write '1' to enable interrupt for event ENDECB + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERRORECB + Write '1' to enable interrupt for event ERRORECB + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + ENDECB + Write '1' to disable interrupt for event ENDECB + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERRORECB + Write '1' to disable interrupt for event ERRORECB + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ECBDATAPTR + ECB block encrypt memory pointers + 0x504 + read-write + + + ECBDATAPTR + Pointer to the ECB data structure (see Table 1 ECB data structure overview) + 0 + 31 + + + + + + + AAR + Accelerated Address Resolver + 0x4000F000 + + 0 + 0x1000 + registers + + + CCM_AAR + 15 + + AAR + 0x20 + + + TASKS_START + Start resolving addresses based on IRKs specified in the IRK data structure + 0x000 + write-only + + + TASKS_START + Start resolving addresses based on IRKs specified in the IRK data structure + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stop resolving addresses + 0x008 + write-only + + + TASKS_STOP + Stop resolving addresses + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_END + Address resolution procedure complete + 0x100 + read-write + + + EVENTS_END + Address resolution procedure complete + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_RESOLVED + Address resolved + 0x104 + read-write + + + EVENTS_RESOLVED + Address resolved + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_NOTRESOLVED + Address not resolved + 0x108 + read-write + + + EVENTS_NOTRESOLVED + Address not resolved + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + END + Write '1' to enable interrupt for event END + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RESOLVED + Write '1' to enable interrupt for event RESOLVED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + NOTRESOLVED + Write '1' to enable interrupt for event NOTRESOLVED + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + END + Write '1' to disable interrupt for event END + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RESOLVED + Write '1' to disable interrupt for event RESOLVED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + NOTRESOLVED + Write '1' to disable interrupt for event NOTRESOLVED + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + STATUS + Resolution status + 0x400 + read-only + + + STATUS + The IRK that was used last time an address was resolved + 0 + 3 + + + + + ENABLE + Enable AAR + 0x500 + read-write + + + ENABLE + Enable or disable AAR + 0 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 3 + + + + + + + NIRK + Number of IRKs + 0x504 + read-write + 0x00000001 + + + NIRK + Number of Identity Root Keys available in the IRK data structure + 0 + 4 + + + + + IRKPTR + Pointer to IRK data structure + 0x508 + read-write + + + IRKPTR + Pointer to the IRK data structure + 0 + 31 + + + + + ADDRPTR + Pointer to the resolvable address + 0x510 + read-write + + + ADDRPTR + Pointer to the resolvable address (6-bytes) + 0 + 31 + + + + + SCRATCHPTR + Pointer to data area used for temporary storage + 0x514 + read-write + + + SCRATCHPTR + Pointer to a scratch data area used for temporary storage during resolution. A space of minimum 3 bytes must be reserved. + 0 + 31 + + + + + + + CCM + AES CCM mode encryption + 0x4000F000 + AAR + + 0 + 0x1000 + registers + + + CCM_AAR + 15 + + CCM + 0x20 + + + TASKS_KSGEN + Start generation of keystream. This operation will stop by itself when completed. + 0x000 + write-only + + + TASKS_KSGEN + Start generation of keystream. This operation will stop by itself when completed. + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_CRYPT + Start encryption/decryption. This operation will stop by itself when completed. + 0x004 + write-only + + + TASKS_CRYPT + Start encryption/decryption. This operation will stop by itself when completed. + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stop encryption/decryption + 0x008 + write-only + + + TASKS_STOP + Stop encryption/decryption + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_RATEOVERRIDE + Override DATARATE setting in MODE register with the contents of the RATEOVERRIDE register for any ongoing encryption/decryption + 0x00C + write-only + + + TASKS_RATEOVERRIDE + Override DATARATE setting in MODE register with the contents of the RATEOVERRIDE register for any ongoing encryption/decryption + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_ENDKSGEN + Keystream generation complete + 0x100 + read-write + + + EVENTS_ENDKSGEN + Keystream generation complete + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ENDCRYPT + Encrypt/decrypt complete + 0x104 + read-write + + + EVENTS_ENDCRYPT + Encrypt/decrypt complete + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ERROR + Deprecated register - CCM error event + 0x108 + read-write + + + EVENTS_ERROR + Deprecated field - CCM error event + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + ENDKSGEN_CRYPT + Shortcut between event ENDKSGEN and task CRYPT + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + ENDKSGEN + Write '1' to enable interrupt for event ENDKSGEN + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDCRYPT + Write '1' to enable interrupt for event ENDCRYPT + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Deprecated intsetfield - Write '1' to enable interrupt for event ERROR + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + ENDKSGEN + Write '1' to disable interrupt for event ENDKSGEN + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDCRYPT + Write '1' to disable interrupt for event ENDCRYPT + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Deprecated intclrfield - Write '1' to disable interrupt for event ERROR + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + MICSTATUS + MIC check result + 0x400 + read-only + + + MICSTATUS + The result of the MIC check performed during the previous decryption operation + 0 + 0 + + + CheckFailed + MIC check failed + 0 + + + CheckPassed + MIC check passed + 1 + + + + + + + ENABLE + Enable + 0x500 + read-write + + + ENABLE + Enable or disable CCM + 0 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 2 + + + + + + + MODE + Operation mode + 0x504 + read-write + 0x00000001 + + + MODE + The mode of operation to be used. Settings in this register apply whenever either the KSGEN task or the CRYPT task is triggered. + 0 + 0 + + + Encryption + AES CCM packet encryption mode + 0 + + + Decryption + AES CCM packet decryption mode + 1 + + + + + DATARATE + Radio data rate that the CCM shall run synchronous with + 16 + 17 + + + 1Mbit + 1 Mbps + 0 + + + 2Mbit + 2 Mbps + 1 + + + 125Kbps + 125 kbps + 2 + + + 500Kbps + 500 kbps + 3 + + + + + LENGTH + Packet length configuration + 24 + 24 + + + Default + Default length. Effective length of LENGTH field in encrypted/decrypted packet is 5 bits. A keystream for packet payloads up to 27 bytes will be generated. + 0 + + + Extended + Extended length. Effective length of LENGTH field in encrypted/decrypted packet is 8 bits. A keystream for packet payloads up to MAXPACKETSIZE bytes will be generated. + 1 + + + + + + + CNFPTR + Pointer to data structure holding the AES key and the NONCE vector + 0x508 + read-write + + + CNFPTR + Pointer to the data structure holding the AES key and the CCM NONCE vector (see table CCM data structure overview) + 0 + 31 + + + + + INPTR + Input pointer + 0x50C + read-write + + + INPTR + Input pointer + 0 + 31 + + + + + OUTPTR + Output pointer + 0x510 + read-write + + + OUTPTR + Output pointer + 0 + 31 + + + + + SCRATCHPTR + Pointer to data area used for temporary storage + 0x514 + read-write + + + SCRATCHPTR + Pointer to a scratch data area used for temporary storage during keystream generation, + MIC generation and encryption/decryption. + 0 + 31 + + + + + MAXPACKETSIZE + Length of keystream generated when MODE.LENGTH = Extended + 0x518 + read-write + 0x000000FB + + + MAXPACKETSIZE + Length of keystream generated when MODE.LENGTH = Extended. This value must be greater than or equal to the subsequent packet payload to be encrypted/decrypted. + 0 + 7 + + + + + RATEOVERRIDE + Data rate override setting. + 0x51C + read-write + 0x00000000 + + + RATEOVERRIDE + Data rate override setting + 0 + 1 + + + 1Mbit + 1 Mbps + 0 + + + 2Mbit + 2 Mbps + 1 + + + 125Kbps + 125 kbps + 2 + + + 500Kbps + 500 kbps + 3 + + + + + + + + + WDT + Watchdog Timer + 0x40010000 + + 0 + 0x1000 + registers + + + WDT + 16 + + WDT + 0x20 + + + TASKS_START + Start the watchdog + 0x000 + write-only + + + TASKS_START + Start the watchdog + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_TIMEOUT + Watchdog timeout + 0x100 + read-write + + + EVENTS_TIMEOUT + Watchdog timeout + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + TIMEOUT + Write '1' to enable interrupt for event TIMEOUT + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + TIMEOUT + Write '1' to disable interrupt for event TIMEOUT + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + RUNSTATUS + Run status + 0x400 + read-only + + + RUNSTATUS + Indicates whether or not the watchdog is running + 0 + 0 + + + NotRunning + Watchdog not running + 0 + + + Running + Watchdog is running + 1 + + + + + + + REQSTATUS + Request status + 0x404 + read-only + 0x00000001 + + + RR0 + Request status for RR[0] register + 0 + 0 + + + DisabledOrRequested + RR[0] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[0] register is enabled, and are not yet requesting reload + 1 + + + + + RR1 + Request status for RR[1] register + 1 + 1 + + + DisabledOrRequested + RR[1] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[1] register is enabled, and are not yet requesting reload + 1 + + + + + RR2 + Request status for RR[2] register + 2 + 2 + + + DisabledOrRequested + RR[2] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[2] register is enabled, and are not yet requesting reload + 1 + + + + + RR3 + Request status for RR[3] register + 3 + 3 + + + DisabledOrRequested + RR[3] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[3] register is enabled, and are not yet requesting reload + 1 + + + + + RR4 + Request status for RR[4] register + 4 + 4 + + + DisabledOrRequested + RR[4] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[4] register is enabled, and are not yet requesting reload + 1 + + + + + RR5 + Request status for RR[5] register + 5 + 5 + + + DisabledOrRequested + RR[5] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[5] register is enabled, and are not yet requesting reload + 1 + + + + + RR6 + Request status for RR[6] register + 6 + 6 + + + DisabledOrRequested + RR[6] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[6] register is enabled, and are not yet requesting reload + 1 + + + + + RR7 + Request status for RR[7] register + 7 + 7 + + + DisabledOrRequested + RR[7] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[7] register is enabled, and are not yet requesting reload + 1 + + + + + + + CRV + Counter reload value + 0x504 + read-write + 0xFFFFFFFF + + + CRV + Counter reload value in number of cycles of the 32.768 kHz clock + 0 + 31 + + + + + RREN + Enable register for reload request registers + 0x508 + read-write + 0x00000001 + + + RR0 + Enable or disable RR[0] register + 0 + 0 + + + Disabled + Disable RR[0] register + 0 + + + Enabled + Enable RR[0] register + 1 + + + + + RR1 + Enable or disable RR[1] register + 1 + 1 + + + Disabled + Disable RR[1] register + 0 + + + Enabled + Enable RR[1] register + 1 + + + + + RR2 + Enable or disable RR[2] register + 2 + 2 + + + Disabled + Disable RR[2] register + 0 + + + Enabled + Enable RR[2] register + 1 + + + + + RR3 + Enable or disable RR[3] register + 3 + 3 + + + Disabled + Disable RR[3] register + 0 + + + Enabled + Enable RR[3] register + 1 + + + + + RR4 + Enable or disable RR[4] register + 4 + 4 + + + Disabled + Disable RR[4] register + 0 + + + Enabled + Enable RR[4] register + 1 + + + + + RR5 + Enable or disable RR[5] register + 5 + 5 + + + Disabled + Disable RR[5] register + 0 + + + Enabled + Enable RR[5] register + 1 + + + + + RR6 + Enable or disable RR[6] register + 6 + 6 + + + Disabled + Disable RR[6] register + 0 + + + Enabled + Enable RR[6] register + 1 + + + + + RR7 + Enable or disable RR[7] register + 7 + 7 + + + Disabled + Disable RR[7] register + 0 + + + Enabled + Enable RR[7] register + 1 + + + + + + + CONFIG + Configuration register + 0x50C + read-write + 0x00000001 + + + SLEEP + Configure the watchdog to either be paused, or kept running, while the CPU is sleeping + 0 + 0 + + + Pause + Pause watchdog while the CPU is sleeping + 0 + + + Run + Keep the watchdog running while the CPU is sleeping + 1 + + + + + HALT + Configure the watchdog to either be paused, or kept running, while the CPU is halted by the debugger + 3 + 3 + + + Pause + Pause watchdog while the CPU is halted by the debugger + 0 + + + Run + Keep the watchdog running while the CPU is halted by the debugger + 1 + + + + + + + 0x8 + 0x4 + RR[%s] + Description collection: Reload request n + 0x600 + write-only + + + RR + Reload request register + 0 + 31 + + + Reload + Value to request a reload of the watchdog timer + 0x6E524635 + + + + + + + + + RTC1 + Real time counter 1 + 0x40011000 + + RTC1 + 17 + + + + QDEC + Quadrature Decoder + 0x40012000 + + 0 + 0x1000 + registers + + + QDEC + 18 + + QDEC + 0x20 + + + TASKS_START + Task starting the quadrature decoder + 0x000 + write-only + + + TASKS_START + Task starting the quadrature decoder + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Task stopping the quadrature decoder + 0x004 + write-only + + + TASKS_STOP + Task stopping the quadrature decoder + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_READCLRACC + Read and clear ACC and ACCDBL + 0x008 + write-only + + + TASKS_READCLRACC + Read and clear ACC and ACCDBL + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_RDCLRACC + Read and clear ACC + 0x00C + write-only + + + TASKS_RDCLRACC + Read and clear ACC + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_RDCLRDBL + Read and clear ACCDBL + 0x010 + write-only + + + TASKS_RDCLRDBL + Read and clear ACCDBL + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_SAMPLERDY + Event being generated for every new sample value written to the SAMPLE register + 0x100 + read-write + + + EVENTS_SAMPLERDY + Event being generated for every new sample value written to the SAMPLE register + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_REPORTRDY + Non-null report ready + 0x104 + read-write + + + EVENTS_REPORTRDY + Non-null report ready + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ACCOF + ACC or ACCDBL register overflow + 0x108 + read-write + + + EVENTS_ACCOF + ACC or ACCDBL register overflow + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_DBLRDY + Double displacement(s) detected + 0x10C + read-write + + + EVENTS_DBLRDY + Double displacement(s) detected + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_STOPPED + QDEC has been stopped + 0x110 + read-write + + + EVENTS_STOPPED + QDEC has been stopped + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + REPORTRDY_READCLRACC + Shortcut between event REPORTRDY and task READCLRACC + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + SAMPLERDY_STOP + Shortcut between event SAMPLERDY and task STOP + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + REPORTRDY_RDCLRACC + Shortcut between event REPORTRDY and task RDCLRACC + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + REPORTRDY_STOP + Shortcut between event REPORTRDY and task STOP + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DBLRDY_RDCLRDBL + Shortcut between event DBLRDY and task RDCLRDBL + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DBLRDY_STOP + Shortcut between event DBLRDY and task STOP + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + SAMPLERDY_READCLRACC + Shortcut between event SAMPLERDY and task READCLRACC + 6 + 6 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + SAMPLERDY + Write '1' to enable interrupt for event SAMPLERDY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REPORTRDY + Write '1' to enable interrupt for event REPORTRDY + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ACCOF + Write '1' to enable interrupt for event ACCOF + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DBLRDY + Write '1' to enable interrupt for event DBLRDY + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STOPPED + Write '1' to enable interrupt for event STOPPED + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + SAMPLERDY + Write '1' to disable interrupt for event SAMPLERDY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REPORTRDY + Write '1' to disable interrupt for event REPORTRDY + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ACCOF + Write '1' to disable interrupt for event ACCOF + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DBLRDY + Write '1' to disable interrupt for event DBLRDY + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STOPPED + Write '1' to disable interrupt for event STOPPED + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + Enable the quadrature decoder + 0x500 + read-write + + + ENABLE + Enable or disable the quadrature decoder + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + LEDPOL + LED output pin polarity + 0x504 + read-write + + + LEDPOL + LED output pin polarity + 0 + 0 + + + ActiveLow + Led active on output pin low + 0 + + + ActiveHigh + Led active on output pin high + 1 + + + + + + + SAMPLEPER + Sample period + 0x508 + read-write + + + SAMPLEPER + Sample period. The SAMPLE register will be updated for every new sample + 0 + 3 + + + 128us + 128 us + 0 + + + 256us + 256 us + 1 + + + 512us + 512 us + 2 + + + 1024us + 1024 us + 3 + + + 2048us + 2048 us + 4 + + + 4096us + 4096 us + 5 + + + 8192us + 8192 us + 6 + + + 16384us + 16384 us + 7 + + + 32ms + 32768 us + 8 + + + 65ms + 65536 us + 9 + + + 131ms + 131072 us + 10 + + + + + + + SAMPLE + Motion sample value + 0x50C + read-only + int32_t + + + SAMPLE + Last motion sample + 0 + 31 + + + + + REPORTPER + Number of samples to be taken before REPORTRDY and DBLRDY events can be generated + 0x510 + read-write + + + REPORTPER + Specifies the number of samples to be accumulated in the ACC register before the REPORTRDY and DBLRDY events can be generated. + 0 + 3 + + + 10Smpl + 10 samples/report + 0 + + + 40Smpl + 40 samples/report + 1 + + + 80Smpl + 80 samples/report + 2 + + + 120Smpl + 120 samples/report + 3 + + + 160Smpl + 160 samples/report + 4 + + + 200Smpl + 200 samples/report + 5 + + + 240Smpl + 240 samples/report + 6 + + + 280Smpl + 280 samples/report + 7 + + + 1Smpl + 1 sample/report + 8 + + + + + + + ACC + Register accumulating the valid transitions + 0x514 + read-only + int32_t + + + ACC + Register accumulating all valid samples (not double transition) read from the SAMPLE register. + 0 + 31 + + + + + ACCREAD + Snapshot of the ACC register, updated by the READCLRACC or RDCLRACC task + 0x518 + read-only + int32_t + + + ACCREAD + Snapshot of the ACC register. + 0 + 31 + + + + + PSEL + Unspecified + QDEC_PSEL + read-write + 0x51C + + LED + Pin select for LED signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + A + Pin select for A signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + B + Pin select for B signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + DBFEN + Enable input debounce filters + 0x528 + read-write + + + DBFEN + Enable input debounce filters + 0 + 0 + + + Disabled + Debounce input filters disabled + 0 + + + Enabled + Debounce input filters enabled + 1 + + + + + + + LEDPRE + Time period the LED is switched ON prior to sampling + 0x540 + read-write + 0x00000010 + + + LEDPRE + Period in us the LED is switched on prior to sampling + 0 + 8 + + + + + ACCDBL + Register accumulating the number of detected double transitions + 0x544 + read-only + + + ACCDBL + Register accumulating the number of detected double or illegal transitions. ( SAMPLE = 2 ). + 0 + 3 + + + + + ACCDBLREAD + Snapshot of the ACCDBL, updated by the READCLRACC or RDCLRDBL task + 0x548 + read-only + + + ACCDBLREAD + Snapshot of the ACCDBL register. This field is updated when the READCLRACC or RDCLRDBL task is triggered. + 0 + 3 + + + + + + + COMP + Comparator + 0x40013000 + + 0 + 0x1000 + registers + + + COMP_LPCOMP + 19 + + COMP + 0x20 + + + TASKS_START + Start comparator + 0x000 + write-only + + + TASKS_START + Start comparator + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stop comparator + 0x004 + write-only + + + TASKS_STOP + Stop comparator + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_SAMPLE + Sample comparator value + 0x008 + write-only + + + TASKS_SAMPLE + Sample comparator value + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_READY + COMP is ready and output is valid + 0x100 + read-write + + + EVENTS_READY + COMP is ready and output is valid + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_DOWN + Downward crossing + 0x104 + read-write + + + EVENTS_DOWN + Downward crossing + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_UP + Upward crossing + 0x108 + read-write + + + EVENTS_UP + Upward crossing + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_CROSS + Downward or upward crossing + 0x10C + read-write + + + EVENTS_CROSS + Downward or upward crossing + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + READY_SAMPLE + Shortcut between event READY and task SAMPLE + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + READY_STOP + Shortcut between event READY and task STOP + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DOWN_STOP + Shortcut between event DOWN and task STOP + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + UP_STOP + Shortcut between event UP and task STOP + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + CROSS_STOP + Shortcut between event CROSS and task STOP + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + READY + Enable or disable interrupt for event READY + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + DOWN + Enable or disable interrupt for event DOWN + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + UP + Enable or disable interrupt for event UP + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CROSS + Enable or disable interrupt for event CROSS + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to enable interrupt for event READY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DOWN + Write '1' to enable interrupt for event DOWN + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + UP + Write '1' to enable interrupt for event UP + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CROSS + Write '1' to enable interrupt for event CROSS + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to disable interrupt for event READY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DOWN + Write '1' to disable interrupt for event DOWN + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + UP + Write '1' to disable interrupt for event UP + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CROSS + Write '1' to disable interrupt for event CROSS + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + RESULT + Compare result + 0x400 + read-only + + + RESULT + Result of last compare. Decision point SAMPLE task. + 0 + 0 + + + Below + Input voltage is below the threshold (VIN+ &lt; VIN-) + 0 + + + Above + Input voltage is above the threshold (VIN+ &gt; VIN-) + 1 + + + + + + + ENABLE + COMP enable + 0x500 + read-write + + + ENABLE + Enable or disable COMP + 0 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 2 + + + + + + + PSEL + Pin select + 0x504 + read-write + + + PSEL + Analog pin select + 0 + 2 + + + AnalogInput0 + AIN0 selected as analog input + 0 + + + AnalogInput1 + AIN1 selected as analog input + 1 + + + AnalogInput2 + AIN2 selected as analog input + 2 + + + AnalogInput3 + AIN3 selected as analog input + 3 + + + AnalogInput4 + AIN4 selected as analog input + 4 + + + AnalogInput5 + AIN5 selected as analog input + 5 + + + AnalogInput6 + AIN6 selected as analog input + 6 + + + AnalogInput7 + AIN7 selected as analog input + 7 + + + + + + + REFSEL + Reference source select for single-ended mode + 0x508 + read-write + 0x00000004 + + + REFSEL + Reference select + 0 + 2 + + + Int1V2 + VREF = internal 1.2 V reference (VDD &gt;= 1.7 V) + 0 + + + Int1V8 + VREF = internal 1.8 V reference (VDD &gt;= VREF + 0.2 V) + 1 + + + Int2V4 + VREF = internal 2.4 V reference (VDD &gt;= VREF + 0.2 V) + 2 + + + VDD + VREF = VDD + 4 + + + ARef + VREF = AREF + 5 + + + + + + + EXTREFSEL + External reference select + 0x50C + read-write + + + EXTREFSEL + External analog reference select + 0 + 2 + + + AnalogReference0 + Use AIN0 as external analog reference + 0 + + + AnalogReference1 + Use AIN1 as external analog reference + 1 + + + AnalogReference2 + Use AIN2 as external analog reference + 2 + + + AnalogReference3 + Use AIN3 as external analog reference + 3 + + + AnalogReference4 + Use AIN4 as external analog reference + 4 + + + AnalogReference5 + Use AIN5 as external analog reference + 5 + + + AnalogReference6 + Use AIN6 as external analog reference + 6 + + + AnalogReference7 + Use AIN7 as external analog reference + 7 + + + + + + + TH + Threshold configuration for hysteresis unit + 0x530 + read-write + 0x00000000 + + + THDOWN + VDOWN = (THDOWN+1)/64*VREF + 0 + 5 + + + THUP + VUP = (THUP+1)/64*VREF + 8 + 13 + + + + + MODE + Mode configuration + 0x534 + read-write + + + SP + Speed and power modes + 0 + 1 + + + Low + Low-power mode + 0 + + + Normal + Normal mode + 1 + + + High + High-speed mode + 2 + + + + + MAIN + Main operation modes + 8 + 8 + + + SE + Single-ended mode + 0 + + + Diff + Differential mode + 1 + + + + + + + HYST + Comparator hysteresis enable + 0x538 + read-write + + + HYST + Comparator hysteresis + 0 + 0 + + + NoHyst + Comparator hysteresis disabled + 0 + + + Hyst50mV + Comparator hysteresis enabled + 1 + + + + + + + + + LPCOMP + Low-power comparator + 0x40013000 + COMP + + 0 + 0x1000 + registers + + + COMP_LPCOMP + 19 + + LPCOMP + 0x20 + + + TASKS_START + Start comparator + 0x000 + write-only + + + TASKS_START + Start comparator + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stop comparator + 0x004 + write-only + + + TASKS_STOP + Stop comparator + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_SAMPLE + Sample comparator value + 0x008 + write-only + + + TASKS_SAMPLE + Sample comparator value + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_READY + LPCOMP is ready and output is valid + 0x100 + read-write + + + EVENTS_READY + LPCOMP is ready and output is valid + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_DOWN + Downward crossing + 0x104 + read-write + + + EVENTS_DOWN + Downward crossing + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_UP + Upward crossing + 0x108 + read-write + + + EVENTS_UP + Upward crossing + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_CROSS + Downward or upward crossing + 0x10C + read-write + + + EVENTS_CROSS + Downward or upward crossing + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + READY_SAMPLE + Shortcut between event READY and task SAMPLE + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + READY_STOP + Shortcut between event READY and task STOP + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DOWN_STOP + Shortcut between event DOWN and task STOP + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + UP_STOP + Shortcut between event UP and task STOP + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + CROSS_STOP + Shortcut between event CROSS and task STOP + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to enable interrupt for event READY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DOWN + Write '1' to enable interrupt for event DOWN + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + UP + Write '1' to enable interrupt for event UP + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CROSS + Write '1' to enable interrupt for event CROSS + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to disable interrupt for event READY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DOWN + Write '1' to disable interrupt for event DOWN + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + UP + Write '1' to disable interrupt for event UP + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CROSS + Write '1' to disable interrupt for event CROSS + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + RESULT + Compare result + 0x400 + read-only + + + RESULT + Result of last compare. Decision point SAMPLE task. + 0 + 0 + + + Below + Input voltage is below the reference threshold (VIN+ &lt; VIN-) + 0 + + + Above + Input voltage is above the reference threshold (VIN+ &gt; VIN-) + 1 + + + + + + + ENABLE + Enable LPCOMP + 0x500 + read-write + + + ENABLE + Enable or disable LPCOMP + 0 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + PSEL + Input pin select + 0x504 + read-write + + + PSEL + Analog pin select + 0 + 2 + + + AnalogInput0 + AIN0 selected as analog input + 0 + + + AnalogInput1 + AIN1 selected as analog input + 1 + + + AnalogInput2 + AIN2 selected as analog input + 2 + + + AnalogInput3 + AIN3 selected as analog input + 3 + + + AnalogInput4 + AIN4 selected as analog input + 4 + + + AnalogInput5 + AIN5 selected as analog input + 5 + + + AnalogInput6 + AIN6 selected as analog input + 6 + + + AnalogInput7 + AIN7 selected as analog input + 7 + + + + + + + REFSEL + Reference select + 0x508 + read-write + 0x00000004 + + + REFSEL + Reference select + 0 + 3 + + + Ref1_8Vdd + VDD * 1/8 selected as reference + 0 + + + Ref2_8Vdd + VDD * 2/8 selected as reference + 1 + + + Ref3_8Vdd + VDD * 3/8 selected as reference + 2 + + + Ref4_8Vdd + VDD * 4/8 selected as reference + 3 + + + Ref5_8Vdd + VDD * 5/8 selected as reference + 4 + + + Ref6_8Vdd + VDD * 6/8 selected as reference + 5 + + + Ref7_8Vdd + VDD * 7/8 selected as reference + 6 + + + ARef + External analog reference selected + 7 + + + Ref1_16Vdd + VDD * 1/16 selected as reference + 8 + + + Ref3_16Vdd + VDD * 3/16 selected as reference + 9 + + + Ref5_16Vdd + VDD * 5/16 selected as reference + 10 + + + Ref7_16Vdd + VDD * 7/16 selected as reference + 11 + + + Ref9_16Vdd + VDD * 9/16 selected as reference + 12 + + + Ref11_16Vdd + VDD * 11/16 selected as reference + 13 + + + Ref13_16Vdd + VDD * 13/16 selected as reference + 14 + + + Ref15_16Vdd + VDD * 15/16 selected as reference + 15 + + + + + + + EXTREFSEL + External reference select + 0x50C + read-write + + + EXTREFSEL + External analog reference select + 0 + 0 + + + AnalogReference0 + Use AIN0 as external analog reference + 0 + + + AnalogReference1 + Use AIN1 as external analog reference + 1 + + + + + + + ANADETECT + Analog detect configuration + 0x520 + read-write + + + ANADETECT + Analog detect configuration + 0 + 1 + + + Cross + Generate ANADETECT on crossing, both upward crossing and downward crossing + 0 + + + Up + Generate ANADETECT on upward crossing only + 1 + + + Down + Generate ANADETECT on downward crossing only + 2 + + + + + + + HYST + Comparator hysteresis enable + 0x538 + read-write + + + HYST + Comparator hysteresis enable + 0 + 0 + + + Disabled + Comparator hysteresis disabled + 0 + + + Enabled + Comparator hysteresis enabled + 1 + + + + + + + + + EGU0 + Event generator unit 0 + 0x40014000 + EGU + + 0 + 0x1000 + registers + + + SWI0_EGU0 + 20 + + EGU + 0x20 + + + 0x10 + 0x4 + TASKS_TRIGGER[%s] + Description collection: Trigger n for triggering the corresponding TRIGGERED[n] event + 0x000 + write-only + + + TASKS_TRIGGER + Trigger n for triggering the corresponding TRIGGERED[n] event + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + 0x10 + 0x4 + EVENTS_TRIGGERED[%s] + Description collection: Event number n generated by triggering the corresponding TRIGGER[n] task + 0x100 + read-write + + + EVENTS_TRIGGERED + Event number n generated by triggering the corresponding TRIGGER[n] task + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + TRIGGERED0 + Enable or disable interrupt for event TRIGGERED[0] + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED1 + Enable or disable interrupt for event TRIGGERED[1] + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED2 + Enable or disable interrupt for event TRIGGERED[2] + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED3 + Enable or disable interrupt for event TRIGGERED[3] + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED4 + Enable or disable interrupt for event TRIGGERED[4] + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED5 + Enable or disable interrupt for event TRIGGERED[5] + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED6 + Enable or disable interrupt for event TRIGGERED[6] + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED7 + Enable or disable interrupt for event TRIGGERED[7] + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED8 + Enable or disable interrupt for event TRIGGERED[8] + 8 + 8 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED9 + Enable or disable interrupt for event TRIGGERED[9] + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED10 + Enable or disable interrupt for event TRIGGERED[10] + 10 + 10 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED11 + Enable or disable interrupt for event TRIGGERED[11] + 11 + 11 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED12 + Enable or disable interrupt for event TRIGGERED[12] + 12 + 12 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED13 + Enable or disable interrupt for event TRIGGERED[13] + 13 + 13 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED14 + Enable or disable interrupt for event TRIGGERED[14] + 14 + 14 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED15 + Enable or disable interrupt for event TRIGGERED[15] + 15 + 15 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + TRIGGERED0 + Write '1' to enable interrupt for event TRIGGERED[0] + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED1 + Write '1' to enable interrupt for event TRIGGERED[1] + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED2 + Write '1' to enable interrupt for event TRIGGERED[2] + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED3 + Write '1' to enable interrupt for event TRIGGERED[3] + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED4 + Write '1' to enable interrupt for event TRIGGERED[4] + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED5 + Write '1' to enable interrupt for event TRIGGERED[5] + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED6 + Write '1' to enable interrupt for event TRIGGERED[6] + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED7 + Write '1' to enable interrupt for event TRIGGERED[7] + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED8 + Write '1' to enable interrupt for event TRIGGERED[8] + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED9 + Write '1' to enable interrupt for event TRIGGERED[9] + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED10 + Write '1' to enable interrupt for event TRIGGERED[10] + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED11 + Write '1' to enable interrupt for event TRIGGERED[11] + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED12 + Write '1' to enable interrupt for event TRIGGERED[12] + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED13 + Write '1' to enable interrupt for event TRIGGERED[13] + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED14 + Write '1' to enable interrupt for event TRIGGERED[14] + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED15 + Write '1' to enable interrupt for event TRIGGERED[15] + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + TRIGGERED0 + Write '1' to disable interrupt for event TRIGGERED[0] + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED1 + Write '1' to disable interrupt for event TRIGGERED[1] + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED2 + Write '1' to disable interrupt for event TRIGGERED[2] + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED3 + Write '1' to disable interrupt for event TRIGGERED[3] + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED4 + Write '1' to disable interrupt for event TRIGGERED[4] + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED5 + Write '1' to disable interrupt for event TRIGGERED[5] + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED6 + Write '1' to disable interrupt for event TRIGGERED[6] + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED7 + Write '1' to disable interrupt for event TRIGGERED[7] + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED8 + Write '1' to disable interrupt for event TRIGGERED[8] + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED9 + Write '1' to disable interrupt for event TRIGGERED[9] + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED10 + Write '1' to disable interrupt for event TRIGGERED[10] + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED11 + Write '1' to disable interrupt for event TRIGGERED[11] + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED12 + Write '1' to disable interrupt for event TRIGGERED[12] + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED13 + Write '1' to disable interrupt for event TRIGGERED[13] + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED14 + Write '1' to disable interrupt for event TRIGGERED[14] + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED15 + Write '1' to disable interrupt for event TRIGGERED[15] + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + + + SWI0 + Software interrupt 0 + 0x40014000 + EGU0 + SWI + + 0 + 0x1000 + registers + + + SWI0_EGU0 + 20 + + SWI + 0x20 + + + UNUSED + Unused. + 0x000 + 0x00000000 + read-only + + + + + EGU1 + Event generator unit 1 + 0x40015000 + + SWI1_EGU1 + 21 + + + + SWI1 + Software interrupt 1 + 0x40015000 + EGU1 + + SWI1_EGU1 + 21 + + + + EGU2 + Event generator unit 2 + 0x40016000 + + SWI2_EGU2 + 22 + + + + SWI2 + Software interrupt 2 + 0x40016000 + EGU2 + + SWI2_EGU2 + 22 + + + + EGU3 + Event generator unit 3 + 0x40017000 + + SWI3_EGU3 + 23 + + + + SWI3 + Software interrupt 3 + 0x40017000 + EGU3 + + SWI3_EGU3 + 23 + + + + EGU4 + Event generator unit 4 + 0x40018000 + + SWI4_EGU4 + 24 + + + + SWI4 + Software interrupt 4 + 0x40018000 + EGU4 + + SWI4_EGU4 + 24 + + + + EGU5 + Event generator unit 5 + 0x40019000 + + SWI5_EGU5 + 25 + + + + SWI5 + Software interrupt 5 + 0x40019000 + EGU5 + + SWI5_EGU5 + 25 + + + + TIMER3 + Timer/Counter 3 + 0x4001A000 + + TIMER3 + 26 + + + + TIMER4 + Timer/Counter 4 + 0x4001B000 + + TIMER4 + 27 + + + + PWM0 + Pulse width modulation unit 0 + 0x4001C000 + PWM + + 0 + 0x1000 + registers + + + PWM0 + 28 + + PWM + 0x20 + + + TASKS_STOP + Stops PWM pulse generation on all channels at the end of current PWM period, and stops sequence playback + 0x004 + write-only + + + TASKS_STOP + Stops PWM pulse generation on all channels at the end of current PWM period, and stops sequence playback + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + 0x2 + 0x4 + TASKS_SEQSTART[%s] + Description collection: Loads the first PWM value on all enabled channels from sequence n, and starts playing that sequence at the rate defined in SEQ[n]REFRESH and/or DECODER.MODE. Causes PWM generation to start if not running. + 0x008 + write-only + + + TASKS_SEQSTART + Loads the first PWM value on all enabled channels from sequence n, and starts playing that sequence at the rate defined in SEQ[n]REFRESH and/or DECODER.MODE. Causes PWM generation to start if not running. + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_NEXTSTEP + Steps by one value in the current sequence on all enabled channels if DECODER.MODE=NextStep. Does not cause PWM generation to start if not running. + 0x010 + write-only + + + TASKS_NEXTSTEP + Steps by one value in the current sequence on all enabled channels if DECODER.MODE=NextStep. Does not cause PWM generation to start if not running. + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_STOPPED + Response to STOP task, emitted when PWM pulses are no longer generated + 0x104 + read-write + + + EVENTS_STOPPED + Response to STOP task, emitted when PWM pulses are no longer generated + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + 0x2 + 0x4 + EVENTS_SEQSTARTED[%s] + Description collection: First PWM period started on sequence n + 0x108 + read-write + + + EVENTS_SEQSTARTED + First PWM period started on sequence n + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + 0x2 + 0x4 + EVENTS_SEQEND[%s] + Description collection: Emitted at end of every sequence n, when last value from RAM has been applied to wave counter + 0x110 + read-write + + + EVENTS_SEQEND + Emitted at end of every sequence n, when last value from RAM has been applied to wave counter + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_PWMPERIODEND + Emitted at the end of each PWM period + 0x118 + read-write + + + EVENTS_PWMPERIODEND + Emitted at the end of each PWM period + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_LOOPSDONE + Concatenated sequences have been played the amount of times defined in LOOP.CNT + 0x11C + read-write + + + EVENTS_LOOPSDONE + Concatenated sequences have been played the amount of times defined in LOOP.CNT + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + SEQEND0_STOP + Shortcut between event SEQEND[0] and task STOP + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + SEQEND1_STOP + Shortcut between event SEQEND[1] and task STOP + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LOOPSDONE_SEQSTART0 + Shortcut between event LOOPSDONE and task SEQSTART[0] + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LOOPSDONE_SEQSTART1 + Shortcut between event LOOPSDONE and task SEQSTART[1] + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LOOPSDONE_STOP + Shortcut between event LOOPSDONE and task STOP + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STOPPED + Enable or disable interrupt for event STOPPED + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SEQSTARTED0 + Enable or disable interrupt for event SEQSTARTED[0] + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SEQSTARTED1 + Enable or disable interrupt for event SEQSTARTED[1] + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SEQEND0 + Enable or disable interrupt for event SEQEND[0] + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SEQEND1 + Enable or disable interrupt for event SEQEND[1] + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PWMPERIODEND + Enable or disable interrupt for event PWMPERIODEND + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + LOOPSDONE + Enable or disable interrupt for event LOOPSDONE + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to enable interrupt for event STOPPED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SEQSTARTED0 + Write '1' to enable interrupt for event SEQSTARTED[0] + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SEQSTARTED1 + Write '1' to enable interrupt for event SEQSTARTED[1] + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SEQEND0 + Write '1' to enable interrupt for event SEQEND[0] + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SEQEND1 + Write '1' to enable interrupt for event SEQEND[1] + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PWMPERIODEND + Write '1' to enable interrupt for event PWMPERIODEND + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + LOOPSDONE + Write '1' to enable interrupt for event LOOPSDONE + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to disable interrupt for event STOPPED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SEQSTARTED0 + Write '1' to disable interrupt for event SEQSTARTED[0] + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SEQSTARTED1 + Write '1' to disable interrupt for event SEQSTARTED[1] + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SEQEND0 + Write '1' to disable interrupt for event SEQEND[0] + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SEQEND1 + Write '1' to disable interrupt for event SEQEND[1] + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PWMPERIODEND + Write '1' to disable interrupt for event PWMPERIODEND + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + LOOPSDONE + Write '1' to disable interrupt for event LOOPSDONE + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + PWM module enable register + 0x500 + read-write + 0x00000000 + + + ENABLE + Enable or disable PWM module + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enable + 1 + + + + + + + MODE + Selects operating mode of the wave counter + 0x504 + read-write + 0x00000000 + + + UPDOWN + Selects up mode or up-and-down mode for the counter + 0 + 0 + + + Up + Up counter, edge-aligned PWM duty cycle + 0 + + + UpAndDown + Up and down counter, center-aligned PWM duty cycle + 1 + + + + + + + COUNTERTOP + Value up to which the pulse generator counter counts + 0x508 + read-write + 0x000003FF + + + COUNTERTOP + Value up to which the pulse generator counter counts. This register is ignored when DECODER.MODE=WaveForm and only values from RAM are used. + 0 + 14 + + + + + PRESCALER + Configuration for PWM_CLK + 0x50C + read-write + 0x00000000 + + + PRESCALER + Prescaler of PWM_CLK + 0 + 2 + + + DIV_1 + Divide by 1 (16 MHz) + 0 + + + DIV_2 + Divide by 2 (8 MHz) + 1 + + + DIV_4 + Divide by 4 (4 MHz) + 2 + + + DIV_8 + Divide by 8 (2 MHz) + 3 + + + DIV_16 + Divide by 16 (1 MHz) + 4 + + + DIV_32 + Divide by 32 (500 kHz) + 5 + + + DIV_64 + Divide by 64 (250 kHz) + 6 + + + DIV_128 + Divide by 128 (125 kHz) + 7 + + + + + + + DECODER + Configuration of the decoder + 0x510 + read-write + 0x00000000 + + + LOAD + How a sequence is read from RAM and spread to the compare register + 0 + 1 + + + Common + 1st half word (16-bit) used in all PWM channels 0..3 + 0 + + + Grouped + 1st half word (16-bit) used in channel 0..1; 2nd word in channel 2..3 + 1 + + + Individual + 1st half word (16-bit) in ch.0; 2nd in ch.1; ...; 4th in ch.3 + 2 + + + WaveForm + 1st half word (16-bit) in ch.0; 2nd in ch.1; ...; 4th in COUNTERTOP + 3 + + + + + MODE + Selects source for advancing the active sequence + 8 + 8 + + + RefreshCount + SEQ[n].REFRESH is used to determine loading internal compare registers + 0 + + + NextStep + NEXTSTEP task causes a new value to be loaded to internal compare registers + 1 + + + + + + + LOOP + Number of playbacks of a loop + 0x514 + read-write + 0x00000000 + + + CNT + Number of playbacks of pattern cycles + 0 + 15 + + + Disabled + Looping disabled (stop at the end of the sequence) + 0 + + + + + + + 2 + 0x020 + SEQ[%s] + Unspecified + PWM_SEQ + read-write + 0x520 + + PTR + Description cluster: Beginning address in RAM of this sequence + 0x000 + read-write + 0x00000000 + + + PTR + Beginning address in RAM of this sequence + 0 + 31 + + + + + CNT + Description cluster: Number of values (duty cycles) in this sequence + 0x004 + read-write + 0x00000000 + + + CNT + Number of values (duty cycles) in this sequence + 0 + 14 + + + Disabled + Sequence is disabled, and shall not be started as it is empty + 0 + + + + + + + REFRESH + Description cluster: Number of additional PWM periods between samples loaded into compare register + 0x008 + read-write + 0x00000001 + + + CNT + Number of additional PWM periods between samples loaded into compare register (load every REFRESH.CNT+1 PWM periods) + 0 + 23 + + + Continuous + Update every PWM period + 0 + + + + + + + ENDDELAY + Description cluster: Time added after the sequence + 0x00C + read-write + 0x00000000 + + + CNT + Time added after the sequence in PWM periods + 0 + 23 + + + + + + PSEL + Unspecified + PWM_PSEL + read-write + 0x560 + + 0x4 + 0x4 + OUT[%s] + Description collection: Output pin select for PWM channel n + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + + + PDM + Pulse Density Modulation (Digital Microphone) Interface + 0x4001D000 + + 0 + 0x1000 + registers + + + PDM + 29 + + PDM + 0x20 + + + TASKS_START + Starts continuous PDM transfer + 0x000 + write-only + + + TASKS_START + Starts continuous PDM transfer + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stops PDM transfer + 0x004 + write-only + + + TASKS_STOP + Stops PDM transfer + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_STARTED + PDM transfer has started + 0x100 + read-write + + + EVENTS_STARTED + PDM transfer has started + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_STOPPED + PDM transfer has finished + 0x104 + read-write + + + EVENTS_STOPPED + PDM transfer has finished + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_END + The PDM has written the last sample specified by SAMPLE.MAXCNT (or the last sample after a STOP task has been received) to Data RAM + 0x108 + read-write + + + EVENTS_END + The PDM has written the last sample specified by SAMPLE.MAXCNT (or the last sample after a STOP task has been received) to Data RAM + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STARTED + Enable or disable interrupt for event STARTED + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STOPPED + Enable or disable interrupt for event STOPPED + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + END + Enable or disable interrupt for event END + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STARTED + Write '1' to enable interrupt for event STARTED + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STOPPED + Write '1' to enable interrupt for event STOPPED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + END + Write '1' to enable interrupt for event END + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STARTED + Write '1' to disable interrupt for event STARTED + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STOPPED + Write '1' to disable interrupt for event STOPPED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + END + Write '1' to disable interrupt for event END + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + PDM module enable register + 0x500 + read-write + 0x00000000 + + + ENABLE + Enable or disable PDM module + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + PDMCLKCTRL + PDM clock generator control + 0x504 + read-write + 0x08400000 + + + FREQ + PDM_CLK frequency configuration + 0 + 31 + + + 1000K + PDM_CLK = 32 MHz / 32 = 1.000 MHz + 0x08000000 + + + Default + PDM_CLK = 32 MHz / 31 = 1.032 MHz. Nominal clock for RATIO=Ratio64. + 0x08400000 + + + 1067K + PDM_CLK = 32 MHz / 30 = 1.067 MHz + 0x08800000 + + + 1231K + PDM_CLK = 32 MHz / 26 = 1.231 MHz + 0x09800000 + + + 1280K + PDM_CLK = 32 MHz / 25 = 1.280 MHz. Nominal clock for RATIO=Ratio80. + 0x0A000000 + + + 1333K + PDM_CLK = 32 MHz / 24 = 1.333 MHz + 0x0A800000 + + + + + + + MODE + Defines the routing of the connected PDM microphones' signals + 0x508 + read-write + 0x00000000 + + + OPERATION + Mono or stereo operation + 0 + 0 + + + Stereo + Sample and store one pair (left + right) of 16-bit samples per RAM word R=[31:16]; L=[15:0] + 0 + + + Mono + Sample and store two successive left samples (16 bits each) per RAM word L1=[31:16]; L0=[15:0] + 1 + + + + + EDGE + Defines on which PDM_CLK edge left (or mono) is sampled + 1 + 1 + + + LeftFalling + Left (or mono) is sampled on falling edge of PDM_CLK + 0 + + + LeftRising + Left (or mono) is sampled on rising edge of PDM_CLK + 1 + + + + + + + GAINL + Left output gain adjustment + 0x518 + read-write + 0x00000028 + + + GAINL + Left output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters) 0x00 -20 dB gain adjust 0x01 -19.5 dB gain adjust (...) 0x27 -0.5 dB gain adjust 0x28 0 dB gain adjust 0x29 +0.5 dB gain adjust (...) 0x4F +19.5 dB gain adjust 0x50 +20 dB gain adjust + 0 + 6 + + + MinGain + -20 dB gain adjustment (minimum) + 0x00 + + + DefaultGain + 0 dB gain adjustment + 0x28 + + + MaxGain + +20 dB gain adjustment (maximum) + 0x50 + + + + + + + GAINR + Right output gain adjustment + 0x51C + read-write + 0x00000028 + + + GAINR + Right output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters) + 0 + 6 + + + MinGain + -20 dB gain adjustment (minimum) + 0x00 + + + DefaultGain + 0 dB gain adjustment + 0x28 + + + MaxGain + +20 dB gain adjustment (maximum) + 0x50 + + + + + + + RATIO + Selects the ratio between PDM_CLK and output sample rate. Change PDMCLKCTRL accordingly. + 0x520 + read-write + 0x00000000 + + + RATIO + Selects the ratio between PDM_CLK and output sample rate + 0 + 0 + + + Ratio64 + Ratio of 64 + 0 + + + Ratio80 + Ratio of 80 + 1 + + + + + + + PSEL + Unspecified + PDM_PSEL + read-write + 0x540 + + CLK + Pin number configuration for PDM CLK signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + DIN + Pin number configuration for PDM DIN signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + SAMPLE + Unspecified + PDM_SAMPLE + read-write + 0x560 + + PTR + RAM address pointer to write samples to with EasyDMA + 0x000 + read-write + + + SAMPLEPTR + Address to write PDM samples to over DMA + 0 + 31 + + + + + MAXCNT + Number of samples to allocate memory for in EasyDMA mode + 0x004 + read-write + + + BUFFSIZE + Length of DMA RAM allocation in number of samples + 0 + 14 + + + + + + + + ACL + Access control lists + 0x4001E000 + + 0 + 0x1000 + registers + + ACL + 0x20 + + + 8 + 0x010 + ACL[%s] + Unspecified + ACL_ACL + read-write + 0x800 + + ADDR + Description cluster: Start address of region to protect. The start address must be word-aligned. + 0x000 + read-writeonce + 0x00000000 + + + ADDR + Start address of flash region n. The start address must point to a flash page boundary. + 0 + 31 + + + + + SIZE + Description cluster: Size of region to protect counting from address ACL[n].ADDR. Writing a '0' has no effect. + 0x004 + read-writeonce + 0x00000000 + + + SIZE + Size of flash region n in bytes. Must be a multiple of the flash page size. + 0 + 31 + + + + + PERM + Description cluster: Access permissions for region n as defined by start address ACL[n].ADDR and size ACL[n].SIZE + 0x008 + read-writeonce + 0x00000000 + + + WRITE + Configure write and erase permissions for region n. Writing a '0' has no effect. + 1 + 1 + + + Enable + Allow write and erase instructions to region n. + 0 + + + Disable + Block write and erase instructions to region n. + 1 + + + + + READ + Configure read permissions for region n. Writing a '0' has no effect. + 2 + 2 + + + Enable + Allow read instructions to region n. + 0 + + + Disable + Block read instructions to region n. + 1 + + + + + + + + + + NVMC + Non Volatile Memory Controller + 0x4001E000 + ACL + + 0 + 0x1000 + registers + + NVMC + 0x20 + + + READY + Ready flag + 0x400 + read-only + 0x00000001 + + + READY + NVMC is ready or busy + 0 + 0 + + + Busy + NVMC is busy (on-going write or erase operation) + 0 + + + Ready + NVMC is ready + 1 + + + + + + + READYNEXT + Ready flag + 0x408 + read-only + 0x00000001 + + + READYNEXT + NVMC can accept a new write operation + 0 + 0 + + + Busy + NVMC cannot accept any write operation + 0 + + + Ready + NVMC is ready + 1 + + + + + + + CONFIG + Configuration register + 0x504 + read-write + + + WEN + Program memory access mode. It is strongly recommended to only activate erase and write modes when they are actively used. Enabling write or erase will invalidate the cache and keep it invalidated. + 0 + 1 + + + Ren + Read only access + 0 + + + Wen + Write enabled + 1 + + + Een + Erase enabled + 2 + + + + + + + ERASEPAGE + Register for erasing a page in code area + 0x508 + write-only + + + ERASEPAGE + Register for starting erase of a page in code area + 0 + 31 + + + + + ERASEPCR1 + Deprecated register - Register for erasing a page in code area, equivalent to ERASEPAGE + 0x508 + write-only + ERASEPAGE + + + ERASEPCR1 + Register for erasing a page in code area, equivalent to ERASEPAGE + 0 + 31 + + + + + ERASEALL + Register for erasing all non-volatile user memory + 0x50C + write-only + + + ERASEALL + Erase all non-volatile memory including UICR registers. The erase must be enabled using CONFIG.WEN before the non-volatile memory can be erased. + 0 + 0 + + + NoOperation + No operation + 0 + + + Erase + Start chip erase + 1 + + + + + + + ERASEPCR0 + Deprecated register - Register for erasing a page in code area, equivalent to ERASEPAGE + 0x510 + write-only + + + ERASEPCR0 + Register for starting erase of a page in code area, equivalent to ERASEPAGE + 0 + 31 + + + + + ERASEUICR + Register for erasing user information configuration registers + 0x514 + write-only + + + ERASEUICR + Register starting erase of all user information configuration registers. The erase must be enabled using CONFIG.WEN before the UICR can be erased. + 0 + 0 + + + NoOperation + No operation + 0 + + + Erase + Start erase of UICR + 1 + + + + + + + ERASEPAGEPARTIAL + Register for partial erase of a page in code area + 0x518 + write-only + + + ERASEPAGEPARTIAL + Register for starting partial erase of a page in code area + 0 + 31 + + + + + ERASEPAGEPARTIALCFG + Register for partial erase configuration + 0x51C + read-write + 0x0000000A + + + DURATION + Duration of the partial erase in milliseconds + 0 + 6 + + + + + ICACHECNF + I-code cache configuration register + 0x540 + read-write + 0x00000000 + + + CACHEEN + Cache enable + 0 + 0 + + + Disabled + Disable cache. Invalidates all cache entries. + 0 + + + Enabled + Enable cache + 1 + + + + + CACHEPROFEN + Cache profiling enable + 8 + 8 + + + Disabled + Disable cache profiling + 0 + + + Enabled + Enable cache profiling + 1 + + + + + + + IHIT + I-code cache hit counter + 0x548 + read-write + + + HITS + Number of cache hits. Register is writable, but only to '0'. + 0 + 31 + + + + + IMISS + I-code cache miss counter + 0x54C + read-write + + + MISSES + Number of cache misses. Register is writable, but only to '0'. + 0 + 31 + + + + + + + PPI + Programmable Peripheral Interconnect + 0x4001F000 + + 0 + 0x1000 + registers + + PPI + 0x20 + + + 6 + 0x008 + TASKS_CHG[%s] + Channel group tasks + PPI_TASKS_CHG + write-only + 0x000 + + EN + Description cluster: Enable channel group n + 0x000 + write-only + + + EN + Enable channel group n + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + DIS + Description cluster: Disable channel group n + 0x004 + write-only + + + DIS + Disable channel group n + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + + CHEN + Channel enable register + 0x500 + read-write + + + CH0 + Enable or disable channel 0 + 0 + 0 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH1 + Enable or disable channel 1 + 1 + 1 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH2 + Enable or disable channel 2 + 2 + 2 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH3 + Enable or disable channel 3 + 3 + 3 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH4 + Enable or disable channel 4 + 4 + 4 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH5 + Enable or disable channel 5 + 5 + 5 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH6 + Enable or disable channel 6 + 6 + 6 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH7 + Enable or disable channel 7 + 7 + 7 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH8 + Enable or disable channel 8 + 8 + 8 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH9 + Enable or disable channel 9 + 9 + 9 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH10 + Enable or disable channel 10 + 10 + 10 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH11 + Enable or disable channel 11 + 11 + 11 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH12 + Enable or disable channel 12 + 12 + 12 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH13 + Enable or disable channel 13 + 13 + 13 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH14 + Enable or disable channel 14 + 14 + 14 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH15 + Enable or disable channel 15 + 15 + 15 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH16 + Enable or disable channel 16 + 16 + 16 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH17 + Enable or disable channel 17 + 17 + 17 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH18 + Enable or disable channel 18 + 18 + 18 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH19 + Enable or disable channel 19 + 19 + 19 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH20 + Enable or disable channel 20 + 20 + 20 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH21 + Enable or disable channel 21 + 21 + 21 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH22 + Enable or disable channel 22 + 22 + 22 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH23 + Enable or disable channel 23 + 23 + 23 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH24 + Enable or disable channel 24 + 24 + 24 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH25 + Enable or disable channel 25 + 25 + 25 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH26 + Enable or disable channel 26 + 26 + 26 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH27 + Enable or disable channel 27 + 27 + 27 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH28 + Enable or disable channel 28 + 28 + 28 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH29 + Enable or disable channel 29 + 29 + 29 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH30 + Enable or disable channel 30 + 30 + 30 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH31 + Enable or disable channel 31 + 31 + 31 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + + + CHENSET + Channel enable set register + 0x504 + read-write + oneToSet + + + CH0 + Channel 0 enable set register. Writing '0' has no effect. + 0 + 0 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH1 + Channel 1 enable set register. Writing '0' has no effect. + 1 + 1 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH2 + Channel 2 enable set register. Writing '0' has no effect. + 2 + 2 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH3 + Channel 3 enable set register. Writing '0' has no effect. + 3 + 3 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH4 + Channel 4 enable set register. Writing '0' has no effect. + 4 + 4 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH5 + Channel 5 enable set register. Writing '0' has no effect. + 5 + 5 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH6 + Channel 6 enable set register. Writing '0' has no effect. + 6 + 6 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH7 + Channel 7 enable set register. Writing '0' has no effect. + 7 + 7 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH8 + Channel 8 enable set register. Writing '0' has no effect. + 8 + 8 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH9 + Channel 9 enable set register. Writing '0' has no effect. + 9 + 9 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH10 + Channel 10 enable set register. Writing '0' has no effect. + 10 + 10 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH11 + Channel 11 enable set register. Writing '0' has no effect. + 11 + 11 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH12 + Channel 12 enable set register. Writing '0' has no effect. + 12 + 12 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH13 + Channel 13 enable set register. Writing '0' has no effect. + 13 + 13 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH14 + Channel 14 enable set register. Writing '0' has no effect. + 14 + 14 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH15 + Channel 15 enable set register. Writing '0' has no effect. + 15 + 15 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH16 + Channel 16 enable set register. Writing '0' has no effect. + 16 + 16 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH17 + Channel 17 enable set register. Writing '0' has no effect. + 17 + 17 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH18 + Channel 18 enable set register. Writing '0' has no effect. + 18 + 18 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH19 + Channel 19 enable set register. Writing '0' has no effect. + 19 + 19 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH20 + Channel 20 enable set register. Writing '0' has no effect. + 20 + 20 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH21 + Channel 21 enable set register. Writing '0' has no effect. + 21 + 21 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH22 + Channel 22 enable set register. Writing '0' has no effect. + 22 + 22 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH23 + Channel 23 enable set register. Writing '0' has no effect. + 23 + 23 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH24 + Channel 24 enable set register. Writing '0' has no effect. + 24 + 24 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH25 + Channel 25 enable set register. Writing '0' has no effect. + 25 + 25 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH26 + Channel 26 enable set register. Writing '0' has no effect. + 26 + 26 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH27 + Channel 27 enable set register. Writing '0' has no effect. + 27 + 27 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH28 + Channel 28 enable set register. Writing '0' has no effect. + 28 + 28 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH29 + Channel 29 enable set register. Writing '0' has no effect. + 29 + 29 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH30 + Channel 30 enable set register. Writing '0' has no effect. + 30 + 30 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH31 + Channel 31 enable set register. Writing '0' has no effect. + 31 + 31 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + + + CHENCLR + Channel enable clear register + 0x508 + read-write + oneToClear + + + CH0 + Channel 0 enable clear register. Writing '0' has no effect. + 0 + 0 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH1 + Channel 1 enable clear register. Writing '0' has no effect. + 1 + 1 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH2 + Channel 2 enable clear register. Writing '0' has no effect. + 2 + 2 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH3 + Channel 3 enable clear register. Writing '0' has no effect. + 3 + 3 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH4 + Channel 4 enable clear register. Writing '0' has no effect. + 4 + 4 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH5 + Channel 5 enable clear register. Writing '0' has no effect. + 5 + 5 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH6 + Channel 6 enable clear register. Writing '0' has no effect. + 6 + 6 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH7 + Channel 7 enable clear register. Writing '0' has no effect. + 7 + 7 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH8 + Channel 8 enable clear register. Writing '0' has no effect. + 8 + 8 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH9 + Channel 9 enable clear register. Writing '0' has no effect. + 9 + 9 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH10 + Channel 10 enable clear register. Writing '0' has no effect. + 10 + 10 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH11 + Channel 11 enable clear register. Writing '0' has no effect. + 11 + 11 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH12 + Channel 12 enable clear register. Writing '0' has no effect. + 12 + 12 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH13 + Channel 13 enable clear register. Writing '0' has no effect. + 13 + 13 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH14 + Channel 14 enable clear register. Writing '0' has no effect. + 14 + 14 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH15 + Channel 15 enable clear register. Writing '0' has no effect. + 15 + 15 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH16 + Channel 16 enable clear register. Writing '0' has no effect. + 16 + 16 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH17 + Channel 17 enable clear register. Writing '0' has no effect. + 17 + 17 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH18 + Channel 18 enable clear register. Writing '0' has no effect. + 18 + 18 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH19 + Channel 19 enable clear register. Writing '0' has no effect. + 19 + 19 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH20 + Channel 20 enable clear register. Writing '0' has no effect. + 20 + 20 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH21 + Channel 21 enable clear register. Writing '0' has no effect. + 21 + 21 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH22 + Channel 22 enable clear register. Writing '0' has no effect. + 22 + 22 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH23 + Channel 23 enable clear register. Writing '0' has no effect. + 23 + 23 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH24 + Channel 24 enable clear register. Writing '0' has no effect. + 24 + 24 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH25 + Channel 25 enable clear register. Writing '0' has no effect. + 25 + 25 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH26 + Channel 26 enable clear register. Writing '0' has no effect. + 26 + 26 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH27 + Channel 27 enable clear register. Writing '0' has no effect. + 27 + 27 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH28 + Channel 28 enable clear register. Writing '0' has no effect. + 28 + 28 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH29 + Channel 29 enable clear register. Writing '0' has no effect. + 29 + 29 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH30 + Channel 30 enable clear register. Writing '0' has no effect. + 30 + 30 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH31 + Channel 31 enable clear register. Writing '0' has no effect. + 31 + 31 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + + + 20 + 0x008 + CH[%s] + PPI Channel + PPI_CH + read-write + 0x510 + + EEP + Description cluster: Channel n event endpoint + 0x000 + read-write + + + EEP + Pointer to event register. Accepts only addresses to registers from the Event group. + 0 + 31 + + + + + TEP + Description cluster: Channel n task endpoint + 0x004 + read-write + + + TEP + Pointer to task register. Accepts only addresses to registers from the Task group. + 0 + 31 + + + + + + 0x6 + 0x4 + CHG[%s] + Description collection: Channel group n + 0x800 + read-write + + + CH0 + Include or exclude channel 0 + 0 + 0 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH1 + Include or exclude channel 1 + 1 + 1 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH2 + Include or exclude channel 2 + 2 + 2 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH3 + Include or exclude channel 3 + 3 + 3 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH4 + Include or exclude channel 4 + 4 + 4 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH5 + Include or exclude channel 5 + 5 + 5 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH6 + Include or exclude channel 6 + 6 + 6 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH7 + Include or exclude channel 7 + 7 + 7 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH8 + Include or exclude channel 8 + 8 + 8 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH9 + Include or exclude channel 9 + 9 + 9 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH10 + Include or exclude channel 10 + 10 + 10 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH11 + Include or exclude channel 11 + 11 + 11 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH12 + Include or exclude channel 12 + 12 + 12 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH13 + Include or exclude channel 13 + 13 + 13 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH14 + Include or exclude channel 14 + 14 + 14 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH15 + Include or exclude channel 15 + 15 + 15 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH16 + Include or exclude channel 16 + 16 + 16 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH17 + Include or exclude channel 17 + 17 + 17 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH18 + Include or exclude channel 18 + 18 + 18 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH19 + Include or exclude channel 19 + 19 + 19 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH20 + Include or exclude channel 20 + 20 + 20 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH21 + Include or exclude channel 21 + 21 + 21 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH22 + Include or exclude channel 22 + 22 + 22 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH23 + Include or exclude channel 23 + 23 + 23 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH24 + Include or exclude channel 24 + 24 + 24 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH25 + Include or exclude channel 25 + 25 + 25 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH26 + Include or exclude channel 26 + 26 + 26 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH27 + Include or exclude channel 27 + 27 + 27 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH28 + Include or exclude channel 28 + 28 + 28 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH29 + Include or exclude channel 29 + 29 + 29 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH30 + Include or exclude channel 30 + 30 + 30 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH31 + Include or exclude channel 31 + 31 + 31 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + + + 32 + 0x004 + FORK[%s] + Fork + PPI_FORK + read-write + 0x910 + + TEP + Description cluster: Channel n task endpoint + 0x000 + read-write + + + TEP + Pointer to task register + 0 + 31 + + + + + + + + MWU + Memory Watch Unit + 0x40020000 + + 0 + 0x1000 + registers + + + MWU + 32 + + MWU + 0x20 + + + 4 + 0x008 + EVENTS_REGION[%s] + Peripheral events. + MWU_EVENTS_REGION + read-write + 0x100 + + WA + Description cluster: Write access to region n detected + 0x000 + read-write + + + WA + Write access to region n detected + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + RA + Description cluster: Read access to region n detected + 0x004 + read-write + + + RA + Read access to region n detected + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + + 2 + 0x008 + EVENTS_PREGION[%s] + Peripheral events. + MWU_EVENTS_PREGION + read-write + 0x160 + + WA + Description cluster: Write access to peripheral region n detected + 0x000 + read-write + + + WA + Write access to peripheral region n detected + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + RA + Description cluster: Read access to peripheral region n detected + 0x004 + read-write + + + RA + Read access to peripheral region n detected + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + REGION0WA + Enable or disable interrupt for event REGION0WA + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION0RA + Enable or disable interrupt for event REGION0RA + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION1WA + Enable or disable interrupt for event REGION1WA + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION1RA + Enable or disable interrupt for event REGION1RA + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION2WA + Enable or disable interrupt for event REGION2WA + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION2RA + Enable or disable interrupt for event REGION2RA + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION3WA + Enable or disable interrupt for event REGION3WA + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION3RA + Enable or disable interrupt for event REGION3RA + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION0WA + Enable or disable interrupt for event PREGION0WA + 24 + 24 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION0RA + Enable or disable interrupt for event PREGION0RA + 25 + 25 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION1WA + Enable or disable interrupt for event PREGION1WA + 26 + 26 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION1RA + Enable or disable interrupt for event PREGION1RA + 27 + 27 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + REGION0WA + Write '1' to enable interrupt for event REGION0WA + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION0RA + Write '1' to enable interrupt for event REGION0RA + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION1WA + Write '1' to enable interrupt for event REGION1WA + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION1RA + Write '1' to enable interrupt for event REGION1RA + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION2WA + Write '1' to enable interrupt for event REGION2WA + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION2RA + Write '1' to enable interrupt for event REGION2RA + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION3WA + Write '1' to enable interrupt for event REGION3WA + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION3RA + Write '1' to enable interrupt for event REGION3RA + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION0WA + Write '1' to enable interrupt for event PREGION0WA + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION0RA + Write '1' to enable interrupt for event PREGION0RA + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION1WA + Write '1' to enable interrupt for event PREGION1WA + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION1RA + Write '1' to enable interrupt for event PREGION1RA + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + REGION0WA + Write '1' to disable interrupt for event REGION0WA + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION0RA + Write '1' to disable interrupt for event REGION0RA + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION1WA + Write '1' to disable interrupt for event REGION1WA + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION1RA + Write '1' to disable interrupt for event REGION1RA + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION2WA + Write '1' to disable interrupt for event REGION2WA + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION2RA + Write '1' to disable interrupt for event REGION2RA + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION3WA + Write '1' to disable interrupt for event REGION3WA + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION3RA + Write '1' to disable interrupt for event REGION3RA + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION0WA + Write '1' to disable interrupt for event PREGION0WA + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION0RA + Write '1' to disable interrupt for event PREGION0RA + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION1WA + Write '1' to disable interrupt for event PREGION1WA + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION1RA + Write '1' to disable interrupt for event PREGION1RA + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + NMIEN + Enable or disable interrupt + 0x320 + read-write + + + REGION0WA + Enable or disable interrupt for event REGION0WA + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION0RA + Enable or disable interrupt for event REGION0RA + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION1WA + Enable or disable interrupt for event REGION1WA + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION1RA + Enable or disable interrupt for event REGION1RA + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION2WA + Enable or disable interrupt for event REGION2WA + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION2RA + Enable or disable interrupt for event REGION2RA + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION3WA + Enable or disable interrupt for event REGION3WA + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION3RA + Enable or disable interrupt for event REGION3RA + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION0WA + Enable or disable interrupt for event PREGION0WA + 24 + 24 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION0RA + Enable or disable interrupt for event PREGION0RA + 25 + 25 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION1WA + Enable or disable interrupt for event PREGION1WA + 26 + 26 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION1RA + Enable or disable interrupt for event PREGION1RA + 27 + 27 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + NMIENSET + Enable interrupt + 0x324 + read-write + + + REGION0WA + Write '1' to enable interrupt for event REGION0WA + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION0RA + Write '1' to enable interrupt for event REGION0RA + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION1WA + Write '1' to enable interrupt for event REGION1WA + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION1RA + Write '1' to enable interrupt for event REGION1RA + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION2WA + Write '1' to enable interrupt for event REGION2WA + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION2RA + Write '1' to enable interrupt for event REGION2RA + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION3WA + Write '1' to enable interrupt for event REGION3WA + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION3RA + Write '1' to enable interrupt for event REGION3RA + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION0WA + Write '1' to enable interrupt for event PREGION0WA + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION0RA + Write '1' to enable interrupt for event PREGION0RA + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION1WA + Write '1' to enable interrupt for event PREGION1WA + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION1RA + Write '1' to enable interrupt for event PREGION1RA + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + NMIENCLR + Disable interrupt + 0x328 + read-write + + + REGION0WA + Write '1' to disable interrupt for event REGION0WA + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION0RA + Write '1' to disable interrupt for event REGION0RA + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION1WA + Write '1' to disable interrupt for event REGION1WA + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION1RA + Write '1' to disable interrupt for event REGION1RA + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION2WA + Write '1' to disable interrupt for event REGION2WA + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION2RA + Write '1' to disable interrupt for event REGION2RA + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION3WA + Write '1' to disable interrupt for event REGION3WA + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION3RA + Write '1' to disable interrupt for event REGION3RA + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION0WA + Write '1' to disable interrupt for event PREGION0WA + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION0RA + Write '1' to disable interrupt for event PREGION0RA + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION1WA + Write '1' to disable interrupt for event PREGION1WA + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION1RA + Write '1' to disable interrupt for event PREGION1RA + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + 2 + 0x008 + PERREGION[%s] + Unspecified + MWU_PERREGION + read-write + 0x400 + + SUBSTATWA + Description cluster: Source of event/interrupt in region n, write access detected while corresponding subregion was enabled for watching + 0x000 + read-write + oneToClear + + + SR0 + Subregion 0 in region n (write '1' to clear) + 0 + 0 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR1 + Subregion 1 in region n (write '1' to clear) + 1 + 1 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR2 + Subregion 2 in region n (write '1' to clear) + 2 + 2 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR3 + Subregion 3 in region n (write '1' to clear) + 3 + 3 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR4 + Subregion 4 in region n (write '1' to clear) + 4 + 4 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR5 + Subregion 5 in region n (write '1' to clear) + 5 + 5 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR6 + Subregion 6 in region n (write '1' to clear) + 6 + 6 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR7 + Subregion 7 in region n (write '1' to clear) + 7 + 7 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR8 + Subregion 8 in region n (write '1' to clear) + 8 + 8 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR9 + Subregion 9 in region n (write '1' to clear) + 9 + 9 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR10 + Subregion 10 in region n (write '1' to clear) + 10 + 10 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR11 + Subregion 11 in region n (write '1' to clear) + 11 + 11 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR12 + Subregion 12 in region n (write '1' to clear) + 12 + 12 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR13 + Subregion 13 in region n (write '1' to clear) + 13 + 13 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR14 + Subregion 14 in region n (write '1' to clear) + 14 + 14 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR15 + Subregion 15 in region n (write '1' to clear) + 15 + 15 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR16 + Subregion 16 in region n (write '1' to clear) + 16 + 16 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR17 + Subregion 17 in region n (write '1' to clear) + 17 + 17 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR18 + Subregion 18 in region n (write '1' to clear) + 18 + 18 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR19 + Subregion 19 in region n (write '1' to clear) + 19 + 19 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR20 + Subregion 20 in region n (write '1' to clear) + 20 + 20 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR21 + Subregion 21 in region n (write '1' to clear) + 21 + 21 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR22 + Subregion 22 in region n (write '1' to clear) + 22 + 22 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR23 + Subregion 23 in region n (write '1' to clear) + 23 + 23 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR24 + Subregion 24 in region n (write '1' to clear) + 24 + 24 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR25 + Subregion 25 in region n (write '1' to clear) + 25 + 25 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR26 + Subregion 26 in region n (write '1' to clear) + 26 + 26 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR27 + Subregion 27 in region n (write '1' to clear) + 27 + 27 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR28 + Subregion 28 in region n (write '1' to clear) + 28 + 28 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR29 + Subregion 29 in region n (write '1' to clear) + 29 + 29 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR30 + Subregion 30 in region n (write '1' to clear) + 30 + 30 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR31 + Subregion 31 in region n (write '1' to clear) + 31 + 31 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + + + SUBSTATRA + Description cluster: Source of event/interrupt in region n, read access detected while corresponding subregion was enabled for watching + 0x004 + read-write + oneToClear + + + SR0 + Subregion 0 in region n (write '1' to clear) + 0 + 0 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR1 + Subregion 1 in region n (write '1' to clear) + 1 + 1 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR2 + Subregion 2 in region n (write '1' to clear) + 2 + 2 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR3 + Subregion 3 in region n (write '1' to clear) + 3 + 3 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR4 + Subregion 4 in region n (write '1' to clear) + 4 + 4 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR5 + Subregion 5 in region n (write '1' to clear) + 5 + 5 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR6 + Subregion 6 in region n (write '1' to clear) + 6 + 6 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR7 + Subregion 7 in region n (write '1' to clear) + 7 + 7 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR8 + Subregion 8 in region n (write '1' to clear) + 8 + 8 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR9 + Subregion 9 in region n (write '1' to clear) + 9 + 9 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR10 + Subregion 10 in region n (write '1' to clear) + 10 + 10 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR11 + Subregion 11 in region n (write '1' to clear) + 11 + 11 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR12 + Subregion 12 in region n (write '1' to clear) + 12 + 12 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR13 + Subregion 13 in region n (write '1' to clear) + 13 + 13 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR14 + Subregion 14 in region n (write '1' to clear) + 14 + 14 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR15 + Subregion 15 in region n (write '1' to clear) + 15 + 15 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR16 + Subregion 16 in region n (write '1' to clear) + 16 + 16 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR17 + Subregion 17 in region n (write '1' to clear) + 17 + 17 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR18 + Subregion 18 in region n (write '1' to clear) + 18 + 18 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR19 + Subregion 19 in region n (write '1' to clear) + 19 + 19 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR20 + Subregion 20 in region n (write '1' to clear) + 20 + 20 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR21 + Subregion 21 in region n (write '1' to clear) + 21 + 21 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR22 + Subregion 22 in region n (write '1' to clear) + 22 + 22 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR23 + Subregion 23 in region n (write '1' to clear) + 23 + 23 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR24 + Subregion 24 in region n (write '1' to clear) + 24 + 24 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR25 + Subregion 25 in region n (write '1' to clear) + 25 + 25 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR26 + Subregion 26 in region n (write '1' to clear) + 26 + 26 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR27 + Subregion 27 in region n (write '1' to clear) + 27 + 27 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR28 + Subregion 28 in region n (write '1' to clear) + 28 + 28 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR29 + Subregion 29 in region n (write '1' to clear) + 29 + 29 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR30 + Subregion 30 in region n (write '1' to clear) + 30 + 30 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR31 + Subregion 31 in region n (write '1' to clear) + 31 + 31 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + + + + REGIONEN + Enable/disable regions watch + 0x510 + read-write + + + RGN0WA + Enable/disable write access watch in region[0] + 0 + 0 + + + Disable + Disable write access watch in this region + 0 + + + Enable + Enable write access watch in this region + 1 + + + + + RGN0RA + Enable/disable read access watch in region[0] + 1 + 1 + + + Disable + Disable read access watch in this region + 0 + + + Enable + Enable read access watch in this region + 1 + + + + + RGN1WA + Enable/disable write access watch in region[1] + 2 + 2 + + + Disable + Disable write access watch in this region + 0 + + + Enable + Enable write access watch in this region + 1 + + + + + RGN1RA + Enable/disable read access watch in region[1] + 3 + 3 + + + Disable + Disable read access watch in this region + 0 + + + Enable + Enable read access watch in this region + 1 + + + + + RGN2WA + Enable/disable write access watch in region[2] + 4 + 4 + + + Disable + Disable write access watch in this region + 0 + + + Enable + Enable write access watch in this region + 1 + + + + + RGN2RA + Enable/disable read access watch in region[2] + 5 + 5 + + + Disable + Disable read access watch in this region + 0 + + + Enable + Enable read access watch in this region + 1 + + + + + RGN3WA + Enable/disable write access watch in region[3] + 6 + 6 + + + Disable + Disable write access watch in this region + 0 + + + Enable + Enable write access watch in this region + 1 + + + + + RGN3RA + Enable/disable read access watch in region[3] + 7 + 7 + + + Disable + Disable read access watch in this region + 0 + + + Enable + Enable read access watch in this region + 1 + + + + + PRGN0WA + Enable/disable write access watch in PREGION[0] + 24 + 24 + + + Disable + Disable write access watch in this PREGION + 0 + + + Enable + Enable write access watch in this PREGION + 1 + + + + + PRGN0RA + Enable/disable read access watch in PREGION[0] + 25 + 25 + + + Disable + Disable read access watch in this PREGION + 0 + + + Enable + Enable read access watch in this PREGION + 1 + + + + + PRGN1WA + Enable/disable write access watch in PREGION[1] + 26 + 26 + + + Disable + Disable write access watch in this PREGION + 0 + + + Enable + Enable write access watch in this PREGION + 1 + + + + + PRGN1RA + Enable/disable read access watch in PREGION[1] + 27 + 27 + + + Disable + Disable read access watch in this PREGION + 0 + + + Enable + Enable read access watch in this PREGION + 1 + + + + + + + REGIONENSET + Enable regions watch + 0x514 + read-write + + + RGN0WA + Enable write access watch in region[0] + 0 + 0 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Set + Enable write access watch in this region + 1 + + + + + RGN0RA + Enable read access watch in region[0] + 1 + 1 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Set + Enable read access watch in this region + 1 + + + + + RGN1WA + Enable write access watch in region[1] + 2 + 2 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Set + Enable write access watch in this region + 1 + + + + + RGN1RA + Enable read access watch in region[1] + 3 + 3 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Set + Enable read access watch in this region + 1 + + + + + RGN2WA + Enable write access watch in region[2] + 4 + 4 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Set + Enable write access watch in this region + 1 + + + + + RGN2RA + Enable read access watch in region[2] + 5 + 5 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Set + Enable read access watch in this region + 1 + + + + + RGN3WA + Enable write access watch in region[3] + 6 + 6 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Set + Enable write access watch in this region + 1 + + + + + RGN3RA + Enable read access watch in region[3] + 7 + 7 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Set + Enable read access watch in this region + 1 + + + + + PRGN0WA + Enable write access watch in PREGION[0] + 24 + 24 + + read + + Disabled + Write access watch in this PREGION is disabled + 0 + + + Enabled + Write access watch in this PREGION is enabled + 1 + + + + write + + Set + Enable write access watch in this PREGION + 1 + + + + + PRGN0RA + Enable read access watch in PREGION[0] + 25 + 25 + + read + + Disabled + Read access watch in this PREGION is disabled + 0 + + + Enabled + Read access watch in this PREGION is enabled + 1 + + + + write + + Set + Enable read access watch in this PREGION + 1 + + + + + PRGN1WA + Enable write access watch in PREGION[1] + 26 + 26 + + read + + Disabled + Write access watch in this PREGION is disabled + 0 + + + Enabled + Write access watch in this PREGION is enabled + 1 + + + + write + + Set + Enable write access watch in this PREGION + 1 + + + + + PRGN1RA + Enable read access watch in PREGION[1] + 27 + 27 + + read + + Disabled + Read access watch in this PREGION is disabled + 0 + + + Enabled + Read access watch in this PREGION is enabled + 1 + + + + write + + Set + Enable read access watch in this PREGION + 1 + + + + + + + REGIONENCLR + Disable regions watch + 0x518 + read-write + + + RGN0WA + Disable write access watch in region[0] + 0 + 0 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Clear + Disable write access watch in this region + 1 + + + + + RGN0RA + Disable read access watch in region[0] + 1 + 1 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Clear + Disable read access watch in this region + 1 + + + + + RGN1WA + Disable write access watch in region[1] + 2 + 2 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Clear + Disable write access watch in this region + 1 + + + + + RGN1RA + Disable read access watch in region[1] + 3 + 3 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Clear + Disable read access watch in this region + 1 + + + + + RGN2WA + Disable write access watch in region[2] + 4 + 4 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Clear + Disable write access watch in this region + 1 + + + + + RGN2RA + Disable read access watch in region[2] + 5 + 5 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Clear + Disable read access watch in this region + 1 + + + + + RGN3WA + Disable write access watch in region[3] + 6 + 6 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Clear + Disable write access watch in this region + 1 + + + + + RGN3RA + Disable read access watch in region[3] + 7 + 7 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Clear + Disable read access watch in this region + 1 + + + + + PRGN0WA + Disable write access watch in PREGION[0] + 24 + 24 + + read + + Disabled + Write access watch in this PREGION is disabled + 0 + + + Enabled + Write access watch in this PREGION is enabled + 1 + + + + write + + Clear + Disable write access watch in this PREGION + 1 + + + + + PRGN0RA + Disable read access watch in PREGION[0] + 25 + 25 + + read + + Disabled + Read access watch in this PREGION is disabled + 0 + + + Enabled + Read access watch in this PREGION is enabled + 1 + + + + write + + Clear + Disable read access watch in this PREGION + 1 + + + + + PRGN1WA + Disable write access watch in PREGION[1] + 26 + 26 + + read + + Disabled + Write access watch in this PREGION is disabled + 0 + + + Enabled + Write access watch in this PREGION is enabled + 1 + + + + write + + Clear + Disable write access watch in this PREGION + 1 + + + + + PRGN1RA + Disable read access watch in PREGION[1] + 27 + 27 + + read + + Disabled + Read access watch in this PREGION is disabled + 0 + + + Enabled + Read access watch in this PREGION is enabled + 1 + + + + write + + Clear + Disable read access watch in this PREGION + 1 + + + + + + + 4 + 0x010 + REGION[%s] + Unspecified + MWU_REGION + read-write + 0x600 + + START + Description cluster: Start address for region n + 0x000 + read-write + 0x00000000 + + + START + Start address for region + 0 + 31 + + + + + END + Description cluster: End address of region n + 0x004 + read-write + + + END + End address of region. + 0 + 31 + + + + + + 2 + 0x010 + PREGION[%s] + Unspecified + MWU_PREGION + read-write + 0x6C0 + + START + Description cluster: Reserved for future use + 0x000 + read-only + + + START + Reserved for future use + 0 + 31 + + + + + END + Description cluster: Reserved for future use + 0x004 + read-only + + + END + Reserved for future use + 0 + 31 + + + + + SUBS + Description cluster: Subregions of region n + 0x008 + read-write + 0x00000000 + + + SR0 + Include or exclude subregion 0 in region + 0 + 0 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR1 + Include or exclude subregion 1 in region + 1 + 1 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR2 + Include or exclude subregion 2 in region + 2 + 2 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR3 + Include or exclude subregion 3 in region + 3 + 3 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR4 + Include or exclude subregion 4 in region + 4 + 4 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR5 + Include or exclude subregion 5 in region + 5 + 5 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR6 + Include or exclude subregion 6 in region + 6 + 6 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR7 + Include or exclude subregion 7 in region + 7 + 7 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR8 + Include or exclude subregion 8 in region + 8 + 8 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR9 + Include or exclude subregion 9 in region + 9 + 9 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR10 + Include or exclude subregion 10 in region + 10 + 10 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR11 + Include or exclude subregion 11 in region + 11 + 11 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR12 + Include or exclude subregion 12 in region + 12 + 12 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR13 + Include or exclude subregion 13 in region + 13 + 13 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR14 + Include or exclude subregion 14 in region + 14 + 14 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR15 + Include or exclude subregion 15 in region + 15 + 15 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR16 + Include or exclude subregion 16 in region + 16 + 16 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR17 + Include or exclude subregion 17 in region + 17 + 17 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR18 + Include or exclude subregion 18 in region + 18 + 18 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR19 + Include or exclude subregion 19 in region + 19 + 19 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR20 + Include or exclude subregion 20 in region + 20 + 20 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR21 + Include or exclude subregion 21 in region + 21 + 21 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR22 + Include or exclude subregion 22 in region + 22 + 22 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR23 + Include or exclude subregion 23 in region + 23 + 23 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR24 + Include or exclude subregion 24 in region + 24 + 24 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR25 + Include or exclude subregion 25 in region + 25 + 25 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR26 + Include or exclude subregion 26 in region + 26 + 26 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR27 + Include or exclude subregion 27 in region + 27 + 27 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR28 + Include or exclude subregion 28 in region + 28 + 28 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR29 + Include or exclude subregion 29 in region + 29 + 29 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR30 + Include or exclude subregion 30 in region + 30 + 30 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR31 + Include or exclude subregion 31 in region + 31 + 31 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + + + + + + PWM1 + Pulse width modulation unit 1 + 0x40021000 + + PWM1 + 33 + + + + PWM2 + Pulse width modulation unit 2 + 0x40022000 + + PWM2 + 34 + + + + SPI2 + Serial Peripheral Interface 2 + 0x40023000 + + SPIM2_SPIS2_SPI2 + 35 + + + + SPIM2 + Serial Peripheral Interface Master with EasyDMA 2 + 0x40023000 + SPI2 + + SPIM2_SPIS2_SPI2 + 35 + + + + SPIS2 + SPI Slave 2 + 0x40023000 + SPI2 + + SPIM2_SPIS2_SPI2 + 35 + + + + RTC2 + Real time counter 2 + 0x40024000 + + RTC2 + 36 + + + + I2S + Inter-IC Sound + 0x40025000 + + 0 + 0x1000 + registers + + + I2S + 37 + + I2S + 0x20 + + + TASKS_START + Starts continuous I2S transfer. Also starts MCK generator when this is enabled. + 0x000 + write-only + + + TASKS_START + Starts continuous I2S transfer. Also starts MCK generator when this is enabled. + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STOP + Stops I2S transfer. Also stops MCK generator. Triggering this task will cause the STOPPED event to be generated. + 0x004 + write-only + + + TASKS_STOP + Stops I2S transfer. Also stops MCK generator. Triggering this task will cause the STOPPED event to be generated. + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_RXPTRUPD + The RXD.PTR register has been copied to internal double-buffers. + When the I2S module is started and RX is enabled, this event will be generated for every RXTXD.MAXCNT words that are received on the SDIN pin. + 0x104 + read-write + + + EVENTS_RXPTRUPD + The RXD.PTR register has been copied to internal double-buffers. + When the I2S module is started and RX is enabled, this event will be generated for every RXTXD.MAXCNT words that are received on the SDIN pin. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_STOPPED + I2S transfer stopped. + 0x108 + read-write + + + EVENTS_STOPPED + I2S transfer stopped. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_TXPTRUPD + The TDX.PTR register has been copied to internal double-buffers. + When the I2S module is started and TX is enabled, this event will be generated for every RXTXD.MAXCNT words that are sent on the SDOUT pin. + 0x114 + read-write + + + EVENTS_TXPTRUPD + The TDX.PTR register has been copied to internal double-buffers. + When the I2S module is started and TX is enabled, this event will be generated for every RXTXD.MAXCNT words that are sent on the SDOUT pin. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + RXPTRUPD + Enable or disable interrupt for event RXPTRUPD + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STOPPED + Enable or disable interrupt for event STOPPED + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXPTRUPD + Enable or disable interrupt for event TXPTRUPD + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + RXPTRUPD + Write '1' to enable interrupt for event RXPTRUPD + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STOPPED + Write '1' to enable interrupt for event STOPPED + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXPTRUPD + Write '1' to enable interrupt for event TXPTRUPD + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + RXPTRUPD + Write '1' to disable interrupt for event RXPTRUPD + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STOPPED + Write '1' to disable interrupt for event STOPPED + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXPTRUPD + Write '1' to disable interrupt for event TXPTRUPD + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + Enable I2S module. + 0x500 + read-write + 0x00000000 + + + ENABLE + Enable I2S module. + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + CONFIG + Unspecified + I2S_CONFIG + read-write + 0x504 + + MODE + I2S mode. + 0x000 + read-write + 0x00000000 + + + MODE + I2S mode. + 0 + 0 + + + Master + Master mode. SCK and LRCK generated from internal master clcok (MCK) and output on pins defined by PSEL.xxx. + 0 + + + Slave + Slave mode. SCK and LRCK generated by external master and received on pins defined by PSEL.xxx + 1 + + + + + + + RXEN + Reception (RX) enable. + 0x004 + read-write + 0x00000000 + + + RXEN + Reception (RX) enable. + 0 + 0 + + + Disabled + Reception disabled and now data will be written to the RXD.PTR address. + 0 + + + Enabled + Reception enabled. + 1 + + + + + + + TXEN + Transmission (TX) enable. + 0x008 + read-write + 0x00000001 + + + TXEN + Transmission (TX) enable. + 0 + 0 + + + Disabled + Transmission disabled and now data will be read from the RXD.TXD address. + 0 + + + Enabled + Transmission enabled. + 1 + + + + + + + MCKEN + Master clock generator enable. + 0x00C + read-write + 0x00000001 + + + MCKEN + Master clock generator enable. + 0 + 0 + + + Disabled + Master clock generator disabled and PSEL.MCK not connected(available as GPIO). + 0 + + + Enabled + Master clock generator running and MCK output on PSEL.MCK. + 1 + + + + + + + MCKFREQ + Master clock generator frequency. + 0x010 + read-write + 0x20000000 + + + MCKFREQ + Master clock generator frequency. + 0 + 31 + + + 32MDIV8 + 32 MHz / 8 = 4.0 MHz + 0x20000000 + + + 32MDIV10 + 32 MHz / 10 = 3.2 MHz + 0x18000000 + + + 32MDIV11 + 32 MHz / 11 = 2.9090909 MHz + 0x16000000 + + + 32MDIV15 + 32 MHz / 15 = 2.1333333 MHz + 0x11000000 + + + 32MDIV16 + 32 MHz / 16 = 2.0 MHz + 0x10000000 + + + 32MDIV21 + 32 MHz / 21 = 1.5238095 + 0x0C000000 + + + 32MDIV23 + 32 MHz / 23 = 1.3913043 MHz + 0x0B000000 + + + 32MDIV30 + 32 MHz / 30 = 1.0666667 MHz + 0x08800000 + + + 32MDIV31 + 32 MHz / 31 = 1.0322581 MHz + 0x08400000 + + + 32MDIV32 + 32 MHz / 32 = 1.0 MHz + 0x08000000 + + + 32MDIV42 + 32 MHz / 42 = 0.7619048 MHz + 0x06000000 + + + 32MDIV63 + 32 MHz / 63 = 0.5079365 MHz + 0x04100000 + + + 32MDIV125 + 32 MHz / 125 = 0.256 MHz + 0x020C0000 + + + + + + + RATIO + MCK / LRCK ratio. + 0x014 + read-write + 0x00000006 + + + RATIO + MCK / LRCK ratio. + 0 + 3 + + + 32X + LRCK = MCK / 32 + 0 + + + 48X + LRCK = MCK / 48 + 1 + + + 64X + LRCK = MCK / 64 + 2 + + + 96X + LRCK = MCK / 96 + 3 + + + 128X + LRCK = MCK / 128 + 4 + + + 192X + LRCK = MCK / 192 + 5 + + + 256X + LRCK = MCK / 256 + 6 + + + 384X + LRCK = MCK / 384 + 7 + + + 512X + LRCK = MCK / 512 + 8 + + + + + + + SWIDTH + Sample width. + 0x018 + read-write + 0x00000001 + + + SWIDTH + Sample width. + 0 + 1 + + + 8Bit + 8 bit. + 0 + + + 16Bit + 16 bit. + 1 + + + 24Bit + 24 bit. + 2 + + + + + + + ALIGN + Alignment of sample within a frame. + 0x01C + read-write + 0x00000000 + + + ALIGN + Alignment of sample within a frame. + 0 + 0 + + + Left + Left-aligned. + 0 + + + Right + Right-aligned. + 1 + + + + + + + FORMAT + Frame format. + 0x020 + read-write + 0x00000000 + + + FORMAT + Frame format. + 0 + 0 + + + I2S + Original I2S format. + 0 + + + Aligned + Alternate (left- or right-aligned) format. + 1 + + + + + + + CHANNELS + Enable channels. + 0x024 + read-write + 0x00000000 + + + CHANNELS + Enable channels. + 0 + 1 + + + Stereo + Stereo. + 0 + + + Left + Left only. + 1 + + + Right + Right only. + 2 + + + + + + + + RXD + Unspecified + I2S_RXD + read-write + 0x538 + + PTR + Receive buffer RAM start address. + 0x000 + read-write + 0x00000000 + + + PTR + Receive buffer Data RAM start address. When receiving, words containing samples will be written to this address. This address is a word aligned Data RAM address. + 0 + 31 + + + + + + TXD + Unspecified + I2S_TXD + read-write + 0x540 + + PTR + Transmit buffer RAM start address. + 0x000 + read-write + 0x00000000 + + + PTR + Transmit buffer Data RAM start address. When transmitting, words containing samples will be fetched from this address. This address is a word aligned Data RAM address. + 0 + 31 + + + + + + RXTXD + Unspecified + I2S_RXTXD + read-write + 0x550 + + MAXCNT + Size of RXD and TXD buffers. + 0x000 + read-write + 0x00000000 + + + MAXCNT + Size of RXD and TXD buffers in number of 32 bit words. + 0 + 13 + + + + + + PSEL + Unspecified + I2S_PSEL + read-write + 0x560 + + MCK + Pin select for MCK signal. + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SCK + Pin select for SCK signal. + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + LRCK + Pin select for LRCK signal. + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDIN + Pin select for SDIN signal. + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDOUT + Pin select for SDOUT signal. + 0x010 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + + + FPU + FPU + 0x40026000 + + 0 + 0x1000 + registers + + + FPU + 38 + + FPU + 0x20 + + + UNUSED + Unused. + 0x000 + 0x00000000 + read-only + + + + + USBD + Universal serial bus device + 0x40027000 + + 0 + 0x1000 + registers + + + USBD + 39 + + USBD + 0x20 + + + 0x8 + 0x4 + TASKS_STARTEPIN[%s] + Description collection: Captures the EPIN[n].PTR and EPIN[n].MAXCNT registers values, and enables endpoint IN n to respond to traffic from host + 0x004 + write-only + + + TASKS_STARTEPIN + Captures the EPIN[n].PTR and EPIN[n].MAXCNT registers values, and enables endpoint IN n to respond to traffic from host + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STARTISOIN + Captures the ISOIN.PTR and ISOIN.MAXCNT registers values, and enables sending data on ISO endpoint + 0x024 + write-only + + + TASKS_STARTISOIN + Captures the ISOIN.PTR and ISOIN.MAXCNT registers values, and enables sending data on ISO endpoint + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + 0x8 + 0x4 + TASKS_STARTEPOUT[%s] + Description collection: Captures the EPOUT[n].PTR and EPOUT[n].MAXCNT registers values, and enables endpoint n to respond to traffic from host + 0x028 + write-only + + + TASKS_STARTEPOUT + Captures the EPOUT[n].PTR and EPOUT[n].MAXCNT registers values, and enables endpoint n to respond to traffic from host + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_STARTISOOUT + Captures the ISOOUT.PTR and ISOOUT.MAXCNT registers values, and enables receiving of data on ISO endpoint + 0x048 + write-only + + + TASKS_STARTISOOUT + Captures the ISOOUT.PTR and ISOOUT.MAXCNT registers values, and enables receiving of data on ISO endpoint + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_EP0RCVOUT + Allows OUT data stage on control endpoint 0 + 0x04C + write-only + + + TASKS_EP0RCVOUT + Allows OUT data stage on control endpoint 0 + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_EP0STATUS + Allows status stage on control endpoint 0 + 0x050 + write-only + + + TASKS_EP0STATUS + Allows status stage on control endpoint 0 + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_EP0STALL + Stalls data and status stage on control endpoint 0 + 0x054 + write-only + + + TASKS_EP0STALL + Stalls data and status stage on control endpoint 0 + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_DPDMDRIVE + Forces D+ and D- lines into the state defined in the DPDMVALUE register + 0x058 + write-only + + + TASKS_DPDMDRIVE + Forces D+ and D- lines into the state defined in the DPDMVALUE register + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_DPDMNODRIVE + Stops forcing D+ and D- lines into any state (USB engine takes control) + 0x05C + write-only + + + TASKS_DPDMNODRIVE + Stops forcing D+ and D- lines into any state (USB engine takes control) + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_USBRESET + Signals that a USB reset condition has been detected on USB lines + 0x100 + read-write + + + EVENTS_USBRESET + Signals that a USB reset condition has been detected on USB lines + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_STARTED + Confirms that the EPIN[n].PTR and EPIN[n].MAXCNT, or EPOUT[n].PTR and EPOUT[n].MAXCNT registers have been captured on all endpoints reported in the EPSTATUS register + 0x104 + read-write + + + EVENTS_STARTED + Confirms that the EPIN[n].PTR and EPIN[n].MAXCNT, or EPOUT[n].PTR and EPOUT[n].MAXCNT registers have been captured on all endpoints reported in the EPSTATUS register + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + 0x8 + 0x4 + EVENTS_ENDEPIN[%s] + Description collection: The whole EPIN[n] buffer has been consumed. The buffer can be accessed safely by software. + 0x108 + read-write + + + EVENTS_ENDEPIN + The whole EPIN[n] buffer has been consumed. The buffer can be accessed safely by software. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_EP0DATADONE + An acknowledged data transfer has taken place on the control endpoint + 0x128 + read-write + + + EVENTS_EP0DATADONE + An acknowledged data transfer has taken place on the control endpoint + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ENDISOIN + The whole ISOIN buffer has been consumed. The buffer can be accessed safely by software. + 0x12C + read-write + + + EVENTS_ENDISOIN + The whole ISOIN buffer has been consumed. The buffer can be accessed safely by software. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + 0x8 + 0x4 + EVENTS_ENDEPOUT[%s] + Description collection: The whole EPOUT[n] buffer has been consumed. The buffer can be accessed safely by software. + 0x130 + read-write + + + EVENTS_ENDEPOUT + The whole EPOUT[n] buffer has been consumed. The buffer can be accessed safely by software. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_ENDISOOUT + The whole ISOOUT buffer has been consumed. The buffer can be accessed safely by software. + 0x150 + read-write + + + EVENTS_ENDISOOUT + The whole ISOOUT buffer has been consumed. The buffer can be accessed safely by software. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_SOF + Signals that a SOF (start of frame) condition has been detected on USB lines + 0x154 + read-write + + + EVENTS_SOF + Signals that a SOF (start of frame) condition has been detected on USB lines + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_USBEVENT + An event or an error not covered by specific events has occurred. Check EVENTCAUSE register to find the cause. + 0x158 + read-write + + + EVENTS_USBEVENT + An event or an error not covered by specific events has occurred. Check EVENTCAUSE register to find the cause. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_EP0SETUP + A valid SETUP token has been received (and acknowledged) on the control endpoint + 0x15C + read-write + + + EVENTS_EP0SETUP + A valid SETUP token has been received (and acknowledged) on the control endpoint + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + EVENTS_EPDATA + A data transfer has occurred on a data endpoint, indicated by the EPDATASTATUS register + 0x160 + read-write + + + EVENTS_EPDATA + A data transfer has occurred on a data endpoint, indicated by the EPDATASTATUS register + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + SHORTS + Shortcuts between local events and tasks + 0x200 + read-write + + + EP0DATADONE_STARTEPIN0 + Shortcut between event EP0DATADONE and task STARTEPIN[0] + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + EP0DATADONE_STARTEPOUT0 + Shortcut between event EP0DATADONE and task STARTEPOUT[0] + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + EP0DATADONE_EP0STATUS + Shortcut between event EP0DATADONE and task EP0STATUS + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ENDEPOUT0_EP0STATUS + Shortcut between event ENDEPOUT[0] and task EP0STATUS + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ENDEPOUT0_EP0RCVOUT + Shortcut between event ENDEPOUT[0] and task EP0RCVOUT + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + USBRESET + Enable or disable interrupt for event USBRESET + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STARTED + Enable or disable interrupt for event STARTED + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN0 + Enable or disable interrupt for event ENDEPIN[0] + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN1 + Enable or disable interrupt for event ENDEPIN[1] + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN2 + Enable or disable interrupt for event ENDEPIN[2] + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN3 + Enable or disable interrupt for event ENDEPIN[3] + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN4 + Enable or disable interrupt for event ENDEPIN[4] + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN5 + Enable or disable interrupt for event ENDEPIN[5] + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN6 + Enable or disable interrupt for event ENDEPIN[6] + 8 + 8 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN7 + Enable or disable interrupt for event ENDEPIN[7] + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + EP0DATADONE + Enable or disable interrupt for event EP0DATADONE + 10 + 10 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDISOIN + Enable or disable interrupt for event ENDISOIN + 11 + 11 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT0 + Enable or disable interrupt for event ENDEPOUT[0] + 12 + 12 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT1 + Enable or disable interrupt for event ENDEPOUT[1] + 13 + 13 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT2 + Enable or disable interrupt for event ENDEPOUT[2] + 14 + 14 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT3 + Enable or disable interrupt for event ENDEPOUT[3] + 15 + 15 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT4 + Enable or disable interrupt for event ENDEPOUT[4] + 16 + 16 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT5 + Enable or disable interrupt for event ENDEPOUT[5] + 17 + 17 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT6 + Enable or disable interrupt for event ENDEPOUT[6] + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT7 + Enable or disable interrupt for event ENDEPOUT[7] + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDISOOUT + Enable or disable interrupt for event ENDISOOUT + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SOF + Enable or disable interrupt for event SOF + 21 + 21 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + USBEVENT + Enable or disable interrupt for event USBEVENT + 22 + 22 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + EP0SETUP + Enable or disable interrupt for event EP0SETUP + 23 + 23 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + EPDATA + Enable or disable interrupt for event EPDATA + 24 + 24 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + USBRESET + Write '1' to enable interrupt for event USBRESET + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STARTED + Write '1' to enable interrupt for event STARTED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN0 + Write '1' to enable interrupt for event ENDEPIN[0] + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN1 + Write '1' to enable interrupt for event ENDEPIN[1] + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN2 + Write '1' to enable interrupt for event ENDEPIN[2] + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN3 + Write '1' to enable interrupt for event ENDEPIN[3] + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN4 + Write '1' to enable interrupt for event ENDEPIN[4] + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN5 + Write '1' to enable interrupt for event ENDEPIN[5] + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN6 + Write '1' to enable interrupt for event ENDEPIN[6] + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN7 + Write '1' to enable interrupt for event ENDEPIN[7] + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + EP0DATADONE + Write '1' to enable interrupt for event EP0DATADONE + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDISOIN + Write '1' to enable interrupt for event ENDISOIN + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT0 + Write '1' to enable interrupt for event ENDEPOUT[0] + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT1 + Write '1' to enable interrupt for event ENDEPOUT[1] + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT2 + Write '1' to enable interrupt for event ENDEPOUT[2] + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT3 + Write '1' to enable interrupt for event ENDEPOUT[3] + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT4 + Write '1' to enable interrupt for event ENDEPOUT[4] + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT5 + Write '1' to enable interrupt for event ENDEPOUT[5] + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT6 + Write '1' to enable interrupt for event ENDEPOUT[6] + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT7 + Write '1' to enable interrupt for event ENDEPOUT[7] + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDISOOUT + Write '1' to enable interrupt for event ENDISOOUT + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SOF + Write '1' to enable interrupt for event SOF + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + USBEVENT + Write '1' to enable interrupt for event USBEVENT + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + EP0SETUP + Write '1' to enable interrupt for event EP0SETUP + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + EPDATA + Write '1' to enable interrupt for event EPDATA + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + USBRESET + Write '1' to disable interrupt for event USBRESET + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STARTED + Write '1' to disable interrupt for event STARTED + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN0 + Write '1' to disable interrupt for event ENDEPIN[0] + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN1 + Write '1' to disable interrupt for event ENDEPIN[1] + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN2 + Write '1' to disable interrupt for event ENDEPIN[2] + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN3 + Write '1' to disable interrupt for event ENDEPIN[3] + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN4 + Write '1' to disable interrupt for event ENDEPIN[4] + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN5 + Write '1' to disable interrupt for event ENDEPIN[5] + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN6 + Write '1' to disable interrupt for event ENDEPIN[6] + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN7 + Write '1' to disable interrupt for event ENDEPIN[7] + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + EP0DATADONE + Write '1' to disable interrupt for event EP0DATADONE + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDISOIN + Write '1' to disable interrupt for event ENDISOIN + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT0 + Write '1' to disable interrupt for event ENDEPOUT[0] + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT1 + Write '1' to disable interrupt for event ENDEPOUT[1] + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT2 + Write '1' to disable interrupt for event ENDEPOUT[2] + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT3 + Write '1' to disable interrupt for event ENDEPOUT[3] + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT4 + Write '1' to disable interrupt for event ENDEPOUT[4] + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT5 + Write '1' to disable interrupt for event ENDEPOUT[5] + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT6 + Write '1' to disable interrupt for event ENDEPOUT[6] + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT7 + Write '1' to disable interrupt for event ENDEPOUT[7] + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDISOOUT + Write '1' to disable interrupt for event ENDISOOUT + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SOF + Write '1' to disable interrupt for event SOF + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + USBEVENT + Write '1' to disable interrupt for event USBEVENT + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + EP0SETUP + Write '1' to disable interrupt for event EP0SETUP + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + EPDATA + Write '1' to disable interrupt for event EPDATA + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + EVENTCAUSE + Details on what caused the USBEVENT event + 0x400 + read-write + oneToClear + + + ISOOUTCRC + CRC error was detected on isochronous OUT endpoint 8. Write '1' to clear. + 0 + 0 + + + NotDetected + No error detected + 0 + + + Detected + Error detected + 1 + + + + + SUSPEND + Signals that USB lines have been idle long enough for the device to enter suspend. Write '1' to clear. + 8 + 8 + + + NotDetected + Suspend not detected + 0 + + + Detected + Suspend detected + 1 + + + + + RESUME + Signals that a RESUME condition (K state or activity restart) has been detected on USB lines. Write '1' to clear. + 9 + 9 + + + NotDetected + Resume not detected + 0 + + + Detected + Resume detected + 1 + + + + + USBWUALLOWED + USB MAC has been woken up and operational. Write '1' to clear. + 10 + 10 + + + NotAllowed + Wake up not allowed + 0 + + + Allowed + Wake up allowed + 1 + + + + + READY + USB device is ready for normal operation. Write '1' to clear. + 11 + 11 + + + NotDetected + USBEVENT was not issued due to USBD peripheral ready + 0 + + + Ready + USBD peripheral is ready + 1 + + + + + + + HALTED + Unspecified + USBD_HALTED + read-write + 0x420 + + 0x8 + 0x4 + EPIN[%s] + Description collection: IN endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint. + 0x000 + read-only + + + GETSTATUS + IN endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint. + 0 + 15 + + + NotHalted + Endpoint is not halted + 0 + + + Halted + Endpoint is halted + 1 + + + + + + + 0x8 + 0x4 + EPOUT[%s] + Description collection: OUT endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint. + 0x024 + read-only + + + GETSTATUS + OUT endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint. + 0 + 15 + + + NotHalted + Endpoint is not halted + 0 + + + Halted + Endpoint is halted + 1 + + + + + + + + EPSTATUS + Provides information on which endpoint's EasyDMA registers have been captured + 0x468 + read-write + oneToClear + + + EPIN0 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 0 + 0 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN1 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 1 + 1 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN2 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 2 + 2 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN3 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 3 + 3 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN4 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 4 + 4 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN5 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 5 + 5 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN6 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 6 + 6 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN7 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 7 + 7 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN8 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 8 + 8 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT0 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 16 + 16 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT1 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 17 + 17 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT2 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 18 + 18 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT3 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 19 + 19 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT4 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 20 + 20 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT5 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 21 + 21 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT6 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 22 + 22 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT7 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 23 + 23 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT8 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 24 + 24 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + + + EPDATASTATUS + Provides information on which endpoint(s) an acknowledged data transfer has occurred (EPDATA event) + 0x46C + read-write + oneToClear + + + EPIN1 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 1 + 1 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPIN2 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 2 + 2 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPIN3 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 3 + 3 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPIN4 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 4 + 4 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPIN5 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 5 + 5 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPIN6 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 6 + 6 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPIN7 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 7 + 7 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT1 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 17 + 17 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT2 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 18 + 18 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT3 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 19 + 19 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT4 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 20 + 20 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT5 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 21 + 21 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT6 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 22 + 22 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT7 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 23 + 23 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + + + USBADDR + Device USB address + 0x470 + read-only + + + ADDR + Device USB address + 0 + 6 + + + + + BMREQUESTTYPE + SETUP data, byte 0, bmRequestType + 0x480 + read-only + 0x00000000 + + + RECIPIENT + Data transfer type + 0 + 4 + + + Device + Device + 0 + + + Interface + Interface + 1 + + + Endpoint + Endpoint + 2 + + + Other + Other + 3 + + + + + TYPE + Data transfer type + 5 + 6 + + + Standard + Standard + 0 + + + Class + Class + 1 + + + Vendor + Vendor + 2 + + + + + DIRECTION + Data transfer direction + 7 + 7 + + + HostToDevice + Host-to-device + 0 + + + DeviceToHost + Device-to-host + 1 + + + + + + + BREQUEST + SETUP data, byte 1, bRequest + 0x484 + read-only + 0x00000000 + + + BREQUEST + SETUP data, byte 1, bRequest. Values provided for standard requests only, user must implement class and vendor values. + 0 + 7 + + + STD_GET_STATUS + Standard request GET_STATUS + 0 + + + STD_CLEAR_FEATURE + Standard request CLEAR_FEATURE + 1 + + + STD_SET_FEATURE + Standard request SET_FEATURE + 3 + + + STD_SET_ADDRESS + Standard request SET_ADDRESS + 5 + + + STD_GET_DESCRIPTOR + Standard request GET_DESCRIPTOR + 6 + + + STD_SET_DESCRIPTOR + Standard request SET_DESCRIPTOR + 7 + + + STD_GET_CONFIGURATION + Standard request GET_CONFIGURATION + 8 + + + STD_SET_CONFIGURATION + Standard request SET_CONFIGURATION + 9 + + + STD_GET_INTERFACE + Standard request GET_INTERFACE + 10 + + + STD_SET_INTERFACE + Standard request SET_INTERFACE + 11 + + + STD_SYNCH_FRAME + Standard request SYNCH_FRAME + 12 + + + + + + + WVALUEL + SETUP data, byte 2, LSB of wValue + 0x488 + read-only + 0x00000000 + + + WVALUEL + SETUP data, byte 2, LSB of wValue + 0 + 7 + + + + + WVALUEH + SETUP data, byte 3, MSB of wValue + 0x48C + read-only + 0x00000000 + + + WVALUEH + SETUP data, byte 3, MSB of wValue + 0 + 7 + + + + + WINDEXL + SETUP data, byte 4, LSB of wIndex + 0x490 + read-only + 0x00000000 + + + WINDEXL + SETUP data, byte 4, LSB of wIndex + 0 + 7 + + + + + WINDEXH + SETUP data, byte 5, MSB of wIndex + 0x494 + read-only + 0x00000000 + + + WINDEXH + SETUP data, byte 5, MSB of wIndex + 0 + 7 + + + + + WLENGTHL + SETUP data, byte 6, LSB of wLength + 0x498 + read-only + 0x00000000 + + + WLENGTHL + SETUP data, byte 6, LSB of wLength + 0 + 7 + + + + + WLENGTHH + SETUP data, byte 7, MSB of wLength + 0x49C + read-only + 0x00000000 + + + WLENGTHH + SETUP data, byte 7, MSB of wLength + 0 + 7 + + + + + SIZE + Unspecified + USBD_SIZE + read-write + 0x4A0 + + 0x8 + 0x4 + EPOUT[%s] + Description collection: Number of bytes received last in the data stage of this OUT endpoint + 0x000 + read-write + + + SIZE + Number of bytes received last in the data stage of this OUT endpoint + 0 + 6 + + + + + ISOOUT + Number of bytes received last on this ISO OUT data endpoint + 0x020 + read-only + 0x00010000 + + + SIZE + Number of bytes received last on this ISO OUT data endpoint + 0 + 9 + + + ZERO + Zero-length data packet received + 16 + 16 + + + Normal + No zero-length data received, use value in SIZE + 0 + + + ZeroData + Zero-length data received, ignore value in SIZE + 1 + + + + + + + + ENABLE + Enable USB + 0x500 + read-write + + + ENABLE + Enable USB + 0 + 0 + + + Disabled + USB peripheral is disabled + 0 + + + Enabled + USB peripheral is enabled + 1 + + + + + + + USBPULLUP + Control of the USB pull-up + 0x504 + read-write + + + CONNECT + Control of the USB pull-up on the D+ line + 0 + 0 + + + Disabled + Pull-up is disconnected + 0 + + + Enabled + Pull-up is connected to D+ + 1 + + + + + + + DPDMVALUE + State D+ and D- lines will be forced into by the DPDMDRIVE task. The DPDMNODRIVE task reverts the control of the lines to MAC IP (no forcing). + 0x508 + read-write + + + STATE + State D+ and D- lines will be forced into by the DPDMDRIVE task + 0 + 4 + + + Resume + D+ forced low, D- forced high (K state) for a timing preset in hardware (50 us or 5 ms, depending on bus state) + 1 + + + J + D+ forced high, D- forced low (J state) + 2 + + + K + D+ forced low, D- forced high (K state) + 4 + + + + + + + DTOGGLE + Data toggle control and status + 0x50C + read-write + 0x00000100 + + + EP + Select bulk endpoint number + 0 + 2 + + + IO + Selects IN or OUT endpoint + 7 + 7 + + + Out + Selects OUT endpoint + 0 + + + In + Selects IN endpoint + 1 + + + + + VALUE + Data toggle value + 8 + 9 + + + Nop + No action on data toggle when writing the register with this value + 0 + + + Data0 + Data toggle is DATA0 on endpoint set by EP and IO + 1 + + + Data1 + Data toggle is DATA1 on endpoint set by EP and IO + 2 + + + + + + + EPINEN + Endpoint IN enable + 0x510 + read-write + 0x00000001 + + + IN0 + Enable IN endpoint 0 + 0 + 0 + + + Disable + Disable endpoint IN 0 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 0 (response to IN tokens) + 1 + + + + + IN1 + Enable IN endpoint 1 + 1 + 1 + + + Disable + Disable endpoint IN 1 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 1 (response to IN tokens) + 1 + + + + + IN2 + Enable IN endpoint 2 + 2 + 2 + + + Disable + Disable endpoint IN 2 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 2 (response to IN tokens) + 1 + + + + + IN3 + Enable IN endpoint 3 + 3 + 3 + + + Disable + Disable endpoint IN 3 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 3 (response to IN tokens) + 1 + + + + + IN4 + Enable IN endpoint 4 + 4 + 4 + + + Disable + Disable endpoint IN 4 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 4 (response to IN tokens) + 1 + + + + + IN5 + Enable IN endpoint 5 + 5 + 5 + + + Disable + Disable endpoint IN 5 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 5 (response to IN tokens) + 1 + + + + + IN6 + Enable IN endpoint 6 + 6 + 6 + + + Disable + Disable endpoint IN 6 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 6 (response to IN tokens) + 1 + + + + + IN7 + Enable IN endpoint 7 + 7 + 7 + + + Disable + Disable endpoint IN 7 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 7 (response to IN tokens) + 1 + + + + + ISOIN + Enable ISO IN endpoint + 8 + 8 + + + Disable + Disable ISO IN endpoint 8 + 0 + + + Enable + Enable ISO IN endpoint 8 + 1 + + + + + + + EPOUTEN + Endpoint OUT enable + 0x514 + read-write + 0x00000001 + + + OUT0 + Enable OUT endpoint 0 + 0 + 0 + + + Disable + Disable endpoint OUT 0 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 0 (response to OUT tokens) + 1 + + + + + OUT1 + Enable OUT endpoint 1 + 1 + 1 + + + Disable + Disable endpoint OUT 1 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 1 (response to OUT tokens) + 1 + + + + + OUT2 + Enable OUT endpoint 2 + 2 + 2 + + + Disable + Disable endpoint OUT 2 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 2 (response to OUT tokens) + 1 + + + + + OUT3 + Enable OUT endpoint 3 + 3 + 3 + + + Disable + Disable endpoint OUT 3 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 3 (response to OUT tokens) + 1 + + + + + OUT4 + Enable OUT endpoint 4 + 4 + 4 + + + Disable + Disable endpoint OUT 4 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 4 (response to OUT tokens) + 1 + + + + + OUT5 + Enable OUT endpoint 5 + 5 + 5 + + + Disable + Disable endpoint OUT 5 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 5 (response to OUT tokens) + 1 + + + + + OUT6 + Enable OUT endpoint 6 + 6 + 6 + + + Disable + Disable endpoint OUT 6 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 6 (response to OUT tokens) + 1 + + + + + OUT7 + Enable OUT endpoint 7 + 7 + 7 + + + Disable + Disable endpoint OUT 7 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 7 (response to OUT tokens) + 1 + + + + + ISOOUT + Enable ISO OUT endpoint 8 + 8 + 8 + + + Disable + Disable ISO OUT endpoint 8 + 0 + + + Enable + Enable ISO OUT endpoint 8 + 1 + + + + + + + EPSTALL + STALL endpoints + 0x518 + write-only + 0x00000000 + modifyExternal + + + EP + Select endpoint number + 0 + 2 + + + IO + Selects IN or OUT endpoint + 7 + 7 + + + Out + Selects OUT endpoint + 0 + + + In + Selects IN endpoint + 1 + + + + + STALL + Stall selected endpoint + 8 + 8 + + + UnStall + Don't stall selected endpoint + 0 + + + Stall + Stall selected endpoint + 1 + + + + + + + ISOSPLIT + Controls the split of ISO buffers + 0x51C + read-write + + + SPLIT + Controls the split of ISO buffers + 0 + 15 + + + OneDir + Full buffer dedicated to either ISO IN or OUT + 0x0000 + + + HalfIN + Lower half for IN, upper half for OUT + 0x0080 + + + + + + + FRAMECNTR + Returns the current value of the start of frame counter + 0x520 + read-only + + + FRAMECNTR + Returns the current value of the start of frame counter + 0 + 10 + + + + + LOWPOWER + Controls USBD peripheral low power mode during USB suspend + 0x52C + read-write + 0x00000000 + + + LOWPOWER + Controls USBD peripheral low-power mode during USB suspend + 0 + 0 + + + ForceNormal + Software must write this value to exit low power mode and before performing a remote wake-up + 0 + + + LowPower + Software must write this value to enter low power mode after DMA and software have finished interacting with the USB peripheral + 1 + + + + + + + ISOINCONFIG + Controls the response of the ISO IN endpoint to an IN token when no data is ready to be sent + 0x530 + read-write + + + RESPONSE + Controls the response of the ISO IN endpoint to an IN token when no data is ready to be sent + 0 + 0 + + + NoResp + Endpoint does not respond in that case + 0 + + + ZeroData + Endpoint responds with a zero-length data packet in that case + 1 + + + + + + + 8 + 0x014 + EPIN[%s] + Unspecified + USBD_EPIN + read-write + 0x600 + + PTR + Description cluster: Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Description cluster: Maximum number of bytes to transfer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes to transfer + 0 + 6 + + + + + AMOUNT + Description cluster: Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 6 + + + + + + ISOIN + Unspecified + USBD_ISOIN + read-write + 0x6A0 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes to transfer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes to transfer + 0 + 9 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 9 + + + + + + 8 + 0x014 + EPOUT[%s] + Unspecified + USBD_EPOUT + read-write + 0x700 + + PTR + Description cluster: Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Description cluster: Maximum number of bytes to transfer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes to transfer + 0 + 6 + + + + + AMOUNT + Description cluster: Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 6 + + + + + + ISOOUT + Unspecified + USBD_ISOOUT + read-write + 0x7A0 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes to transfer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes to transfer + 0 + 9 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 9 + + + + + + + + UARTE1 + UART with EasyDMA 1 + 0x40028000 + + UARTE1 + 40 + + + + QSPI + External flash interface + 0x40029000 + + 0 + 0x1000 + registers + + + QSPI + 41 + + QSPI + 0x20 + + + TASKS_ACTIVATE + Activate QSPI interface + 0x000 + write-only + + + TASKS_ACTIVATE + Activate QSPI interface + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_READSTART + Start transfer from external flash memory to internal RAM + 0x004 + write-only + + + TASKS_READSTART + Start transfer from external flash memory to internal RAM + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_WRITESTART + Start transfer from internal RAM to external flash memory + 0x008 + write-only + + + TASKS_WRITESTART + Start transfer from internal RAM to external flash memory + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_ERASESTART + Start external flash memory erase operation + 0x00C + write-only + + + TASKS_ERASESTART + Start external flash memory erase operation + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + TASKS_DEACTIVATE + Deactivate QSPI interface + 0x010 + write-only + + + TASKS_DEACTIVATE + Deactivate QSPI interface + 0 + 0 + + + Trigger + Trigger task + 1 + + + + + + + EVENTS_READY + QSPI peripheral is ready. This event will be generated as a response to any QSPI task. + 0x100 + read-write + + + EVENTS_READY + QSPI peripheral is ready. This event will be generated as a response to any QSPI task. + 0 + 0 + + + NotGenerated + Event not generated + 0 + + + Generated + Event generated + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + READY + Enable or disable interrupt for event READY + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to enable interrupt for event READY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to disable interrupt for event READY + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + Enable QSPI peripheral and acquire the pins selected in PSELn registers + 0x500 + read-write + + + ENABLE + Enable or disable QSPI + 0 + 0 + + + Disabled + Disable QSPI + 0 + + + Enabled + Enable QSPI + 1 + + + + + + + READ + Unspecified + QSPI_READ + read-write + 0x504 + + SRC + Flash memory source address + 0x000 + read-write + + + SRC + Word-aligned flash memory source address. + 0 + 31 + + + + + DST + RAM destination address + 0x004 + read-write + + + DST + Word-aligned RAM destination address. + 0 + 31 + + + + + CNT + Read transfer length + 0x008 + read-write + + + CNT + Read transfer length in number of bytes. The length must be a multiple of 4 bytes. + 0 + 17 + + + + + + WRITE + Unspecified + QSPI_WRITE + read-write + 0x510 + + DST + Flash destination address + 0x000 + read-write + + + DST + Word-aligned flash destination address. + 0 + 31 + + + + + SRC + RAM source address + 0x004 + read-write + + + SRC + Word-aligned RAM source address. + 0 + 31 + + + + + CNT + Write transfer length + 0x008 + read-write + + + CNT + Write transfer length in number of bytes. The length must be a multiple of 4 bytes. + 0 + 17 + + + + + + ERASE + Unspecified + QSPI_ERASE + read-write + 0x51C + + PTR + Start address of flash block to be erased + 0x000 + read-write + + + PTR + Word-aligned start address of block to be erased. + 0 + 31 + + + + + LEN + Size of block to be erased. + 0x004 + read-write + + + LEN + LEN + 0 + 1 + + + 4KB + Erase 4 kB block (flash command 0x20) + 0 + + + 64KB + Erase 64 kB block (flash command 0xD8) + 1 + + + All + Erase all (flash command 0xC7) + 2 + + + + + + + + PSEL + Unspecified + QSPI_PSEL + read-write + 0x524 + + SCK + Pin select for serial clock SCK + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + CSN + Pin select for chip select signal CSN. + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + IO0 + Pin select for serial data MOSI/IO0. + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + IO1 + Pin select for serial data MISO/IO1. + 0x010 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + IO2 + Pin select for serial data IO2. + 0x014 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + IO3 + Pin select for serial data IO3. + 0x018 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + XIPOFFSET + Address offset into the external memory for Execute in Place operation. + 0x540 + read-write + + + XIPOFFSET + Address offset into the external memory for Execute in Place operation. Value must be a multiple of 4. + 0 + 31 + + + + + IFCONFIG0 + Interface configuration. + 0x544 + read-write + + + READOC + Configure number of data lines and opcode used for reading. + 0 + 2 + + + FASTREAD + Single data line SPI. FAST_READ (opcode 0x0B). + 0 + + + READ2O + Dual data line SPI. READ2O (opcode 0x3B). + 1 + + + READ2IO + Dual data line SPI. READ2IO (opcode 0xBB). + 2 + + + READ4O + Quad data line SPI. READ4O (opcode 0x6B). + 3 + + + READ4IO + Quad data line SPI. READ4IO (opcode 0xEB). + 4 + + + + + WRITEOC + Configure number of data lines and opcode used for writing. + 3 + 5 + + + PP + Single data line SPI. PP (opcode 0x02). + 0 + + + PP2O + Dual data line SPI. PP2O (opcode 0xA2). + 1 + + + PP4O + Quad data line SPI. PP4O (opcode 0x32). + 2 + + + PP4IO + Quad data line SPI. PP4IO (opcode 0x38). + 3 + + + + + ADDRMODE + Addressing mode. + 6 + 6 + + + 24BIT + 24-bit addressing. + 0 + + + 32BIT + 32-bit addressing. + 1 + + + + + DPMENABLE + Enable deep power-down mode (DPM) feature. + 7 + 7 + + + Disable + Disable DPM feature. + 0 + + + Enable + Enable DPM feature. + 1 + + + + + PPSIZE + Page size for commands PP, PP2O, PP4O and PP4IO. + 12 + 12 + + + 256Bytes + 256 bytes. + 0 + + + 512Bytes + 512 bytes. + 1 + + + + + + + IFCONFIG1 + Interface configuration. + 0x600 + read-write + 0x00040480 + + + SCKDELAY + Minimum amount of time that the CSN pin must stay high before it can go low again. Value is specified in number of 16 MHz periods (62.5 ns). + 0 + 7 + + + DPMEN + Enter/exit deep power-down mode (DPM) for external flash memory. + 24 + 24 + + + Exit + Exit DPM. + 0 + + + Enter + Enter DPM. + 1 + + + + + SPIMODE + Select SPI mode. + 25 + 25 + + + MODE0 + Mode 0: Data are captured on the clock rising edge and data is output on a falling edge. Base level of clock is 0 (CPOL=0, CPHA=0). + 0 + + + MODE3 + Mode 3: Data are captured on the clock falling edge and data is output on a rising edge. Base level of clock is 1 (CPOL=1, CPHA=1). + 1 + + + + + SCKFREQ + SCK frequency is given as 32 MHz / (SCKFREQ + 1). + 28 + 31 + + + + + STATUS + Status register. + 0x604 + read-only + + + DPM + Deep power-down mode (DPM) status of external flash. + 2 + 2 + + + Disabled + External flash is not in DPM. + 0 + + + Enabled + External flash is in DPM. + 1 + + + + + READY + Ready status. + 3 + 3 + + + READY + QSPI peripheral is ready. It is allowed to trigger new tasks, writing custom instructions or enter/exit DPM. + 1 + + + BUSY + QSPI peripheral is busy. It is not allowed to trigger any new tasks, writing custom instructions or enter/exit DPM. + 0 + + + + + SREG + Value of external flash device Status Register. When the external flash has two bytes status register this field includes the value of the low byte. + 24 + 31 + + + + + DPMDUR + Set the duration required to enter/exit deep power-down mode (DPM). + 0x614 + read-write + 0xFFFFFFFF + + + ENTER + Duration needed by external flash to enter DPM. Duration is given as ENTER * 256 * 62.5 ns. + 0 + 15 + + + EXIT + Duration needed by external flash to exit DPM. Duration is given as EXIT * 256 * 62.5 ns. + 16 + 31 + + + + + ADDRCONF + Extended address configuration. + 0x624 + read-write + 0x000000B7 + + + OPCODE + Opcode that enters the 32-bit addressing mode. + 0 + 7 + + + BYTE0 + Byte 0 following opcode. + 8 + 15 + + + BYTE1 + Byte 1 following byte 0. + 16 + 23 + + + MODE + Extended addressing mode. + 24 + 25 + + + NoInstr + Do not send any instruction. + 0 + + + Opcode + Send opcode. + 1 + + + OpByte0 + Send opcode, byte0. + 2 + + + All + Send opcode, byte0, byte1. + 3 + + + + + WIPWAIT + Wait for write complete before sending command. + 26 + 26 + + + Disable + No wait. + 0 + + + Enable + Wait. + 1 + + + + + WREN + Send WREN (write enable opcode 0x06) before instruction. + 27 + 27 + + + Disable + Do not send WREN. + 0 + + + Enable + Send WREN. + 1 + + + + + + + CINSTRCONF + Custom instruction configuration register. + 0x634 + read-write + 0x00002000 + + + OPCODE + Opcode of Custom instruction. + 0 + 7 + + + LENGTH + Length of custom instruction in number of bytes. + 8 + 11 + + + 1B + Send opcode only. + 1 + + + 2B + Send opcode, CINSTRDAT0.BYTE0. + 2 + + + 3B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT0.BYTE1. + 3 + + + 4B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT0.BYTE2. + 4 + + + 5B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT0.BYTE3. + 5 + + + 6B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE4. + 6 + + + 7B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE5. + 7 + + + 8B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE6. + 8 + + + 9B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE7. + 9 + + + + + LIO2 + Level of the IO2 pin (if connected) during transmission of custom instruction. + 12 + 12 + + + LIO3 + Level of the IO3 pin (if connected) during transmission of custom instruction. + 13 + 13 + + + WIPWAIT + Wait for write complete before sending command. + 14 + 14 + + + Disable + No wait. + 0 + + + Enable + Wait. + 1 + + + + + WREN + Send WREN (write enable opcode 0x06) before instruction. + 15 + 15 + + + Disable + Do not send WREN. + 0 + + + Enable + Send WREN. + 1 + + + + + LFEN + Enable long frame mode. When enabled, a custom instruction transaction has to be ended by writing the LFSTOP field. + 16 + 16 + + + Disable + Long frame mode disabled + 0 + + + Enable + Long frame mode enabled + 1 + + + + + LFSTOP + Stop (finalize) long frame transaction + 17 + 17 + + + Stop + Stop + 1 + + + + + + + CINSTRDAT0 + Custom instruction data register 0. + 0x638 + read-write + + + BYTE0 + Data byte 0 + 0 + 7 + + + BYTE1 + Data byte 1 + 8 + 15 + + + BYTE2 + Data byte 2 + 16 + 23 + + + BYTE3 + Data byte 3 + 24 + 31 + + + + + CINSTRDAT1 + Custom instruction data register 1. + 0x63C + read-write + + + BYTE4 + Data byte 4 + 0 + 7 + + + BYTE5 + Data byte 5 + 8 + 15 + + + BYTE6 + Data byte 6 + 16 + 23 + + + BYTE7 + Data byte 7 + 24 + 31 + + + + + IFTIMING + SPI interface timing. + 0x640 + read-write + 0x00000200 + + + RXDELAY + Timing related to sampling of the input serial data. The value of RXDELAY specifies the number of 64 MHz cycles (15.625 ns) delay from the the rising edge of the SPI Clock (SCK) until the input serial data is sampled. As en example, if set to 0 the input serial data is sampled on the rising edge of SCK. + 8 + 10 + + + + + + + CC_HOST_RGF + CRYPTOCELL HOST_RGF interface + 0x5002A000 + + 0 + 0x2000 + registers + + CC_HOST_RGF + 0x20 + + + HOST_CRYPTOKEY_SEL + AES hardware key select + 0x1A38 + read-write + 0x00000000 + + + HOST_CRYPTOKEY_SEL + Select the source of the HW key that is used by the AES engine + 0 + 1 + + + K_DR + Use device root key K_DR from CRYPTOCELL AO power domain + 0 + + + K_PRTL + Use hard-coded RTL key K_PRTL + 1 + + + Session + Use provided session key + 2 + + + + + + + HOST_IOT_KPRTL_LOCK + This write-once register is the K_PRTL lock register. When this register is set, K_PRTL cannot be used and a zeroed key will be used instead. The value of this register is saved in the CRYPTOCELL AO power domain. + 0x1A4C + read-write + 0x00000000 + + + HOST_IOT_KPRTL_LOCK + This register is the K_PRTL lock register. When this register is set, K_PRTL cannot be used and a zeroed key will be used instead. The value of this register is saved in the CRYPTOCELL AO power domain. + 0 + 0 + + + Disabled + K_PRTL can be selected for use from register HOST_CRYPTOKEY_SEL + 0 + + + Enabled + K_PRTL has been locked until next power-on reset (POR). If K_PRTL is selected anyway, a zeroed key will be used instead. + 1 + + + + + + + HOST_IOT_KDR0 + This register holds bits 31:0 of K_DR. The value of this register is saved in the CRYPTOCELL AO power domain. Reading from this address returns the K_DR valid status indicating if K_DR is successfully retained. + 0x1A50 + read-write + 0x00000000 + + + HOST_IOT_KDR0 + Write: K_DR bits 31:0. Read: 0x00000000 when 128-bit K_DR key value is not yet retained in the CRYPTOCELL AO power domain. Read: 0x00000001 when 128-bit K_DR key value is successfully retained in the CRYPTOCELL AO power domain. + 0 + 31 + + + + + HOST_IOT_KDR1 + This register holds bits 63:32 of K_DR. The value of this register is saved in the CRYPTOCELL AO power domain. + 0x1A54 + write-only + 0x00000000 + + + HOST_IOT_KDR1 + K_DR bits 63:32 + 0 + 31 + + + + + HOST_IOT_KDR2 + This register holds bits 95:64 of K_DR. The value of this register is saved in the CRYPTOCELL AO power domain. + 0x1A58 + write-only + 0x00000000 + + + HOST_IOT_KDR2 + K_DR bits 95:64 + 0 + 31 + + + + + HOST_IOT_KDR3 + This register holds bits 127:96 of K_DR. The value of this register is saved in the CRYPTOCELL AO power domain. + 0x1A5C + write-only + 0x00000000 + + + HOST_IOT_KDR3 + K_DR bits 127:96 + 0 + 31 + + + + + HOST_IOT_LCS + Controls lifecycle state (LCS) for CRYPTOCELL subsystem + 0x1A60 + read-write + 0x00000002 + + + LCS + Lifecycle state value. This field is write-once per reset. + 0 + 2 + + + Debug + CC310 operates in debug mode + 0 + + + Secure + CC310 operates in secure mode + 2 + + + + + LCS_IS_VALID + Read-only field. Indicates if CRYPTOCELL LCS has been successfully configured since last reset. + 8 + 8 + + + Invalid + Valid LCS not yet retained in the CRYPTOCELL AO power domain + 0 + + + Valid + Valid LCS successfully retained in the CRYPTOCELL AO power domain + 1 + + + + + + + + + CRYPTOCELL + ARM TrustZone CryptoCell register interface + 0x5002A000 + CC_HOST_RGF + + 0 + 0x2000 + registers + + + CRYPTOCELL + 42 + + CRYPTOCELL + 0x20 + + + ENABLE + Enable CRYPTOCELL subsystem + 0x500 + read-write + 0x00000000 + + + ENABLE + Enable or disable the CRYPTOCELL subsystem + 0 + 0 + + + Disabled + CRYPTOCELL subsystem disabled + 0 + + + Enabled + CRYPTOCELL subsystem enabled. + 1 + + + + + + + + + PWM3 + Pulse width modulation unit 3 + 0x4002D000 + + PWM3 + 45 + + + + SPIM3 + Serial Peripheral Interface Master with EasyDMA 3 + 0x4002F000 + + SPIM3 + 47 + + + + \ No newline at end of file diff --git a/res/nrf52-arm/nrf52840_2.svd b/res/nrf52-arm/nrf52840_2.svd new file mode 100644 index 00000000..1aa5e7bd --- /dev/null +++ b/res/nrf52-arm/nrf52840_2.svd @@ -0,0 +1,51572 @@ + + + + Nordic Semiconductor + Nordic + nrf52840 + nrf52 + 1 + nRF52840 reference description for radio MCU with ARM 32-bit Cortex-M4 Microcontroller + +Copyright (c) 2010 - 2018, Nordic Semiconductor ASA\n +\n +All rights reserved.\n +\n +Redistribution and use in source and binary forms, with or without\n +modification, are permitted provided that the following conditions are met:\n +\n +1. Redistributions of source code must retain the above copyright notice,\n + this list of conditions and the following disclaimer.\n +\n +2. Redistributions in binary form, except as embedded into a Nordic\n + Semiconductor ASA integrated circuit in a product or a software update\n + for such product, must reproduce the above copyright notice, this list\n + of conditions and the following disclaimer in the documentation and/or\n + other materials provided with the distribution.\n +\n +3. Neither the name of Nordic Semiconductor ASA nor the names of its\n + contributors may be used to endorse or promote products derived from\n + this software without specific prior written permission.\n +\n +4. This software, with or without modification, must only be used with a\n + Nordic Semiconductor ASA integrated circuit.\n +\n +5. Any software provided in binary form under this license must not be\n + reverse engineered, decompiled, modified and/or disassembled.\n +\n +THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY\n +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n +WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A\n +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR\n +ASA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\n +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n + + 8 + 32 + 32 + 0x00000000 + 0xFFFFFFFF + + CM4 + r0p1 + little + 1 + 1 + 3 + 0 + + system_nrf52840 + NRF_ + + 2048 + 2048 + 112 + + + + FICR + Factory information configuration registers + 0x10000000 + + 0 + 0x1000 + registers + + FICR + 0x20 + + + CODEPAGESIZE + Code memory page size + 0x010 + read-only + 0xFFFFFFFF + + + CODEPAGESIZE + Code memory page size + 0 + 31 + + + + + CODESIZE + Code memory size + 0x014 + read-only + 0xFFFFFFFF + + + CODESIZE + Code memory size in number of pages + 0 + 31 + + + + + 0x2 + 0x4 + DEVICEID[%s] + Description collection[n]: Device identifier + 0x060 + read-only + 0xFFFFFFFF + + + DEVICEID + 64 bit unique device identifier + 0 + 31 + + + + + 0x4 + 0x4 + ER[%s] + Description collection[n]: Encryption root, word n + 0x080 + read-only + 0xFFFFFFFF + + + ER + Encryption root, word n + 0 + 31 + + + + + 0x4 + 0x4 + IR[%s] + Description collection[n]: Identity Root, word n + 0x090 + read-only + 0xFFFFFFFF + + + IR + Identity Root, word n + 0 + 31 + + + + + DEVICEADDRTYPE + Device address type + 0x0A0 + read-only + 0xFFFFFFFF + + + DEVICEADDRTYPE + Device address type + 0 + 0 + + + Public + Public address + 0 + + + Random + Random address + 1 + + + + + + + 0x2 + 0x4 + DEVICEADDR[%s] + Description collection[n]: Device address n + 0x0A4 + read-only + 0xFFFFFFFF + + + DEVICEADDR + 48 bit device address + 0 + 31 + + + + + INFO + Device info + FICR_INFO + 0x100 + + PART + Part code + 0x000 + read-only + 0x00052840 + + + PART + Part code + 0 + 31 + + + N52840 + nRF52840 + 0x52840 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + VARIANT + Build code (hardware version and production configuration) + 0x004 + read-only + 0xFFFFFFFF + + + VARIANT + Build code (hardware version and production configuration). Encoded as ASCII. + 0 + 31 + + + AAAA + AAAA + 0x41414141 + + + BAAA + BAAA + 0x42414141 + + + CAAA + CAAA + 0x43414141 + + + AABA + AABA + 0x41414241 + + + AABB + AABB + 0x41414242 + + + AACA + AACA + 0x41414341 + + + AAAB + AAAB + 0x41414142 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + PACKAGE + Package option + 0x008 + read-only + 0xFFFFFFFF + + + PACKAGE + Package option + 0 + 31 + + + QI + QIxx - 73-pin aQFN + 0x2004 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + RAM + RAM variant + 0x00C + read-only + 0xFFFFFFFF + + + RAM + RAM variant + 0 + 31 + + + K16 + 16 kByte RAM + 0x10 + + + K32 + 32 kByte RAM + 0x20 + + + K64 + 64 kByte RAM + 0x40 + + + K128 + 128 kByte RAM + 0x80 + + + K256 + 256 kByte RAM + 0x100 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + FLASH + Flash variant + 0x010 + read-only + 0xFFFFFFFF + + + FLASH + Flash variant + 0 + 31 + + + K128 + 128 kByte FLASH + 0x80 + + + K256 + 256 kByte FLASH + 0x100 + + + K512 + 512 kByte FLASH + 0x200 + + + K1024 + 1 MByte FLASH + 0x400 + + + K2048 + 2 MByte FLASH + 0x800 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + 0x3 + 0x4 + UNUSED8[%s] + Unspecified + 0x014 + read-write + + + + 0x3 + 0x4 + PRODTEST[%s] + Description collection[n]: Production test signature n + 0x350 + read-only + 0xFFFFFFFF + + + PRODTEST + Production test signature n + 0 + 31 + + + Done + Production tests done + 0xBB42319F + + + NotDone + Production tests not done + 0xFFFFFFFF + + + + + + + TEMP + Registers storing factory TEMP module linearization coefficients + FICR_TEMP + 0x404 + + A0 + Slope definition A0 + 0x000 + read-only + 0xFFFFF320 + + + A + A (slope definition) register. + 0 + 11 + + + + + A1 + Slope definition A1 + 0x004 + read-only + 0xFFFFF343 + + + A + A (slope definition) register. + 0 + 11 + + + + + A2 + Slope definition A2 + 0x008 + read-only + 0xFFFFF35D + + + A + A (slope definition) register. + 0 + 11 + + + + + A3 + Slope definition A3 + 0x00C + read-only + 0xFFFFF400 + + + A + A (slope definition) register. + 0 + 11 + + + + + A4 + Slope definition A4 + 0x010 + read-only + 0xFFFFF452 + + + A + A (slope definition) register. + 0 + 11 + + + + + A5 + Slope definition A5 + 0x014 + read-only + 0xFFFFF37B + + + A + A (slope definition) register. + 0 + 11 + + + + + B0 + Y-intercept B0 + 0x018 + read-only + 0xFFFF3FCC + + + B + B (y-intercept) + 0 + 13 + + + + + B1 + Y-intercept B1 + 0x01C + read-only + 0xFFFF3F98 + + + B + B (y-intercept) + 0 + 13 + + + + + B2 + Y-intercept B2 + 0x020 + read-only + 0xFFFF3F98 + + + B + B (y-intercept) + 0 + 13 + + + + + B3 + Y-intercept B3 + 0x024 + read-only + 0xFFFF0012 + + + B + B (y-intercept) + 0 + 13 + + + + + B4 + Y-intercept B4 + 0x028 + read-only + 0xFFFF004D + + + B + B (y-intercept) + 0 + 13 + + + + + B5 + Y-intercept B5 + 0x02C + read-only + 0xFFFF3E10 + + + B + B (y-intercept) + 0 + 13 + + + + + T0 + Segment end T0 + 0x030 + read-only + 0xFFFFFFE2 + + + T + T (segment end) register + 0 + 7 + + + + + T1 + Segment end T1 + 0x034 + read-only + 0xFFFFFF00 + + + T + T (segment end) register + 0 + 7 + + + + + T2 + Segment end T2 + 0x038 + read-only + 0xFFFFFF14 + + + T + T (segment end) register + 0 + 7 + + + + + T3 + Segment end T3 + 0x03C + read-only + 0xFFFFFF19 + + + T + T (segment end) register + 0 + 7 + + + + + T4 + Segment end T4 + 0x040 + read-only + 0xFFFFFF50 + + + T + T (segment end) register + 0 + 7 + + + + + + NFC + Unspecified + FICR_NFC + 0x450 + + TAGHEADER0 + Default header for NFC tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. + 0x000 + read-only + 0xFFFFFF5F + + + MFGID + Default Manufacturer ID: Nordic Semiconductor ASA has ICM 0x5F + 0 + 7 + + + UD1 + Unique identifier byte 1 + 8 + 15 + + + UD2 + Unique identifier byte 2 + 16 + 23 + + + UD3 + Unique identifier byte 3 + 24 + 31 + + + + + TAGHEADER1 + Default header for NFC tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. + 0x004 + read-only + 0xFFFFFFFF + + + UD4 + Unique identifier byte 4 + 0 + 7 + + + UD5 + Unique identifier byte 5 + 8 + 15 + + + UD6 + Unique identifier byte 6 + 16 + 23 + + + UD7 + Unique identifier byte 7 + 24 + 31 + + + + + TAGHEADER2 + Default header for NFC tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. + 0x008 + read-only + 0xFFFFFFFF + + + UD8 + Unique identifier byte 8 + 0 + 7 + + + UD9 + Unique identifier byte 9 + 8 + 15 + + + UD10 + Unique identifier byte 10 + 16 + 23 + + + UD11 + Unique identifier byte 11 + 24 + 31 + + + + + TAGHEADER3 + Default header for NFC tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. + 0x00C + read-only + 0xFFFFFFFF + + + UD12 + Unique identifier byte 12 + 0 + 7 + + + UD13 + Unique identifier byte 13 + 8 + 15 + + + UD14 + Unique identifier byte 14 + 16 + 23 + + + UD15 + Unique identifier byte 15 + 24 + 31 + + + + + + TRNG90B + NIST800-90B RNG calibration data + FICR_TRNG90B + 0xC00 + + BYTES + Amount of bytes for the required entropy bits + 0x000 + read-only + 0xFFFFFFFF + + + BYTES + Amount of bytes for the required entropy bits + 0 + 31 + + + + + RCCUTOFF + Repetition counter cutoff + 0x004 + read-only + 0xFFFFFFFF + + + RCCUTOFF + Repetition counter cutoff + 0 + 31 + + + + + APCUTOFF + Adaptive proportion cutoff + 0x008 + read-only + 0xFFFFFFFF + + + APCUTOFF + Adaptive proportion cutoff + 0 + 31 + + + + + STARTUP + Amount of bytes for the startup tests + 0x00C + read-only + 0x00000210 + + + STARTUP + Amount of bytes for the startup tests + 0 + 31 + + + + + ROSC1 + Sample count for ring oscillator 1 + 0x010 + read-only + 0xFFFFFFFF + + + ROSC1 + Sample count for ring oscillator 1 + 0 + 31 + + + + + ROSC2 + Sample count for ring oscillator 2 + 0x014 + read-only + 0xFFFFFFFF + + + ROSC2 + Sample count for ring oscillator 2 + 0 + 31 + + + + + ROSC3 + Sample count for ring oscillator 3 + 0x018 + read-only + 0xFFFFFFFF + + + ROSC3 + Sample count for ring oscillator 3 + 0 + 31 + + + + + ROSC4 + Sample count for ring oscillator 4 + 0x01C + read-only + 0xFFFFFFFF + + + ROSC4 + Sample count for ring oscillator 4 + 0 + 31 + + + + + + + + UICR + User information configuration registers + 0x10001000 + + 0 + 0x1000 + registers + + UICR + 0x20 + + + UNUSED0 + Unspecified + 0x000 + read-write + + + UNUSED1 + Unspecified + 0x004 + read-write + + + UNUSED2 + Unspecified + 0x008 + read-write + + + UNUSED3 + Unspecified + 0x010 + read-write + + + 0xF + 0x4 + NRFFW[%s] + Description collection[n]: Reserved for Nordic firmware design + 0x014 + read-write + 0xFFFFFFFF + + + NRFFW + Reserved for Nordic firmware design + 0 + 31 + + + + + 0xC + 0x4 + NRFHW[%s] + Description collection[n]: Reserved for Nordic hardware design + 0x050 + read-write + 0xFFFFFFFF + + + NRFHW + Reserved for Nordic hardware design + 0 + 31 + + + + + 0x20 + 0x4 + CUSTOMER[%s] + Description collection[n]: Reserved for customer + 0x080 + read-write + 0xFFFFFFFF + + + CUSTOMER + Reserved for customer + 0 + 31 + + + + + 0x2 + 0x4 + PSELRESET[%s] + Description collection[n]: Mapping of the nRESET function + 0x200 + read-write + 0xFFFFFFFF + + + PIN + Pin number of PORT onto which nRESET is exposed + 0 + 4 + + + PORT + Port number onto which nRESET is exposed + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + APPROTECT + Access port protection + 0x208 + read-write + 0xFFFFFFFF + + + PALL + Enable or disable access port protection. + 0 + 7 + + + Disabled + Disable + 0xFF + + + Enabled + Enable + 0x00 + + + + + + + NFCPINS + Setting of pins dedicated to NFC functionality: NFC antenna or GPIO + 0x20C + read-write + 0xFFFFFFFF + + + PROTECT + Setting of pins dedicated to NFC functionality + 0 + 0 + + + Disabled + Operation as GPIO pins. Same protection as normal GPIO pins + 0 + + + NFC + Operation as NFC antenna pins. Configures the protection for NFC operation + 1 + + + + + + + DEBUGCTRL + Processor debug control + 0x210 + read-write + 0xFFFFFFFF + + + CPUNIDEN + Configure CPU non-intrusive debug features + 0 + 7 + + + Enabled + Enable CPU ITM and ETM functionality (default behavior) + 0xFF + + + Disabled + Disable CPU ITM and ETM functionality + 0x00 + + + + + CPUFPBEN + Configure CPU flash patch and breakpoint (FPB) unit behavior + 8 + 15 + + + Enabled + Enable CPU FPB unit (default behavior) + 0xFF + + + Disabled + Disable CPU FPB unit. Writes into the FPB registers will be ignored. + 0x00 + + + + + + + REGOUT0 + GPIO reference voltage / external output supply voltage in high voltage mode + 0x304 + read-write + 0xFFFFFFFF + + + VOUT + Output voltage from of REG0 regulator stage. The maximum output voltage from this stage is given as VDDH - VEXDIF. + 0 + 2 + + + 1V8 + 1.8 V + 0 + + + 2V1 + 2.1 V + 1 + + + 2V4 + 2.4 V + 2 + + + 2V7 + 2.7 V + 3 + + + 3V0 + 3.0 V + 4 + + + 3V3 + 3.3 V + 5 + + + DEFAULT + Default voltage: 1.8 V + 7 + + + + + + + + + CLOCK + Clock control + 0x40000000 + + 0 + 0x1000 + registers + + + POWER_CLOCK + 0 + + CLOCK + 0x20 + + + TASKS_HFCLKSTART + Start HFXO crystal oscillator + 0x000 + write-only + + + TASKS_HFCLKSTART + 0 + 0 + + + + + TASKS_HFCLKSTOP + Stop HFXO crystal oscillator + 0x004 + write-only + + + TASKS_HFCLKSTOP + 0 + 0 + + + + + TASKS_LFCLKSTART + Start LFCLK + 0x008 + write-only + + + TASKS_LFCLKSTART + 0 + 0 + + + + + TASKS_LFCLKSTOP + Stop LFCLK + 0x00C + write-only + + + TASKS_LFCLKSTOP + 0 + 0 + + + + + TASKS_CAL + Start calibration of LFRC + 0x010 + write-only + + + TASKS_CAL + 0 + 0 + + + + + TASKS_CTSTART + Start calibration timer + 0x014 + write-only + + + TASKS_CTSTART + 0 + 0 + + + + + TASKS_CTSTOP + Stop calibration timer + 0x018 + write-only + + + TASKS_CTSTOP + 0 + 0 + + + + + EVENTS_HFCLKSTARTED + HFXO crystal oscillator started + 0x100 + read-write + + + EVENTS_HFCLKSTARTED + 0 + 0 + + + + + EVENTS_LFCLKSTARTED + LFCLK started + 0x104 + read-write + + + EVENTS_LFCLKSTARTED + 0 + 0 + + + + + EVENTS_DONE + Calibration of LFRC completed + 0x10C + read-write + + + EVENTS_DONE + 0 + 0 + + + + + EVENTS_CTTO + Calibration timer timeout + 0x110 + read-write + + + EVENTS_CTTO + 0 + 0 + + + + + EVENTS_CTSTARTED + Calibration timer has been started and is ready to process new tasks + 0x128 + read-write + + + EVENTS_CTSTARTED + 0 + 0 + + + + + EVENTS_CTSTOPPED + Calibration timer has been stopped and is ready to process new tasks + 0x12C + read-write + + + EVENTS_CTSTOPPED + 0 + 0 + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + HFCLKSTARTED + Write '1' to enable interrupt for HFCLKSTARTED event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + LFCLKSTARTED + Write '1' to enable interrupt for LFCLKSTARTED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DONE + Write '1' to enable interrupt for DONE event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CTTO + Write '1' to enable interrupt for CTTO event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CTSTARTED + Write '1' to enable interrupt for CTSTARTED event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CTSTOPPED + Write '1' to enable interrupt for CTSTOPPED event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + HFCLKSTARTED + Write '1' to disable interrupt for HFCLKSTARTED event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + LFCLKSTARTED + Write '1' to disable interrupt for LFCLKSTARTED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DONE + Write '1' to disable interrupt for DONE event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CTTO + Write '1' to disable interrupt for CTTO event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CTSTARTED + Write '1' to disable interrupt for CTSTARTED event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CTSTOPPED + Write '1' to disable interrupt for CTSTOPPED event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + HFCLKRUN + Status indicating that HFCLKSTART task has been triggered + 0x408 + read-only + + + STATUS + HFCLKSTART task triggered or not + 0 + 0 + + + NotTriggered + Task not triggered + 0 + + + Triggered + Task triggered + 1 + + + + + + + HFCLKSTAT + HFCLK status + 0x40C + read-only + + + SRC + Source of HFCLK + 0 + 0 + + + RC + 64 MHz internal oscillator (HFINT) + 0 + + + Xtal + 64 MHz crystal oscillator (HFXO) + 1 + + + + + STATE + HFCLK state + 16 + 16 + + + NotRunning + HFCLK not running + 0 + + + Running + HFCLK running + 1 + + + + + + + LFCLKRUN + Status indicating that LFCLKSTART task has been triggered + 0x414 + read-only + + + STATUS + LFCLKSTART task triggered or not + 0 + 0 + + + NotTriggered + Task not triggered + 0 + + + Triggered + Task triggered + 1 + + + + + + + LFCLKSTAT + LFCLK status + 0x418 + read-only + + + SRC + Source of LFCLK + 0 + 1 + + + RC + 32.768 kHz RC oscillator (LFRC) + 0 + + + Xtal + 32.768 kHz crystal oscillator (LFXO) + 1 + + + Synth + 32.768 kHz synthesized from HFCLK (LFSYNT) + 2 + + + + + STATE + LFCLK state + 16 + 16 + + + NotRunning + LFCLK not running + 0 + + + Running + LFCLK running + 1 + + + + + + + LFCLKSRCCOPY + Copy of LFCLKSRC register, set when LFCLKSTART task was triggered + 0x41C + read-only + + + SRC + Clock source + 0 + 1 + + + RC + 32.768 kHz RC oscillator (LFRC) + 0 + + + Xtal + 32.768 kHz crystal oscillator (LFXO) + 1 + + + Synth + 32.768 kHz synthesized from HFCLK (LFSYNT) + 2 + + + + + + + LFCLKSRC + Clock source for the LFCLK + 0x518 + read-write + + + SRC + Clock source + 0 + 1 + + + RC + 32.768 kHz RC oscillator (LFRC) + 0 + + + Xtal + 32.768 kHz crystal oscillator (LFXO) + 1 + + + Synth + 32.768 kHz synthesized from HFCLK (LFSYNT) + 2 + + + + + BYPASS + Enable or disable bypass of LFCLK crystal oscillator with external clock source + 16 + 16 + + + Disabled + Disable (use with Xtal or low-swing external source) + 0 + + + Enabled + Enable (use with rail-to-rail external source) + 1 + + + + + EXTERNAL + Enable or disable external source for LFCLK + 17 + 17 + + + Disabled + Disable external source (use with Xtal) + 0 + + + Enabled + Enable use of external source instead of Xtal (SRC needs to be set to Xtal) + 1 + + + + + + + HFXODEBOUNCE + HFXO debounce time. The HFXO is started by triggering the TASKS_HFCLKSTART task. + 0x528 + read-write + 0x00000010 + + + HFXODEBOUNCE + HFXO debounce time. Debounce time = HFXODEBOUNCE * 16 us. + 0 + 7 + + + Db256us + 256 us debounce time. Recommended for TSX-3225, FA-20H and FA-128 crystals. + 0x10 + + + Db1024us + 1024 us debounce time. Recommended for NX1612AA and NX1210AB crystals. + 0x40 + + + + + + + CTIV + Calibration timer interval + 0x538 + read-write + + + CTIV + Calibration timer interval in multiple of 0.25 seconds. Range: 0.25 seconds to 31.75 seconds. + 0 + 6 + + + + + TRACECONFIG + Clocking options for the trace port debug interface + 0x55C + read-write + 0x00000000 + + + TRACEPORTSPEED + Speed of trace port clock. Note that the TRACECLK pin will output this clock divided by two. + 0 + 1 + + + 32MHz + 32 MHz trace port clock (TRACECLK = 16 MHz) + 0 + + + 16MHz + 16 MHz trace port clock (TRACECLK = 8 MHz) + 1 + + + 8MHz + 8 MHz trace port clock (TRACECLK = 4 MHz) + 2 + + + 4MHz + 4 MHz trace port clock (TRACECLK = 2 MHz) + 3 + + + + + TRACEMUX + Pin multiplexing of trace signals. See pin assignment chapter for more details. + 16 + 17 + + + GPIO + No trace signals routed to pins. All pins can be used as regular GPIOs. + 0 + + + Serial + SWO trace signal routed to pin. Remaining pins can be used as regular GPIOs. + 1 + + + Parallel + All trace signals (TRACECLK and TRACEDATA[n]) routed to pins. + 2 + + + + + + + LFRCMODE + LFRC mode configuration + 0x5B4 + read-write + 0x00000000 + + + MODE + Set LFRC mode + 0 + 0 + + + Normal + Normal mode + 0 + + + ULP + Ultra-low power mode (ULP) + 1 + + + + + STATUS + Active LFRC mode. This field is read only. + 16 + 16 + + + Normal + Normal mode + 0 + + + ULP + Ultra-low power mode (ULP) + 1 + + + + + + + + + POWER + Power control + 0x40000000 + CLOCK + + 0 + 0x1000 + registers + + + POWER_CLOCK + 0 + + POWER + 0x20 + + + TASKS_CONSTLAT + Enable constant latency mode + 0x78 + write-only + + + TASKS_CONSTLAT + 0 + 0 + + + + + TASKS_LOWPWR + Enable low power mode (variable latency) + 0x7C + write-only + + + TASKS_LOWPWR + 0 + 0 + + + + + EVENTS_POFWARN + Power failure warning + 0x108 + read-write + + + EVENTS_POFWARN + 0 + 0 + + + + + EVENTS_SLEEPENTER + CPU entered WFI/WFE sleep + 0x114 + read-write + + + EVENTS_SLEEPENTER + 0 + 0 + + + + + EVENTS_SLEEPEXIT + CPU exited WFI/WFE sleep + 0x118 + read-write + + + EVENTS_SLEEPEXIT + 0 + 0 + + + + + EVENTS_USBDETECTED + Voltage supply detected on VBUS + 0x11C + read-write + + + EVENTS_USBDETECTED + 0 + 0 + + + + + EVENTS_USBREMOVED + Voltage supply removed from VBUS + 0x120 + read-write + + + EVENTS_USBREMOVED + 0 + 0 + + + + + EVENTS_USBPWRRDY + USB 3.3 V supply ready + 0x124 + read-write + + + EVENTS_USBPWRRDY + 0 + 0 + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + POFWARN + Write '1' to enable interrupt for POFWARN event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SLEEPENTER + Write '1' to enable interrupt for SLEEPENTER event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SLEEPEXIT + Write '1' to enable interrupt for SLEEPEXIT event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + USBDETECTED + Write '1' to enable interrupt for USBDETECTED event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + USBREMOVED + Write '1' to enable interrupt for USBREMOVED event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + USBPWRRDY + Write '1' to enable interrupt for USBPWRRDY event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + POFWARN + Write '1' to disable interrupt for POFWARN event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SLEEPENTER + Write '1' to disable interrupt for SLEEPENTER event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SLEEPEXIT + Write '1' to disable interrupt for SLEEPEXIT event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + USBDETECTED + Write '1' to disable interrupt for USBDETECTED event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + USBREMOVED + Write '1' to disable interrupt for USBREMOVED event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + USBPWRRDY + Write '1' to disable interrupt for USBPWRRDY event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + RESETREAS + Reset reason + 0x400 + read-write + + + RESETPIN + Reset from pin-reset detected + 0 + 0 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + DOG + Reset from watchdog detected + 1 + 1 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + SREQ + Reset from soft reset detected + 2 + 2 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + LOCKUP + Reset from CPU lock-up detected + 3 + 3 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + OFF + Reset due to wake up from System OFF mode when wakeup is triggered from DETECT signal from GPIO + 16 + 16 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + LPCOMP + Reset due to wake up from System OFF mode when wakeup is triggered from ANADETECT signal from LPCOMP + 17 + 17 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + DIF + Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode + 18 + 18 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + NFC + Reset due to wake up from System OFF mode by NFC field detect + 19 + 19 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + VBUS + Reset due to wake up from System OFF mode by VBUS rising into valid range + 20 + 20 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + + + RAMSTATUS + Deprecated register - RAM status register + 0x428 + read-only + 0x00000000 + + + RAMBLOCK0 + RAM block 0 is on or off/powering up + 0 + 0 + + + Off + Off + 0 + + + On + On + 1 + + + + + RAMBLOCK1 + RAM block 1 is on or off/powering up + 1 + 1 + + + Off + Off + 0 + + + On + On + 1 + + + + + RAMBLOCK2 + RAM block 2 is on or off/powering up + 2 + 2 + + + Off + Off + 0 + + + On + On + 1 + + + + + RAMBLOCK3 + RAM block 3 is on or off/powering up + 3 + 3 + + + Off + Off + 0 + + + On + On + 1 + + + + + + + USBREGSTATUS + USB supply status + 0x438 + read-only + 0x00000000 + + + VBUSDETECT + VBUS input detection status (USBDETECTED and USBREMOVED events are derived from this information) + 0 + 0 + + + NoVbus + VBUS voltage below valid threshold + 0 + + + VbusPresent + VBUS voltage above valid threshold + 1 + + + + + OUTPUTRDY + USB supply output settling time elapsed + 1 + 1 + + + NotReady + USBREG output settling time not elapsed + 0 + + + Ready + USBREG output settling time elapsed (same information as USBPWRRDY event) + 1 + + + + + + + SYSTEMOFF + System OFF register + 0x500 + write-only + + + SYSTEMOFF + Enable System OFF mode + 0 + 0 + + + Enter + Enable System OFF mode + 1 + + + + + + + POFCON + Power-fail comparator configuration + 0x510 + read-write + + + POF + Enable or disable power failure warning + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + THRESHOLD + Power-fail comparator threshold setting. This setting applies both for normal voltage mode (supply connected to both VDD and VDDH) and high voltage mode (supply connected to VDDH only). Values 0-3 set threshold below 1.7 V and should not be used as brown out detection will be activated before power failure warning on such low voltages. + 1 + 4 + + + V17 + Set threshold to 1.7 V + 4 + + + V18 + Set threshold to 1.8 V + 5 + + + V19 + Set threshold to 1.9 V + 6 + + + V20 + Set threshold to 2.0 V + 7 + + + V21 + Set threshold to 2.1 V + 8 + + + V22 + Set threshold to 2.2 V + 9 + + + V23 + Set threshold to 2.3 V + 10 + + + V24 + Set threshold to 2.4 V + 11 + + + V25 + Set threshold to 2.5 V + 12 + + + V26 + Set threshold to 2.6 V + 13 + + + V27 + Set threshold to 2.7 V + 14 + + + V28 + Set threshold to 2.8 V + 15 + + + + + THRESHOLDVDDH + Power-fail comparator threshold setting for high voltage mode (supply connected to VDDH only). This setting does not apply for normal voltage mode (supply connected to both VDD and VDDH). + 8 + 11 + + + V27 + Set threshold to 2.7 V + 0 + + + V28 + Set threshold to 2.8 V + 1 + + + V29 + Set threshold to 2.9 V + 2 + + + V30 + Set threshold to 3.0 V + 3 + + + V31 + Set threshold to 3.1 V + 4 + + + V32 + Set threshold to 3.2 V + 5 + + + V33 + Set threshold to 3.3 V + 6 + + + V34 + Set threshold to 3.4 V + 7 + + + V35 + Set threshold to 3.5 V + 8 + + + V36 + Set threshold to 3.6 V + 9 + + + V37 + Set threshold to 3.7 V + 10 + + + V38 + Set threshold to 3.8 V + 11 + + + V39 + Set threshold to 3.9 V + 12 + + + V40 + Set threshold to 4.0 V + 13 + + + V41 + Set threshold to 4.1 V + 14 + + + V42 + Set threshold to 4.2 V + 15 + + + + + + + GPREGRET + General purpose retention register + 0x51C + read-write + + + GPREGRET + General purpose retention register + 0 + 7 + + + + + GPREGRET2 + General purpose retention register + 0x520 + read-write + + + GPREGRET + General purpose retention register + 0 + 7 + + + + + DCDCEN + Enable DC/DC converter for REG1 stage. + 0x578 + read-write + + + DCDCEN + Enable DC/DC converter for REG1 stage. + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + DCDCEN0 + Enable DC/DC converter for REG0 stage. + 0x580 + read-write + + + DCDCEN + Enable DC/DC converter for REG0 stage. + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + MAINREGSTATUS + Main supply status + 0x640 + read-only + 0x00000000 + + + MAINREGSTATUS + Main supply status + 0 + 0 + + + Normal + Normal voltage mode. Voltage supplied on VDD. + 0 + + + High + High voltage mode. Voltage supplied on VDDH. + 1 + + + + + + + 9 + 0x010 + RAM[%s] + Unspecified + POWER_RAM + 0x900 + + POWER + Description cluster[n]: RAMn power control register + 0x000 + read-write + 0x0000FFFF + + + S0POWER + Keep RAM section S0 on or off in System ON mode. + 0 + 0 + + + Off + Off + 0 + + + On + On + 1 + + + + + S1POWER + Keep RAM section S1 on or off in System ON mode. + 1 + 1 + + + Off + Off + 0 + + + On + On + 1 + + + + + S2POWER + Keep RAM section S2 on or off in System ON mode. + 2 + 2 + + + Off + Off + 0 + + + On + On + 1 + + + + + S3POWER + Keep RAM section S3 on or off in System ON mode. + 3 + 3 + + + Off + Off + 0 + + + On + On + 1 + + + + + S4POWER + Keep RAM section S4 on or off in System ON mode. + 4 + 4 + + + Off + Off + 0 + + + On + On + 1 + + + + + S5POWER + Keep RAM section S5 on or off in System ON mode. + 5 + 5 + + + Off + Off + 0 + + + On + On + 1 + + + + + S6POWER + Keep RAM section S6 on or off in System ON mode. + 6 + 6 + + + Off + Off + 0 + + + On + On + 1 + + + + + S7POWER + Keep RAM section S7 on or off in System ON mode. + 7 + 7 + + + Off + Off + 0 + + + On + On + 1 + + + + + S8POWER + Keep RAM section S8 on or off in System ON mode. + 8 + 8 + + + Off + Off + 0 + + + On + On + 1 + + + + + S9POWER + Keep RAM section S9 on or off in System ON mode. + 9 + 9 + + + Off + Off + 0 + + + On + On + 1 + + + + + S10POWER + Keep RAM section S10 on or off in System ON mode. + 10 + 10 + + + Off + Off + 0 + + + On + On + 1 + + + + + S11POWER + Keep RAM section S11 on or off in System ON mode. + 11 + 11 + + + Off + Off + 0 + + + On + On + 1 + + + + + S12POWER + Keep RAM section S12 on or off in System ON mode. + 12 + 12 + + + Off + Off + 0 + + + On + On + 1 + + + + + S13POWER + Keep RAM section S13 on or off in System ON mode. + 13 + 13 + + + Off + Off + 0 + + + On + On + 1 + + + + + S14POWER + Keep RAM section S14 on or off in System ON mode. + 14 + 14 + + + Off + Off + 0 + + + On + On + 1 + + + + + S15POWER + Keep RAM section S15 on or off in System ON mode. + 15 + 15 + + + Off + Off + 0 + + + On + On + 1 + + + + + S0RETENTION + Keep retention on RAM section S0 when RAM section is off + 16 + 16 + + + Off + Off + 0 + + + On + On + 1 + + + + + S1RETENTION + Keep retention on RAM section S1 when RAM section is off + 17 + 17 + + + Off + Off + 0 + + + On + On + 1 + + + + + S2RETENTION + Keep retention on RAM section S2 when RAM section is off + 18 + 18 + + + Off + Off + 0 + + + On + On + 1 + + + + + S3RETENTION + Keep retention on RAM section S3 when RAM section is off + 19 + 19 + + + Off + Off + 0 + + + On + On + 1 + + + + + S4RETENTION + Keep retention on RAM section S4 when RAM section is off + 20 + 20 + + + Off + Off + 0 + + + On + On + 1 + + + + + S5RETENTION + Keep retention on RAM section S5 when RAM section is off + 21 + 21 + + + Off + Off + 0 + + + On + On + 1 + + + + + S6RETENTION + Keep retention on RAM section S6 when RAM section is off + 22 + 22 + + + Off + Off + 0 + + + On + On + 1 + + + + + S7RETENTION + Keep retention on RAM section S7 when RAM section is off + 23 + 23 + + + Off + Off + 0 + + + On + On + 1 + + + + + S8RETENTION + Keep retention on RAM section S8 when RAM section is off + 24 + 24 + + + Off + Off + 0 + + + On + On + 1 + + + + + S9RETENTION + Keep retention on RAM section S9 when RAM section is off + 25 + 25 + + + Off + Off + 0 + + + On + On + 1 + + + + + S10RETENTION + Keep retention on RAM section S10 when RAM section is off + 26 + 26 + + + Off + Off + 0 + + + On + On + 1 + + + + + S11RETENTION + Keep retention on RAM section S11 when RAM section is off + 27 + 27 + + + Off + Off + 0 + + + On + On + 1 + + + + + S12RETENTION + Keep retention on RAM section S12 when RAM section is off + 28 + 28 + + + Off + Off + 0 + + + On + On + 1 + + + + + S13RETENTION + Keep retention on RAM section S13 when RAM section is off + 29 + 29 + + + Off + Off + 0 + + + On + On + 1 + + + + + S14RETENTION + Keep retention on RAM section S14 when RAM section is off + 30 + 30 + + + Off + Off + 0 + + + On + On + 1 + + + + + S15RETENTION + Keep retention on RAM section S15 when RAM section is off + 31 + 31 + + + Off + Off + 0 + + + On + On + 1 + + + + + + + POWERSET + Description cluster[n]: RAMn power control set register + 0x004 + write-only + 0x0000FFFF + + + S0POWER + Keep RAM section S0 of RAMn on or off in System ON mode + 0 + 0 + + + On + On + 1 + + + + + S1POWER + Keep RAM section S1 of RAMn on or off in System ON mode + 1 + 1 + + + On + On + 1 + + + + + S2POWER + Keep RAM section S2 of RAMn on or off in System ON mode + 2 + 2 + + + On + On + 1 + + + + + S3POWER + Keep RAM section S3 of RAMn on or off in System ON mode + 3 + 3 + + + On + On + 1 + + + + + S4POWER + Keep RAM section S4 of RAMn on or off in System ON mode + 4 + 4 + + + On + On + 1 + + + + + S5POWER + Keep RAM section S5 of RAMn on or off in System ON mode + 5 + 5 + + + On + On + 1 + + + + + S6POWER + Keep RAM section S6 of RAMn on or off in System ON mode + 6 + 6 + + + On + On + 1 + + + + + S7POWER + Keep RAM section S7 of RAMn on or off in System ON mode + 7 + 7 + + + On + On + 1 + + + + + S8POWER + Keep RAM section S8 of RAMn on or off in System ON mode + 8 + 8 + + + On + On + 1 + + + + + S9POWER + Keep RAM section S9 of RAMn on or off in System ON mode + 9 + 9 + + + On + On + 1 + + + + + S10POWER + Keep RAM section S10 of RAMn on or off in System ON mode + 10 + 10 + + + On + On + 1 + + + + + S11POWER + Keep RAM section S11 of RAMn on or off in System ON mode + 11 + 11 + + + On + On + 1 + + + + + S12POWER + Keep RAM section S12 of RAMn on or off in System ON mode + 12 + 12 + + + On + On + 1 + + + + + S13POWER + Keep RAM section S13 of RAMn on or off in System ON mode + 13 + 13 + + + On + On + 1 + + + + + S14POWER + Keep RAM section S14 of RAMn on or off in System ON mode + 14 + 14 + + + On + On + 1 + + + + + S15POWER + Keep RAM section S15 of RAMn on or off in System ON mode + 15 + 15 + + + On + On + 1 + + + + + S0RETENTION + Keep retention on RAM section S0 when RAM section is switched off + 16 + 16 + + + On + On + 1 + + + + + S1RETENTION + Keep retention on RAM section S1 when RAM section is switched off + 17 + 17 + + + On + On + 1 + + + + + S2RETENTION + Keep retention on RAM section S2 when RAM section is switched off + 18 + 18 + + + On + On + 1 + + + + + S3RETENTION + Keep retention on RAM section S3 when RAM section is switched off + 19 + 19 + + + On + On + 1 + + + + + S4RETENTION + Keep retention on RAM section S4 when RAM section is switched off + 20 + 20 + + + On + On + 1 + + + + + S5RETENTION + Keep retention on RAM section S5 when RAM section is switched off + 21 + 21 + + + On + On + 1 + + + + + S6RETENTION + Keep retention on RAM section S6 when RAM section is switched off + 22 + 22 + + + On + On + 1 + + + + + S7RETENTION + Keep retention on RAM section S7 when RAM section is switched off + 23 + 23 + + + On + On + 1 + + + + + S8RETENTION + Keep retention on RAM section S8 when RAM section is switched off + 24 + 24 + + + On + On + 1 + + + + + S9RETENTION + Keep retention on RAM section S9 when RAM section is switched off + 25 + 25 + + + On + On + 1 + + + + + S10RETENTION + Keep retention on RAM section S10 when RAM section is switched off + 26 + 26 + + + On + On + 1 + + + + + S11RETENTION + Keep retention on RAM section S11 when RAM section is switched off + 27 + 27 + + + On + On + 1 + + + + + S12RETENTION + Keep retention on RAM section S12 when RAM section is switched off + 28 + 28 + + + On + On + 1 + + + + + S13RETENTION + Keep retention on RAM section S13 when RAM section is switched off + 29 + 29 + + + On + On + 1 + + + + + S14RETENTION + Keep retention on RAM section S14 when RAM section is switched off + 30 + 30 + + + On + On + 1 + + + + + S15RETENTION + Keep retention on RAM section S15 when RAM section is switched off + 31 + 31 + + + On + On + 1 + + + + + + + POWERCLR + Description cluster[n]: RAMn power control clear register + 0x008 + write-only + 0x0000FFFF + + + S0POWER + Keep RAM section S0 of RAMn on or off in System ON mode + 0 + 0 + + + Off + Off + 1 + + + + + S1POWER + Keep RAM section S1 of RAMn on or off in System ON mode + 1 + 1 + + + Off + Off + 1 + + + + + S2POWER + Keep RAM section S2 of RAMn on or off in System ON mode + 2 + 2 + + + Off + Off + 1 + + + + + S3POWER + Keep RAM section S3 of RAMn on or off in System ON mode + 3 + 3 + + + Off + Off + 1 + + + + + S4POWER + Keep RAM section S4 of RAMn on or off in System ON mode + 4 + 4 + + + Off + Off + 1 + + + + + S5POWER + Keep RAM section S5 of RAMn on or off in System ON mode + 5 + 5 + + + Off + Off + 1 + + + + + S6POWER + Keep RAM section S6 of RAMn on or off in System ON mode + 6 + 6 + + + Off + Off + 1 + + + + + S7POWER + Keep RAM section S7 of RAMn on or off in System ON mode + 7 + 7 + + + Off + Off + 1 + + + + + S8POWER + Keep RAM section S8 of RAMn on or off in System ON mode + 8 + 8 + + + Off + Off + 1 + + + + + S9POWER + Keep RAM section S9 of RAMn on or off in System ON mode + 9 + 9 + + + Off + Off + 1 + + + + + S10POWER + Keep RAM section S10 of RAMn on or off in System ON mode + 10 + 10 + + + Off + Off + 1 + + + + + S11POWER + Keep RAM section S11 of RAMn on or off in System ON mode + 11 + 11 + + + Off + Off + 1 + + + + + S12POWER + Keep RAM section S12 of RAMn on or off in System ON mode + 12 + 12 + + + Off + Off + 1 + + + + + S13POWER + Keep RAM section S13 of RAMn on or off in System ON mode + 13 + 13 + + + Off + Off + 1 + + + + + S14POWER + Keep RAM section S14 of RAMn on or off in System ON mode + 14 + 14 + + + Off + Off + 1 + + + + + S15POWER + Keep RAM section S15 of RAMn on or off in System ON mode + 15 + 15 + + + Off + Off + 1 + + + + + S0RETENTION + Keep retention on RAM section S0 when RAM section is switched off + 16 + 16 + + + Off + Off + 1 + + + + + S1RETENTION + Keep retention on RAM section S1 when RAM section is switched off + 17 + 17 + + + Off + Off + 1 + + + + + S2RETENTION + Keep retention on RAM section S2 when RAM section is switched off + 18 + 18 + + + Off + Off + 1 + + + + + S3RETENTION + Keep retention on RAM section S3 when RAM section is switched off + 19 + 19 + + + Off + Off + 1 + + + + + S4RETENTION + Keep retention on RAM section S4 when RAM section is switched off + 20 + 20 + + + Off + Off + 1 + + + + + S5RETENTION + Keep retention on RAM section S5 when RAM section is switched off + 21 + 21 + + + Off + Off + 1 + + + + + S6RETENTION + Keep retention on RAM section S6 when RAM section is switched off + 22 + 22 + + + Off + Off + 1 + + + + + S7RETENTION + Keep retention on RAM section S7 when RAM section is switched off + 23 + 23 + + + Off + Off + 1 + + + + + S8RETENTION + Keep retention on RAM section S8 when RAM section is switched off + 24 + 24 + + + Off + Off + 1 + + + + + S9RETENTION + Keep retention on RAM section S9 when RAM section is switched off + 25 + 25 + + + Off + Off + 1 + + + + + S10RETENTION + Keep retention on RAM section S10 when RAM section is switched off + 26 + 26 + + + Off + Off + 1 + + + + + S11RETENTION + Keep retention on RAM section S11 when RAM section is switched off + 27 + 27 + + + Off + Off + 1 + + + + + S12RETENTION + Keep retention on RAM section S12 when RAM section is switched off + 28 + 28 + + + Off + Off + 1 + + + + + S13RETENTION + Keep retention on RAM section S13 when RAM section is switched off + 29 + 29 + + + Off + Off + 1 + + + + + S14RETENTION + Keep retention on RAM section S14 when RAM section is switched off + 30 + 30 + + + Off + Off + 1 + + + + + S15RETENTION + Keep retention on RAM section S15 when RAM section is switched off + 31 + 31 + + + Off + Off + 1 + + + + + + + + + + RADIO + 2.4 GHz radio + 0x40001000 + + 0 + 0x1000 + registers + + + RADIO + 1 + + RADIO + 0x20 + + + TASKS_TXEN + Enable RADIO in TX mode + 0x000 + write-only + + + TASKS_TXEN + 0 + 0 + + + + + TASKS_RXEN + Enable RADIO in RX mode + 0x004 + write-only + + + TASKS_RXEN + 0 + 0 + + + + + TASKS_START + Start RADIO + 0x008 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_STOP + Stop RADIO + 0x00C + write-only + + + TASKS_STOP + 0 + 0 + + + + + TASKS_DISABLE + Disable RADIO + 0x010 + write-only + + + TASKS_DISABLE + 0 + 0 + + + + + TASKS_RSSISTART + Start the RSSI and take one single sample of the receive signal strength + 0x014 + write-only + + + TASKS_RSSISTART + 0 + 0 + + + + + TASKS_RSSISTOP + Stop the RSSI measurement + 0x018 + write-only + + + TASKS_RSSISTOP + 0 + 0 + + + + + TASKS_BCSTART + Start the bit counter + 0x01C + write-only + + + TASKS_BCSTART + 0 + 0 + + + + + TASKS_BCSTOP + Stop the bit counter + 0x020 + write-only + + + TASKS_BCSTOP + 0 + 0 + + + + + TASKS_EDSTART + Start the energy detect measurement used in IEEE 802.15.4 mode + 0x024 + write-only + + + TASKS_EDSTART + 0 + 0 + + + + + TASKS_EDSTOP + Stop the energy detect measurement + 0x028 + write-only + + + TASKS_EDSTOP + 0 + 0 + + + + + TASKS_CCASTART + Start the clear channel assessment used in IEEE 802.15.4 mode + 0x02C + write-only + + + TASKS_CCASTART + 0 + 0 + + + + + TASKS_CCASTOP + Stop the clear channel assessment + 0x030 + write-only + + + TASKS_CCASTOP + 0 + 0 + + + + + EVENTS_READY + RADIO has ramped up and is ready to be started + 0x100 + read-write + + + EVENTS_READY + 0 + 0 + + + + + EVENTS_ADDRESS + Address sent or received + 0x104 + read-write + + + EVENTS_ADDRESS + 0 + 0 + + + + + EVENTS_PAYLOAD + Packet payload sent or received + 0x108 + read-write + + + EVENTS_PAYLOAD + 0 + 0 + + + + + EVENTS_END + Packet sent or received + 0x10C + read-write + + + EVENTS_END + 0 + 0 + + + + + EVENTS_DISABLED + RADIO has been disabled + 0x110 + read-write + + + EVENTS_DISABLED + 0 + 0 + + + + + EVENTS_DEVMATCH + A device address match occurred on the last received packet + 0x114 + read-write + + + EVENTS_DEVMATCH + 0 + 0 + + + + + EVENTS_DEVMISS + No device address match occurred on the last received packet + 0x118 + read-write + + + EVENTS_DEVMISS + 0 + 0 + + + + + EVENTS_RSSIEND + Sampling of receive signal strength complete + 0x11C + read-write + + + EVENTS_RSSIEND + 0 + 0 + + + + + EVENTS_BCMATCH + Bit counter reached bit count value + 0x128 + read-write + + + EVENTS_BCMATCH + 0 + 0 + + + + + EVENTS_CRCOK + Packet received with CRC ok + 0x130 + read-write + + + EVENTS_CRCOK + 0 + 0 + + + + + EVENTS_CRCERROR + Packet received with CRC error + 0x134 + read-write + + + EVENTS_CRCERROR + 0 + 0 + + + + + EVENTS_FRAMESTART + IEEE 802.15.4 length field received + 0x138 + read-write + + + EVENTS_FRAMESTART + 0 + 0 + + + + + EVENTS_EDEND + Sampling of energy detection complete. A new ED sample is ready for readout from the RADIO.EDSAMPLE register. + 0x13C + read-write + + + EVENTS_EDEND + 0 + 0 + + + + + EVENTS_EDSTOPPED + The sampling of energy detection has stopped + 0x140 + read-write + + + EVENTS_EDSTOPPED + 0 + 0 + + + + + EVENTS_CCAIDLE + Wireless medium in idle - clear to send + 0x144 + read-write + + + EVENTS_CCAIDLE + 0 + 0 + + + + + EVENTS_CCABUSY + Wireless medium busy - do not send + 0x148 + read-write + + + EVENTS_CCABUSY + 0 + 0 + + + + + EVENTS_CCASTOPPED + The CCA has stopped + 0x14C + read-write + + + EVENTS_CCASTOPPED + 0 + 0 + + + + + EVENTS_RATEBOOST + Ble_LR CI field received, receive mode is changed from Ble_LR125Kbit to Ble_LR500Kbit. + 0x150 + read-write + + + EVENTS_RATEBOOST + 0 + 0 + + + + + EVENTS_TXREADY + RADIO has ramped up and is ready to be started TX path + 0x154 + read-write + + + EVENTS_TXREADY + 0 + 0 + + + + + EVENTS_RXREADY + RADIO has ramped up and is ready to be started RX path + 0x158 + read-write + + + EVENTS_RXREADY + 0 + 0 + + + + + EVENTS_MHRMATCH + MAC header match found + 0x15C + read-write + + + EVENTS_MHRMATCH + 0 + 0 + + + + + EVENTS_PHYEND + Generated in Ble_LR125Kbit, Ble_LR500Kbit and BleIeee802154_250Kbit modes when last bit is sent on air. + 0x16C + read-write + + + EVENTS_PHYEND + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + READY_START + Shortcut between READY event and START task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + END_DISABLE + Shortcut between END event and DISABLE task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DISABLED_TXEN + Shortcut between DISABLED event and TXEN task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DISABLED_RXEN + Shortcut between DISABLED event and RXEN task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ADDRESS_RSSISTART + Shortcut between ADDRESS event and RSSISTART task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + END_START + Shortcut between END event and START task + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ADDRESS_BCSTART + Shortcut between ADDRESS event and BCSTART task + 6 + 6 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DISABLED_RSSISTOP + Shortcut between DISABLED event and RSSISTOP task + 8 + 8 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + RXREADY_CCASTART + Shortcut between RXREADY event and CCASTART task + 11 + 11 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + CCAIDLE_TXEN + Shortcut between CCAIDLE event and TXEN task + 12 + 12 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + CCABUSY_DISABLE + Shortcut between CCABUSY event and DISABLE task + 13 + 13 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + FRAMESTART_BCSTART + Shortcut between FRAMESTART event and BCSTART task + 14 + 14 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + READY_EDSTART + Shortcut between READY event and EDSTART task + 15 + 15 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + EDEND_DISABLE + Shortcut between EDEND event and DISABLE task + 16 + 16 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + CCAIDLE_STOP + Shortcut between CCAIDLE event and STOP task + 17 + 17 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + TXREADY_START + Shortcut between TXREADY event and START task + 18 + 18 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + RXREADY_START + Shortcut between RXREADY event and START task + 19 + 19 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + PHYEND_DISABLE + Shortcut between PHYEND event and DISABLE task + 20 + 20 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + PHYEND_START + Shortcut between PHYEND event and START task + 21 + 21 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to enable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ADDRESS + Write '1' to enable interrupt for ADDRESS event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PAYLOAD + Write '1' to enable interrupt for PAYLOAD event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + END + Write '1' to enable interrupt for END event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DISABLED + Write '1' to enable interrupt for DISABLED event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DEVMATCH + Write '1' to enable interrupt for DEVMATCH event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DEVMISS + Write '1' to enable interrupt for DEVMISS event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RSSIEND + Write '1' to enable interrupt for RSSIEND event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + BCMATCH + Write '1' to enable interrupt for BCMATCH event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CRCOK + Write '1' to enable interrupt for CRCOK event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CRCERROR + Write '1' to enable interrupt for CRCERROR event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + FRAMESTART + Write '1' to enable interrupt for FRAMESTART event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + EDEND + Write '1' to enable interrupt for EDEND event + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + EDSTOPPED + Write '1' to enable interrupt for EDSTOPPED event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CCAIDLE + Write '1' to enable interrupt for CCAIDLE event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CCABUSY + Write '1' to enable interrupt for CCABUSY event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CCASTOPPED + Write '1' to enable interrupt for CCASTOPPED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RATEBOOST + Write '1' to enable interrupt for RATEBOOST event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXREADY + Write '1' to enable interrupt for TXREADY event + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXREADY + Write '1' to enable interrupt for RXREADY event + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + MHRMATCH + Write '1' to enable interrupt for MHRMATCH event + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PHYEND + Write '1' to enable interrupt for PHYEND event + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to disable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ADDRESS + Write '1' to disable interrupt for ADDRESS event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PAYLOAD + Write '1' to disable interrupt for PAYLOAD event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + END + Write '1' to disable interrupt for END event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DISABLED + Write '1' to disable interrupt for DISABLED event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DEVMATCH + Write '1' to disable interrupt for DEVMATCH event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DEVMISS + Write '1' to disable interrupt for DEVMISS event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RSSIEND + Write '1' to disable interrupt for RSSIEND event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + BCMATCH + Write '1' to disable interrupt for BCMATCH event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CRCOK + Write '1' to disable interrupt for CRCOK event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CRCERROR + Write '1' to disable interrupt for CRCERROR event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + FRAMESTART + Write '1' to disable interrupt for FRAMESTART event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + EDEND + Write '1' to disable interrupt for EDEND event + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + EDSTOPPED + Write '1' to disable interrupt for EDSTOPPED event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CCAIDLE + Write '1' to disable interrupt for CCAIDLE event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CCABUSY + Write '1' to disable interrupt for CCABUSY event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CCASTOPPED + Write '1' to disable interrupt for CCASTOPPED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RATEBOOST + Write '1' to disable interrupt for RATEBOOST event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXREADY + Write '1' to disable interrupt for TXREADY event + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXREADY + Write '1' to disable interrupt for RXREADY event + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + MHRMATCH + Write '1' to disable interrupt for MHRMATCH event + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PHYEND + Write '1' to disable interrupt for PHYEND event + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + CRCSTATUS + CRC status + 0x400 + read-only + + + CRCSTATUS + CRC status of packet received + 0 + 0 + + + CRCError + Packet received with CRC error + 0 + + + CRCOk + Packet received with CRC ok + 1 + + + + + + + RXMATCH + Received address + 0x408 + read-only + + + RXMATCH + Received address + 0 + 2 + + + + + RXCRC + CRC field of previously received packet + 0x40C + read-only + + + RXCRC + CRC field of previously received packet + 0 + 23 + + + + + DAI + Device address match index + 0x410 + read-only + + + DAI + Device address match index + 0 + 2 + + + + + PDUSTAT + Payload status + 0x414 + read-only + + + PDUSTAT + Status on payload length vs. PCNF1.MAXLEN + 0 + 0 + + + LessThan + Payload less than PCNF1.MAXLEN + 0 + + + GreaterThan + Payload greater than PCNF1.MAXLEN + 1 + + + + + CISTAT + Status on what rate packet is received with in Long Range + 1 + 2 + + + LR125kbit + Frame is received at 125kbps + 0 + + + LR500kbit + Frame is received at 500kbps + 1 + + + + + + + PACKETPTR + Packet pointer + 0x504 + read-write + + + PACKETPTR + Packet pointer + 0 + 31 + + + + + FREQUENCY + Frequency + 0x508 + read-write + 0x00000002 + + + FREQUENCY + Radio channel frequency + 0 + 6 + + + MAP + Channel map selection. + 8 + 8 + + + Default + Channel map between 2400 MHZ .. 2500 MHz + 0 + + + Low + Channel map between 2360 MHZ .. 2460 MHz + 1 + + + + + + + TXPOWER + Output power + 0x50C + read-write + + + TXPOWER + RADIO output power + 0 + 7 + + + Pos8dBm + +8 dBm + 0x8 + + + Pos7dBm + +7 dBm + 0x7 + + + Pos6dBm + +6 dBm + 0x6 + + + Pos5dBm + +5 dBm + 0x5 + + + Pos4dBm + +4 dBm + 0x4 + + + Pos3dBm + +3 dBm + 0x3 + + + Pos2dBm + +2 dBm + 0x2 + + + 0dBm + 0 dBm + 0x0 + + + Neg4dBm + -4 dBm + 0xFC + + + Neg8dBm + -8 dBm + 0xF8 + + + Neg12dBm + -12 dBm + 0xF4 + + + Neg16dBm + -16 dBm + 0xF0 + + + Neg20dBm + -20 dBm + 0xEC + + + Neg30dBm + Deprecated enumerator - -40 dBm + 0xFF + + + Neg40dBm + -40 dBm + 0xD8 + + + + + + + MODE + Data rate and modulation + 0x510 + read-write + + + MODE + Radio data rate and modulation setting. The radio supports frequency-shift keying (FSK) modulation. + 0 + 3 + + + Nrf_1Mbit + 1 Mbit/s Nordic proprietary radio mode + 0 + + + Nrf_2Mbit + 2 Mbit/s Nordic proprietary radio mode + 1 + + + Ble_1Mbit + 1 Mbit/s BLE + 3 + + + Ble_2Mbit + 2 Mbit/s BLE + 4 + + + Ble_LR125Kbit + Long range 125 kbit/s TX, 125 kbit/s and 500 kbit/s RX + 5 + + + Ble_LR500Kbit + Long range 500 kbit/s TX, 125 kbit/s and 500 kbit/s RX + 6 + + + Ieee802154_250Kbit + IEEE 802.15.4-2006 250 kbit/s + 15 + + + + + + + PCNF0 + Packet configuration register 0 + 0x514 + read-write + + + LFLEN + Length on air of LENGTH field in number of bits. + 0 + 3 + + + S0LEN + Length on air of S0 field in number of bytes. + 8 + 8 + + + S1LEN + Length on air of S1 field in number of bits. + 16 + 19 + + + S1INCL + Include or exclude S1 field in RAM + 20 + 20 + + + Automatic + Include S1 field in RAM only if S1LEN &gt; 0 + 0 + + + Include + Always include S1 field in RAM independent of S1LEN + 1 + + + + + CILEN + Length of code indicator - long range + 22 + 23 + + + PLEN + Length of preamble on air. Decision point: TASKS_START task + 24 + 25 + + + 8bit + 8-bit preamble + 0 + + + 16bit + 16-bit preamble + 1 + + + 32bitZero + 32-bit zero preamble - used for IEEE 802.15.4 + 2 + + + LongRange + Preamble - used for BLE long range + 3 + + + + + CRCINC + Indicates if LENGTH field contains CRC or not + 26 + 26 + + + Exclude + LENGTH does not contain CRC + 0 + + + Include + LENGTH includes CRC + 1 + + + + + TERMLEN + Length of TERM field in Long Range operation + 29 + 30 + + + + + PCNF1 + Packet configuration register 1 + 0x518 + read-write + + + MAXLEN + Maximum length of packet payload. If the packet payload is larger than MAXLEN, the radio will truncate the payload to MAXLEN. + 0 + 7 + + + STATLEN + Static length in number of bytes + 8 + 15 + + + BALEN + Base address length in number of bytes + 16 + 18 + + + ENDIAN + On air endianness of packet, this applies to the S0, LENGTH, S1 and the PAYLOAD fields. + 24 + 24 + + + Little + Least significant bit on air first + 0 + + + Big + Most significant bit on air first + 1 + + + + + WHITEEN + Enable or disable packet whitening + 25 + 25 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + BASE0 + Base address 0 + 0x51C + read-write + + + BASE0 + Base address 0 + 0 + 31 + + + + + BASE1 + Base address 1 + 0x520 + read-write + + + BASE1 + Base address 1 + 0 + 31 + + + + + PREFIX0 + Prefixes bytes for logical addresses 0-3 + 0x524 + read-write + + + AP0 + Address prefix 0. + 0 + 7 + + + AP1 + Address prefix 1. + 8 + 15 + + + AP2 + Address prefix 2. + 16 + 23 + + + AP3 + Address prefix 3. + 24 + 31 + + + + + PREFIX1 + Prefixes bytes for logical addresses 4-7 + 0x528 + read-write + + + AP4 + Address prefix 4. + 0 + 7 + + + AP5 + Address prefix 5. + 8 + 15 + + + AP6 + Address prefix 6. + 16 + 23 + + + AP7 + Address prefix 7. + 24 + 31 + + + + + TXADDRESS + Transmit address select + 0x52C + read-write + + + TXADDRESS + Transmit address select + 0 + 2 + + + + + RXADDRESSES + Receive address select + 0x530 + read-write + + + ADDR0 + Enable or disable reception on logical address 0. + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR1 + Enable or disable reception on logical address 1. + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR2 + Enable or disable reception on logical address 2. + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR3 + Enable or disable reception on logical address 3. + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR4 + Enable or disable reception on logical address 4. + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR5 + Enable or disable reception on logical address 5. + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR6 + Enable or disable reception on logical address 6. + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR7 + Enable or disable reception on logical address 7. + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + CRCCNF + CRC configuration + 0x534 + read-write + + + LEN + CRC length in number of bytes. + 0 + 1 + + + Disabled + CRC length is zero and CRC calculation is disabled + 0 + + + One + CRC length is one byte and CRC calculation is enabled + 1 + + + Two + CRC length is two bytes and CRC calculation is enabled + 2 + + + Three + CRC length is three bytes and CRC calculation is enabled + 3 + + + + + SKIPADDR + Include or exclude packet address field out of CRC calculation. + 8 + 9 + + + Include + CRC calculation includes address field + 0 + + + Skip + CRC calculation does not include address field. The CRC calculation will start at the first byte after the address. + 1 + + + Ieee802154 + CRC calculation as per 802.15.4 standard. Starting at first byte after length field. + 2 + + + + + + + CRCPOLY + CRC polynomial + 0x538 + read-write + 0x00000000 + + + CRCPOLY + CRC polynomial + 0 + 23 + + + + + CRCINIT + CRC initial value + 0x53C + read-write + + + CRCINIT + CRC initial value + 0 + 23 + + + + + TIFS + Interframe spacing in us + 0x544 + read-write + + + TIFS + Interframe spacing in us + 0 + 9 + + + + + RSSISAMPLE + RSSI sample + 0x548 + read-only + + + RSSISAMPLE + RSSI sample + 0 + 6 + + + + + STATE + Current radio state + 0x550 + read-only + + + STATE + Current radio state + 0 + 3 + + + Disabled + RADIO is in the Disabled state + 0 + + + RxRu + RADIO is in the RXRU state + 1 + + + RxIdle + RADIO is in the RXIDLE state + 2 + + + Rx + RADIO is in the RX state + 3 + + + RxDisable + RADIO is in the RXDISABLED state + 4 + + + TxRu + RADIO is in the TXRU state + 9 + + + TxIdle + RADIO is in the TXIDLE state + 10 + + + Tx + RADIO is in the TX state + 11 + + + TxDisable + RADIO is in the TXDISABLED state + 12 + + + + + + + DATAWHITEIV + Data whitening initial value + 0x554 + read-write + 0x00000040 + + + DATAWHITEIV + Data whitening initial value. Bit 6 is hard-wired to '1', writing '0' to it has no effect, and it will always be read back and used by the device as '1'. + 0 + 6 + + + + + BCC + Bit counter compare + 0x560 + read-write + + + BCC + Bit counter compare + 0 + 31 + + + + + 0x8 + 0x4 + DAB[%s] + Description collection[n]: Device address base segment n + 0x600 + read-write + + + DAB + Device address base segment n + 0 + 31 + + + + + 0x8 + 0x4 + DAP[%s] + Description collection[n]: Device address prefix n + 0x620 + read-write + + + DAP + Device address prefix n + 0 + 15 + + + + + DACNF + Device address match configuration + 0x640 + read-write + + + ENA0 + Enable or disable device address matching using device address 0 + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA1 + Enable or disable device address matching using device address 1 + 1 + 1 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA2 + Enable or disable device address matching using device address 2 + 2 + 2 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA3 + Enable or disable device address matching using device address 3 + 3 + 3 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA4 + Enable or disable device address matching using device address 4 + 4 + 4 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA5 + Enable or disable device address matching using device address 5 + 5 + 5 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA6 + Enable or disable device address matching using device address 6 + 6 + 6 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA7 + Enable or disable device address matching using device address 7 + 7 + 7 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + TXADD0 + TxAdd for device address 0 + 8 + 8 + + + TXADD1 + TxAdd for device address 1 + 9 + 9 + + + TXADD2 + TxAdd for device address 2 + 10 + 10 + + + TXADD3 + TxAdd for device address 3 + 11 + 11 + + + TXADD4 + TxAdd for device address 4 + 12 + 12 + + + TXADD5 + TxAdd for device address 5 + 13 + 13 + + + TXADD6 + TxAdd for device address 6 + 14 + 14 + + + TXADD7 + TxAdd for device address 7 + 15 + 15 + + + + + MHRMATCHCONF + Search pattern configuration + 0x644 + read-write + + + MHRMATCHMAS + Pattern mask + 0x648 + read-write + + + MODECNF0 + Radio mode configuration register 0 + 0x650 + read-write + 0x00000200 + + + RU + Radio ramp-up time + 0 + 0 + + + Default + Default ramp-up time (tRXEN), compatible with firmware written for nRF51 + 0 + + + Fast + Fast ramp-up (tRXEN,FAST), see electrical specification for more information + 1 + + + + + DTX + Default TX value + 8 + 9 + + + B1 + Transmit '1' + 0 + + + B0 + Transmit '0' + 1 + + + Center + Transmit center frequency + 2 + + + + + + + SFD + IEEE 802.15.4 start of frame delimiter + 0x660 + read-write + 0x000000A7 + + + SFD + IEEE 802.15.4 start of frame delimiter + 0 + 7 + + + + + EDCNT + IEEE 802.15.4 energy detect loop count + 0x664 + read-write + 0x00000000 + + + EDCNT + IEEE 802.15.4 energy detect loop count + 0 + 20 + + + + + EDSAMPLE + IEEE 802.15.4 energy detect level + 0x668 + read-write + 0x00000000 + + + EDLVL + IEEE 802.15.4 energy detect level + 0 + 7 + + + + + CCACTRL + IEEE 802.15.4 clear channel assessment control + 0x66C + read-write + 0x00000000 + + + CCAMODE + CCA mode of operation + 0 + 2 + + + EdMode + Energy above threshold + 0 + + + CarrierMode + Carrier seen + 1 + + + CarrierAndEdMode + Energy above threshold AND carrier seen + 2 + + + CarrierOrEdMode + Energy above threshold OR carrier seen + 3 + + + EdModeTest1 + Energy above threshold test mode that will abort when first ED measurement over threshold is seen. No averaging. + 4 + + + + + CCAEDTHRES + CCA energy busy threshold. Used in all the CCA modes except CarrierMode. + 8 + 15 + + + CCACORRTHRES + CCA correlator busy threshold. Only relevant to CarrierMode, CarrierAndEdMode and CarrierOrEdMode. + 16 + 23 + + + CCACORRCNT + Limit for occurances above CCACORRTHRES. When not equal to zero the corrolator based signal detect is enabled. + 24 + 31 + + + + + POWER + Peripheral power control + 0xFFC + read-write + 0x00000001 + + + POWER + Peripheral power control. The peripheral and its registers will be reset to its initial state by switching the peripheral off and then back on again. + 0 + 0 + + + Disabled + Peripheral is powered off + 0 + + + Enabled + Peripheral is powered on + 1 + + + + + + + + + UART0 + Universal Asynchronous Receiver/Transmitter + 0x40002000 + UART + + 0 + 0x1000 + registers + + + UARTE0_UART0 + 2 + + UART + 0x20 + + + TASKS_STARTRX + Start UART receiver + 0x000 + write-only + + + TASKS_STARTRX + 0 + 0 + + + + + TASKS_STOPRX + Stop UART receiver + 0x004 + write-only + + + TASKS_STOPRX + 0 + 0 + + + + + TASKS_STARTTX + Start UART transmitter + 0x008 + write-only + + + TASKS_STARTTX + 0 + 0 + + + + + TASKS_STOPTX + Stop UART transmitter + 0x00C + write-only + + + TASKS_STOPTX + 0 + 0 + + + + + TASKS_SUSPEND + Suspend UART + 0x01C + write-only + + + TASKS_SUSPEND + 0 + 0 + + + + + EVENTS_CTS + CTS is activated (set low). Clear To Send. + 0x100 + read-write + + + EVENTS_CTS + 0 + 0 + + + + + EVENTS_NCTS + CTS is deactivated (set high). Not Clear To Send. + 0x104 + read-write + + + EVENTS_NCTS + 0 + 0 + + + + + EVENTS_RXDRDY + Data received in RXD + 0x108 + read-write + + + EVENTS_RXDRDY + 0 + 0 + + + + + EVENTS_TXDRDY + Data sent from TXD + 0x11C + read-write + + + EVENTS_TXDRDY + 0 + 0 + + + + + EVENTS_ERROR + Error detected + 0x124 + read-write + + + EVENTS_ERROR + 0 + 0 + + + + + EVENTS_RXTO + Receiver timeout + 0x144 + read-write + + + EVENTS_RXTO + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + CTS_STARTRX + Shortcut between CTS event and STARTRX task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + NCTS_STOPRX + Shortcut between NCTS event and STOPRX task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + CTS + Write '1' to enable interrupt for CTS event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + NCTS + Write '1' to enable interrupt for NCTS event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXDRDY + Write '1' to enable interrupt for RXDRDY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXDRDY + Write '1' to enable interrupt for TXDRDY event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXTO + Write '1' to enable interrupt for RXTO event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + CTS + Write '1' to disable interrupt for CTS event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + NCTS + Write '1' to disable interrupt for NCTS event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXDRDY + Write '1' to disable interrupt for RXDRDY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXDRDY + Write '1' to disable interrupt for TXDRDY event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXTO + Write '1' to disable interrupt for RXTO event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x480 + read-write + oneToClear + + + OVERRUN + Overrun error + 0 + 0 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + PARITY + Parity error + 1 + 1 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + FRAMING + Framing error occurred + 2 + 2 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + BREAK + Break condition + 3 + 3 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + + + ENABLE + Enable UART + 0x500 + read-write + + + ENABLE + Enable or disable UART + 0 + 3 + + + Disabled + Disable UART + 0 + + + Enabled + Enable UART + 4 + + + + + + + PSEL + Unspecified + UART_PSEL + 0x508 + + RTS + Pin select for RTS + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + TXD + Pin select for TXD + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + CTS + Pin select for CTS + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + RXD + Pin select for RXD + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + RXD + RXD register + 0x518 + read-only + modifyExternal + + + RXD + RX data received in previous transfers, double buffered + 0 + 7 + + + + + TXD + TXD register + 0x51C + write-only + + + TXD + TX data to be transferred + 0 + 7 + + + + + BAUDRATE + Baud rate. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + BAUDRATE + Baud rate + 0 + 31 + + + Baud1200 + 1200 baud (actual rate: 1205) + 0x0004F000 + + + Baud2400 + 2400 baud (actual rate: 2396) + 0x0009D000 + + + Baud4800 + 4800 baud (actual rate: 4808) + 0x0013B000 + + + Baud9600 + 9600 baud (actual rate: 9598) + 0x00275000 + + + Baud14400 + 14400 baud (actual rate: 14414) + 0x003B0000 + + + Baud19200 + 19200 baud (actual rate: 19208) + 0x004EA000 + + + Baud28800 + 28800 baud (actual rate: 28829) + 0x0075F000 + + + Baud31250 + 31250 baud + 0x00800000 + + + Baud38400 + 38400 baud (actual rate: 38462) + 0x009D5000 + + + Baud56000 + 56000 baud (actual rate: 55944) + 0x00E50000 + + + Baud57600 + 57600 baud (actual rate: 57762) + 0x00EBF000 + + + Baud76800 + 76800 baud (actual rate: 76923) + 0x013A9000 + + + Baud115200 + 115200 baud (actual rate: 115942) + 0x01D7E000 + + + Baud230400 + 230400 baud (actual rate: 231884) + 0x03AFB000 + + + Baud250000 + 250000 baud + 0x04000000 + + + Baud460800 + 460800 baud (actual rate: 470588) + 0x075F7000 + + + Baud921600 + 921600 baud (actual rate: 941176) + 0x0EBED000 + + + Baud1M + 1Mega baud + 0x10000000 + + + + + + + CONFIG + Configuration of parity and hardware flow control + 0x56C + read-write + + + HWFC + Hardware flow control + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + PARITY + Parity + 1 + 3 + + + Excluded + Exclude parity bit + 0x0 + + + Included + Include parity bit + 0x7 + + + + + + + + + UARTE0 + UART with EasyDMA 0 + 0x40002000 + UART0 + UARTE + + 0 + 0x1000 + registers + + + UARTE0_UART0 + 2 + + UARTE + 0x20 + + + TASKS_STARTRX + Start UART receiver + 0x000 + write-only + + + TASKS_STARTRX + 0 + 0 + + + + + TASKS_STOPRX + Stop UART receiver + 0x004 + write-only + + + TASKS_STOPRX + 0 + 0 + + + + + TASKS_STARTTX + Start UART transmitter + 0x008 + write-only + + + TASKS_STARTTX + 0 + 0 + + + + + TASKS_STOPTX + Stop UART transmitter + 0x00C + write-only + + + TASKS_STOPTX + 0 + 0 + + + + + TASKS_FLUSHRX + Flush RX FIFO into RX buffer + 0x02C + write-only + + + TASKS_FLUSHRX + 0 + 0 + + + + + EVENTS_CTS + CTS is activated (set low). Clear To Send. + 0x100 + read-write + + + EVENTS_CTS + 0 + 0 + + + + + EVENTS_NCTS + CTS is deactivated (set high). Not Clear To Send. + 0x104 + read-write + + + EVENTS_NCTS + 0 + 0 + + + + + EVENTS_RXDRDY + Data received in RXD (but potentially not yet transferred to Data RAM) + 0x108 + read-write + + + EVENTS_RXDRDY + 0 + 0 + + + + + EVENTS_ENDRX + Receive buffer is filled up + 0x110 + read-write + + + EVENTS_ENDRX + 0 + 0 + + + + + EVENTS_TXDRDY + Data sent from TXD + 0x11C + read-write + + + EVENTS_TXDRDY + 0 + 0 + + + + + EVENTS_ENDTX + Last TX byte transmitted + 0x120 + read-write + + + EVENTS_ENDTX + 0 + 0 + + + + + EVENTS_ERROR + Error detected + 0x124 + read-write + + + EVENTS_ERROR + 0 + 0 + + + + + EVENTS_RXTO + Receiver timeout + 0x144 + read-write + + + EVENTS_RXTO + 0 + 0 + + + + + EVENTS_RXSTARTED + UART receiver has started + 0x14C + read-write + + + EVENTS_RXSTARTED + 0 + 0 + + + + + EVENTS_TXSTARTED + UART transmitter has started + 0x150 + read-write + + + EVENTS_TXSTARTED + 0 + 0 + + + + + EVENTS_TXSTOPPED + Transmitter stopped + 0x158 + read-write + + + EVENTS_TXSTOPPED + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + ENDRX_STARTRX + Shortcut between ENDRX event and STARTRX task + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ENDRX_STOPRX + Shortcut between ENDRX event and STOPRX task + 6 + 6 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + CTS + Enable or disable interrupt for CTS event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + NCTS + Enable or disable interrupt for NCTS event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXDRDY + Enable or disable interrupt for RXDRDY event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDRX + Enable or disable interrupt for ENDRX event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXDRDY + Enable or disable interrupt for TXDRDY event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDTX + Enable or disable interrupt for ENDTX event + 8 + 8 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ERROR + Enable or disable interrupt for ERROR event + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXTO + Enable or disable interrupt for RXTO event + 17 + 17 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXSTARTED + Enable or disable interrupt for RXSTARTED event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXSTARTED + Enable or disable interrupt for TXSTARTED event + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXSTOPPED + Enable or disable interrupt for TXSTOPPED event + 22 + 22 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + CTS + Write '1' to enable interrupt for CTS event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + NCTS + Write '1' to enable interrupt for NCTS event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXDRDY + Write '1' to enable interrupt for RXDRDY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDRX + Write '1' to enable interrupt for ENDRX event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXDRDY + Write '1' to enable interrupt for TXDRDY event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDTX + Write '1' to enable interrupt for ENDTX event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXTO + Write '1' to enable interrupt for RXTO event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXSTARTED + Write '1' to enable interrupt for RXSTARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXSTARTED + Write '1' to enable interrupt for TXSTARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXSTOPPED + Write '1' to enable interrupt for TXSTOPPED event + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + CTS + Write '1' to disable interrupt for CTS event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + NCTS + Write '1' to disable interrupt for NCTS event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXDRDY + Write '1' to disable interrupt for RXDRDY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDRX + Write '1' to disable interrupt for ENDRX event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXDRDY + Write '1' to disable interrupt for TXDRDY event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDTX + Write '1' to disable interrupt for ENDTX event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXTO + Write '1' to disable interrupt for RXTO event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXSTARTED + Write '1' to disable interrupt for RXSTARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXSTARTED + Write '1' to disable interrupt for TXSTARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXSTOPPED + Write '1' to disable interrupt for TXSTOPPED event + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source Note : this register is read / write one to clear. + 0x480 + read-write + oneToClear + + + OVERRUN + Overrun error + 0 + 0 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + PARITY + Parity error + 1 + 1 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + FRAMING + Framing error occurred + 2 + 2 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + BREAK + Break condition + 3 + 3 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + + + ENABLE + Enable UART + 0x500 + read-write + + + ENABLE + Enable or disable UARTE + 0 + 3 + + + Disabled + Disable UARTE + 0 + + + Enabled + Enable UARTE + 8 + + + + + + + PSEL + Unspecified + UARTE_PSEL + 0x508 + + RTS + Pin select for RTS signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + TXD + Pin select for TXD signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + CTS + Pin select for CTS signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + RXD + Pin select for RXD signal + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + BAUDRATE + Baud rate. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + BAUDRATE + Baud rate + 0 + 31 + + + Baud1200 + 1200 baud (actual rate: 1205) + 0x0004F000 + + + Baud2400 + 2400 baud (actual rate: 2396) + 0x0009D000 + + + Baud4800 + 4800 baud (actual rate: 4808) + 0x0013B000 + + + Baud9600 + 9600 baud (actual rate: 9598) + 0x00275000 + + + Baud14400 + 14400 baud (actual rate: 14401) + 0x003AF000 + + + Baud19200 + 19200 baud (actual rate: 19208) + 0x004EA000 + + + Baud28800 + 28800 baud (actual rate: 28777) + 0x0075C000 + + + Baud31250 + 31250 baud + 0x00800000 + + + Baud38400 + 38400 baud (actual rate: 38369) + 0x009D0000 + + + Baud56000 + 56000 baud (actual rate: 55944) + 0x00E50000 + + + Baud57600 + 57600 baud (actual rate: 57554) + 0x00EB0000 + + + Baud76800 + 76800 baud (actual rate: 76923) + 0x013A9000 + + + Baud115200 + 115200 baud (actual rate: 115108) + 0x01D60000 + + + Baud230400 + 230400 baud (actual rate: 231884) + 0x03B00000 + + + Baud250000 + 250000 baud + 0x04000000 + + + Baud460800 + 460800 baud (actual rate: 457143) + 0x07400000 + + + Baud921600 + 921600 baud (actual rate: 941176) + 0x0F000000 + + + Baud1M + 1Mega baud + 0x10000000 + + + + + + + RXD + RXD EasyDMA channel + UARTE_RXD + 0x534 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in receive buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in receive buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 15 + + + + + + TXD + TXD EasyDMA channel + UARTE_TXD + 0x544 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in transmit buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in transmit buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 15 + + + + + + CONFIG + Configuration of parity and hardware flow control + 0x56C + read-write + + + HWFC + Hardware flow control + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + PARITY + Parity + 1 + 3 + + + Excluded + Exclude parity bit + 0x0 + + + Included + Include even parity bit + 0x7 + + + + + STOP + Stop bits + 4 + 4 + + + One + One stop bit + 0 + + + Two + Two stop bits + 1 + + + + + + + + + SPI0 + Serial Peripheral Interface 0 + 0x40003000 + SPI + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + SPI + 0x20 + + + EVENTS_READY + TXD byte sent and RXD byte received + 0x108 + read-write + + + EVENTS_READY + 0 + 0 + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to enable interrupt for READY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to disable interrupt for READY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + Enable SPI + 0x500 + read-write + + + ENABLE + Enable or disable SPI + 0 + 3 + + + Disabled + Disable SPI + 0 + + + Enabled + Enable SPI + 1 + + + + + + + PSEL + Unspecified + SPI_PSEL + 0x508 + + SCK + Pin select for SCK + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MOSI + Pin select for MOSI signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MISO + Pin select for MISO signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + RXD + RXD register + 0x518 + read-only + modifyExternal + + + RXD + RX data received. Double buffered + 0 + 7 + + + + + TXD + TXD register + 0x51C + read-write + + + TXD + TX data to send. Double buffered + 0 + 7 + + + + + FREQUENCY + SPI frequency. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + FREQUENCY + SPI master data rate + 0 + 31 + + + K125 + 125 kbps + 0x02000000 + + + K250 + 250 kbps + 0x04000000 + + + K500 + 500 kbps + 0x08000000 + + + M1 + 1 Mbps + 0x10000000 + + + M2 + 2 Mbps + 0x20000000 + + + M4 + 4 Mbps + 0x40000000 + + + M8 + 8 Mbps + 0x80000000 + + + + + + + CONFIG + Configuration register + 0x554 + read-write + + + ORDER + Bit order + 0 + 0 + + + MsbFirst + Most significant bit shifted out first + 0 + + + LsbFirst + Least significant bit shifted out first + 1 + + + + + CPHA + Serial clock (SCK) phase + 1 + 1 + + + Leading + Sample on leading edge of clock, shift serial data on trailing edge + 0 + + + Trailing + Sample on trailing edge of clock, shift serial data on leading edge + 1 + + + + + CPOL + Serial clock (SCK) polarity + 2 + 2 + + + ActiveHigh + Active high + 0 + + + ActiveLow + Active low + 1 + + + + + + + + + SPIM0 + Serial Peripheral Interface Master with EasyDMA 0 + 0x40003000 + SPI0 + SPIM + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + SPIM + 0x20 + + + TASKS_START + Start SPI transaction + 0x010 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_STOP + Stop SPI transaction + 0x014 + write-only + + + TASKS_STOP + 0 + 0 + + + + + TASKS_SUSPEND + Suspend SPI transaction + 0x01C + write-only + + + TASKS_SUSPEND + 0 + 0 + + + + + TASKS_RESUME + Resume SPI transaction + 0x020 + write-only + + + TASKS_RESUME + 0 + 0 + + + + + EVENTS_STOPPED + SPI transaction has stopped + 0x104 + read-write + + + EVENTS_STOPPED + 0 + 0 + + + + + EVENTS_ENDRX + End of RXD buffer reached + 0x110 + read-write + + + EVENTS_ENDRX + 0 + 0 + + + + + EVENTS_END + End of RXD buffer and TXD buffer reached + 0x118 + read-write + + + EVENTS_END + 0 + 0 + + + + + EVENTS_ENDTX + End of TXD buffer reached + 0x120 + read-write + + + EVENTS_ENDTX + 0 + 0 + + + + + EVENTS_STARTED + Transaction started + 0x14C + read-write + + + EVENTS_STARTED + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + END_START + Shortcut between END event and START task + 17 + 17 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to enable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDRX + Write '1' to enable interrupt for ENDRX event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + END + Write '1' to enable interrupt for END event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDTX + Write '1' to enable interrupt for ENDTX event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STARTED + Write '1' to enable interrupt for STARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to disable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDRX + Write '1' to disable interrupt for ENDRX event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + END + Write '1' to disable interrupt for END event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDTX + Write '1' to disable interrupt for ENDTX event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STARTED + Write '1' to disable interrupt for STARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + STALLSTAT + Stall status for EasyDMA RAM accesses. The fields in this register is set to STALL by hardware whenever a stall occurres and can be cleared (set to NOSTALL) by the CPU. + 0x400 + read-write + 0x00000000 + + + TX + Stall status for EasyDMA RAM reads + 0 + 0 + + + NOSTALL + No stall + 0 + + + STALL + A stall has occurred + 1 + + + + + RX + Stall status for EasyDMA RAM writes + 1 + 1 + + + NOSTALL + No stall + 0 + + + STALL + A stall has occurred + 1 + + + + + + + ENABLE + Enable SPIM + 0x500 + read-write + + + ENABLE + Enable or disable SPIM + 0 + 3 + + + Disabled + Disable SPIM + 0 + + + Enabled + Enable SPIM + 7 + + + + + + + PSEL + Unspecified + SPIM_PSEL + 0x508 + + SCK + Pin select for SCK + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MOSI + Pin select for MOSI signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MISO + Pin select for MISO signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + CSN + Pin select for CSN + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + FREQUENCY + SPI frequency. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + FREQUENCY + SPI master data rate + 0 + 31 + + + K125 + 125 kbps + 0x02000000 + + + K250 + 250 kbps + 0x04000000 + + + K500 + 500 kbps + 0x08000000 + + + M1 + 1 Mbps + 0x10000000 + + + M2 + 2 Mbps + 0x20000000 + + + M4 + 4 Mbps + 0x40000000 + + + M8 + 8 Mbps + 0x80000000 + + + M16 + 16 Mbps + 0x0A000000 + + + M32 + 32 Mbps + 0x14000000 + + + + + + + RXD + RXD EasyDMA channel + SPIM_RXD + 0x534 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in receive buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in receive buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 15 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 1 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + TXD + TXD EasyDMA channel + SPIM_TXD + 0x544 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Number of bytes in transmit buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in transmit buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 15 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 1 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + CONFIG + Configuration register + 0x554 + read-write + + + ORDER + Bit order + 0 + 0 + + + MsbFirst + Most significant bit shifted out first + 0 + + + LsbFirst + Least significant bit shifted out first + 1 + + + + + CPHA + Serial clock (SCK) phase + 1 + 1 + + + Leading + Sample on leading edge of clock, shift serial data on trailing edge + 0 + + + Trailing + Sample on trailing edge of clock, shift serial data on leading edge + 1 + + + + + CPOL + Serial clock (SCK) polarity + 2 + 2 + + + ActiveHigh + Active high + 0 + + + ActiveLow + Active low + 1 + + + + + + + IFTIMING + Unspecified + SPIM_IFTIMING + 0x560 + + RXDELAY + Sample delay for input serial data on MISO + 0x000 + read-write + 0x00000002 + + + RXDELAY + Sample delay for input serial data on MISO. The value specifies the number of 64 MHz clock cycles (15.625 ns) delay from the the sampling edge of SCK (leading edge for CONFIG.CPHA = 0, trailing edge for CONFIG.CPHA = 1) until the input serial data is sampled. As en example, if RXDELAY = 0 and CONFIG.CPHA = 0, the input serial data is sampled on the rising edge of SCK. + 0 + 2 + + + + + CSNDUR + Minimum duration between edge of CSN and edge of SCK and minimum duration CSN must stay high between transactions + 0x004 + read-write + 0x00000002 + + + CSNDUR + Minimum duration between edge of CSN and edge of SCK and minimum duration CSN must stay high between transactions. The value is specified in number of 64 MHz clock cycles (15.625 ns). + 0 + 7 + + + + + + CSNPOL + Polarity of CSN output + 0x568 + read-write + 0x00000000 + + + CSNPOL + Polarity of CSN output + 0 + 0 + + + LOW + Active low (idle state high) + 0 + + + HIGH + Active high (idle state low) + 1 + + + + + + + PSELDCX + Pin select for DCX signal + 0x56C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + DCXCNT + DCX configuration + 0x570 + read-write + + + DCXCNT + This register specifies the number of command bytes preceding the data bytes. The PSEL.DCX line will be low during transmission of command bytes and high during transmission of data bytes. Value 0xF indicates that all bytes are command bytes. + 0 + 3 + + + + + ORC + Byte transmitted after TXD.MAXCNT bytes have been transmitted in the case when RXD.MAXCNT is greater than TXD.MAXCNT + 0x5C0 + read-write + + + ORC + Byte transmitted after TXD.MAXCNT bytes have been transmitted in the case when RXD.MAXCNT is greater than TXD.MAXCNT. + 0 + 7 + + + + + + + SPIS0 + SPI Slave 0 + 0x40003000 + SPI0 + SPIS + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + SPIS + 0x20 + + + TASKS_ACQUIRE + Acquire SPI semaphore + 0x024 + write-only + + + TASKS_ACQUIRE + 0 + 0 + + + + + TASKS_RELEASE + Release SPI semaphore, enabling the SPI slave to acquire it + 0x028 + write-only + + + TASKS_RELEASE + 0 + 0 + + + + + EVENTS_END + Granted transaction completed + 0x104 + read-write + + + EVENTS_END + 0 + 0 + + + + + EVENTS_ENDRX + End of RXD buffer reached + 0x110 + read-write + + + EVENTS_ENDRX + 0 + 0 + + + + + EVENTS_ACQUIRED + Semaphore acquired + 0x128 + read-write + + + EVENTS_ACQUIRED + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + END_ACQUIRE + Shortcut between END event and ACQUIRE task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + END + Write '1' to enable interrupt for END event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDRX + Write '1' to enable interrupt for ENDRX event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ACQUIRED + Write '1' to enable interrupt for ACQUIRED event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + END + Write '1' to disable interrupt for END event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDRX + Write '1' to disable interrupt for ENDRX event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ACQUIRED + Write '1' to disable interrupt for ACQUIRED event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + SEMSTAT + Semaphore status register + 0x400 + read-only + 0x00000001 + + + SEMSTAT + Semaphore status + 0 + 1 + + + Free + Semaphore is free + 0 + + + CPU + Semaphore is assigned to CPU + 1 + + + SPIS + Semaphore is assigned to SPI slave + 2 + + + CPUPending + Semaphore is assigned to SPI but a handover to the CPU is pending + 3 + + + + + + + STATUS + Status from last transaction + 0x440 + read-write + + + OVERREAD + TX buffer over-read detected, and prevented + 0 + 0 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + write + + Clear + Write: clear error on writing '1' + 1 + + + + + OVERFLOW + RX buffer overflow detected, and prevented + 1 + 1 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + write + + Clear + Write: clear error on writing '1' + 1 + + + + + + + ENABLE + Enable SPI slave + 0x500 + read-write + + + ENABLE + Enable or disable SPI slave + 0 + 3 + + + Disabled + Disable SPI slave + 0 + + + Enabled + Enable SPI slave + 2 + + + + + + + PSEL + Unspecified + SPIS_PSEL + 0x508 + + SCK + Pin select for SCK + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MISO + Pin select for MISO signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MOSI + Pin select for MOSI signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + CSN + Pin select for CSN signal + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + RXD + Unspecified + SPIS_RXD + 0x534 + + PTR + RXD data pointer + 0x000 + read-write + + + PTR + RXD data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in receive buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in receive buffer + 0 + 15 + + + + + AMOUNT + Number of bytes received in last granted transaction + 0x008 + read-only + + + AMOUNT + Number of bytes received in the last granted transaction + 0 + 15 + + + + + + TXD + Unspecified + SPIS_TXD + 0x544 + + PTR + TXD data pointer + 0x000 + read-write + + + PTR + TXD data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in transmit buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in transmit buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transmitted in last granted transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transmitted in last granted transaction + 0 + 15 + + + + + + CONFIG + Configuration register + 0x554 + read-write + + + ORDER + Bit order + 0 + 0 + + + MsbFirst + Most significant bit shifted out first + 0 + + + LsbFirst + Least significant bit shifted out first + 1 + + + + + CPHA + Serial clock (SCK) phase + 1 + 1 + + + Leading + Sample on leading edge of clock, shift serial data on trailing edge + 0 + + + Trailing + Sample on trailing edge of clock, shift serial data on leading edge + 1 + + + + + CPOL + Serial clock (SCK) polarity + 2 + 2 + + + ActiveHigh + Active high + 0 + + + ActiveLow + Active low + 1 + + + + + + + DEF + Default character. Character clocked out in case of an ignored transaction. + 0x55C + read-write + + + DEF + Default character. Character clocked out in case of an ignored transaction. + 0 + 7 + + + + + ORC + Over-read character + 0x5C0 + read-write + + + ORC + Over-read character. Character clocked out after an over-read of the transmit buffer. + 0 + 7 + + + + + + + TWI0 + I2C compatible Two-Wire Interface 0 + 0x40003000 + SPI0 + TWI + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + TWI + 0x20 + + + TASKS_STARTRX + Start TWI receive sequence + 0x000 + write-only + + + TASKS_STARTRX + 0 + 0 + + + + + TASKS_STARTTX + Start TWI transmit sequence + 0x008 + write-only + + + TASKS_STARTTX + 0 + 0 + + + + + TASKS_STOP + Stop TWI transaction + 0x014 + write-only + + + TASKS_STOP + 0 + 0 + + + + + TASKS_SUSPEND + Suspend TWI transaction + 0x01C + write-only + + + TASKS_SUSPEND + 0 + 0 + + + + + TASKS_RESUME + Resume TWI transaction + 0x020 + write-only + + + TASKS_RESUME + 0 + 0 + + + + + EVENTS_STOPPED + TWI stopped + 0x104 + read-write + + + EVENTS_STOPPED + 0 + 0 + + + + + EVENTS_RXDREADY + TWI RXD byte received + 0x108 + read-write + + + EVENTS_RXDREADY + 0 + 0 + + + + + EVENTS_TXDSENT + TWI TXD byte sent + 0x11C + read-write + + + EVENTS_TXDSENT + 0 + 0 + + + + + EVENTS_ERROR + TWI error + 0x124 + read-write + + + EVENTS_ERROR + 0 + 0 + + + + + EVENTS_BB + TWI byte boundary, generated before each byte that is sent or received + 0x138 + read-write + + + EVENTS_BB + 0 + 0 + + + + + EVENTS_SUSPENDED + TWI entered the suspended state + 0x148 + read-write + + + EVENTS_SUSPENDED + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + BB_SUSPEND + Shortcut between BB event and SUSPEND task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + BB_STOP + Shortcut between BB event and STOP task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to enable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXDREADY + Write '1' to enable interrupt for RXDREADY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXDSENT + Write '1' to enable interrupt for TXDSENT event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + BB + Write '1' to enable interrupt for BB event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SUSPENDED + Write '1' to enable interrupt for SUSPENDED event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to disable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXDREADY + Write '1' to disable interrupt for RXDREADY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXDSENT + Write '1' to disable interrupt for TXDSENT event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + BB + Write '1' to disable interrupt for BB event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SUSPENDED + Write '1' to disable interrupt for SUSPENDED event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x4C4 + read-write + oneToClear + + + OVERRUN + Overrun error + 0 + 0 + + read + + NotPresent + Read: no overrun occured + 0 + + + Present + Read: overrun occured + 1 + + + + + ANACK + NACK received after sending the address (write '1' to clear) + 1 + 1 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + DNACK + NACK received after sending a data byte (write '1' to clear) + 2 + 2 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + + + ENABLE + Enable TWI + 0x500 + read-write + + + ENABLE + Enable or disable TWI + 0 + 3 + + + Disabled + Disable TWI + 0 + + + Enabled + Enable TWI + 5 + + + + + + + PSEL + Unspecified + TWI_PSEL + 0x508 + + SCL + Pin select for SCL + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDA + Pin select for SDA + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + RXD + RXD register + 0x518 + read-only + modifyExternal + + + RXD + RXD register + 0 + 7 + + + + + TXD + TXD register + 0x51C + read-write + + + TXD + TXD register + 0 + 7 + + + + + FREQUENCY + TWI frequency. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + FREQUENCY + TWI master clock frequency + 0 + 31 + + + K100 + 100 kbps + 0x01980000 + + + K250 + 250 kbps + 0x04000000 + + + K400 + 400 kbps (actual rate 410.256 kbps) + 0x06680000 + + + + + + + ADDRESS + Address used in the TWI transfer + 0x588 + read-write + + + ADDRESS + Address used in the TWI transfer + 0 + 6 + + + + + + + TWIM0 + I2C compatible Two-Wire Master Interface with EasyDMA 0 + 0x40003000 + SPI0 + TWIM + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + TWIM + 0x20 + + + TASKS_STARTRX + Start TWI receive sequence + 0x000 + write-only + + + TASKS_STARTRX + 0 + 0 + + + + + TASKS_STARTTX + Start TWI transmit sequence + 0x008 + write-only + + + TASKS_STARTTX + 0 + 0 + + + + + TASKS_STOP + Stop TWI transaction. Must be issued while the TWI master is not suspended. + 0x014 + write-only + + + TASKS_STOP + 0 + 0 + + + + + TASKS_SUSPEND + Suspend TWI transaction + 0x01C + write-only + + + TASKS_SUSPEND + 0 + 0 + + + + + TASKS_RESUME + Resume TWI transaction + 0x020 + write-only + + + TASKS_RESUME + 0 + 0 + + + + + EVENTS_STOPPED + TWI stopped + 0x104 + read-write + + + EVENTS_STOPPED + 0 + 0 + + + + + EVENTS_ERROR + TWI error + 0x124 + read-write + + + EVENTS_ERROR + 0 + 0 + + + + + EVENTS_SUSPENDED + Last byte has been sent out after the SUSPEND task has been issued, TWI traffic is now suspended. + 0x148 + read-write + + + EVENTS_SUSPENDED + 0 + 0 + + + + + EVENTS_RXSTARTED + Receive sequence started + 0x14C + read-write + + + EVENTS_RXSTARTED + 0 + 0 + + + + + EVENTS_TXSTARTED + Transmit sequence started + 0x150 + read-write + + + EVENTS_TXSTARTED + 0 + 0 + + + + + EVENTS_LASTRX + Byte boundary, starting to receive the last byte + 0x15C + read-write + + + EVENTS_LASTRX + 0 + 0 + + + + + EVENTS_LASTTX + Byte boundary, starting to transmit the last byte + 0x160 + read-write + + + EVENTS_LASTTX + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + LASTTX_STARTRX + Shortcut between LASTTX event and STARTRX task + 7 + 7 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTTX_SUSPEND + Shortcut between LASTTX event and SUSPEND task + 8 + 8 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTTX_STOP + Shortcut between LASTTX event and STOP task + 9 + 9 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTRX_STARTTX + Shortcut between LASTRX event and STARTTX task + 10 + 10 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTRX_SUSPEND + Shortcut between LASTRX event and SUSPEND task + 11 + 11 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTRX_STOP + Shortcut between LASTRX event and STOP task + 12 + 12 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STOPPED + Enable or disable interrupt for STOPPED event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ERROR + Enable or disable interrupt for ERROR event + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SUSPENDED + Enable or disable interrupt for SUSPENDED event + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXSTARTED + Enable or disable interrupt for RXSTARTED event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXSTARTED + Enable or disable interrupt for TXSTARTED event + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + LASTRX + Enable or disable interrupt for LASTRX event + 23 + 23 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + LASTTX + Enable or disable interrupt for LASTTX event + 24 + 24 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to enable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SUSPENDED + Write '1' to enable interrupt for SUSPENDED event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXSTARTED + Write '1' to enable interrupt for RXSTARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXSTARTED + Write '1' to enable interrupt for TXSTARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + LASTRX + Write '1' to enable interrupt for LASTRX event + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + LASTTX + Write '1' to enable interrupt for LASTTX event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to disable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SUSPENDED + Write '1' to disable interrupt for SUSPENDED event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXSTARTED + Write '1' to disable interrupt for RXSTARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXSTARTED + Write '1' to disable interrupt for TXSTARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + LASTRX + Write '1' to disable interrupt for LASTRX event + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + LASTTX + Write '1' to disable interrupt for LASTTX event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x4C4 + read-write + oneToClear + + + OVERRUN + Overrun error + 0 + 0 + + + NotReceived + Error did not occur + 0 + + + Received + Error occurred + 1 + + + + + ANACK + NACK received after sending the address (write '1' to clear) + 1 + 1 + + + NotReceived + Error did not occur + 0 + + + Received + Error occurred + 1 + + + + + DNACK + NACK received after sending a data byte (write '1' to clear) + 2 + 2 + + + NotReceived + Error did not occur + 0 + + + Received + Error occurred + 1 + + + + + + + ENABLE + Enable TWIM + 0x500 + read-write + + + ENABLE + Enable or disable TWIM + 0 + 3 + + + Disabled + Disable TWIM + 0 + + + Enabled + Enable TWIM + 6 + + + + + + + PSEL + Unspecified + TWIM_PSEL + 0x508 + + SCL + Pin select for SCL signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDA + Pin select for SDA signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + FREQUENCY + TWI frequency. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + FREQUENCY + TWI master clock frequency + 0 + 31 + + + K100 + 100 kbps + 0x01980000 + + + K250 + 250 kbps + 0x04000000 + + + K400 + 400 kbps + 0x06400000 + + + + + + + RXD + RXD EasyDMA channel + TWIM_RXD + 0x534 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in receive buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in receive buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte. + 0 + 15 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 2 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + TXD + TXD EasyDMA channel + TWIM_TXD + 0x544 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in transmit buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in transmit buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte. + 0 + 15 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 2 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + ADDRESS + Address used in the TWI transfer + 0x588 + read-write + + + ADDRESS + Address used in the TWI transfer + 0 + 6 + + + + + + + TWIS0 + I2C compatible Two-Wire Slave Interface with EasyDMA 0 + 0x40003000 + SPI0 + TWIS + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + TWIS + 0x20 + + + TASKS_STOP + Stop TWI transaction + 0x014 + write-only + + + TASKS_STOP + 0 + 0 + + + + + TASKS_SUSPEND + Suspend TWI transaction + 0x01C + write-only + + + TASKS_SUSPEND + 0 + 0 + + + + + TASKS_RESUME + Resume TWI transaction + 0x020 + write-only + + + TASKS_RESUME + 0 + 0 + + + + + TASKS_PREPARERX + Prepare the TWI slave to respond to a write command + 0x030 + write-only + + + TASKS_PREPARERX + 0 + 0 + + + + + TASKS_PREPARETX + Prepare the TWI slave to respond to a read command + 0x034 + write-only + + + TASKS_PREPARETX + 0 + 0 + + + + + EVENTS_STOPPED + TWI stopped + 0x104 + read-write + + + EVENTS_STOPPED + 0 + 0 + + + + + EVENTS_ERROR + TWI error + 0x124 + read-write + + + EVENTS_ERROR + 0 + 0 + + + + + EVENTS_RXSTARTED + Receive sequence started + 0x14C + read-write + + + EVENTS_RXSTARTED + 0 + 0 + + + + + EVENTS_TXSTARTED + Transmit sequence started + 0x150 + read-write + + + EVENTS_TXSTARTED + 0 + 0 + + + + + EVENTS_WRITE + Write command received + 0x164 + read-write + + + EVENTS_WRITE + 0 + 0 + + + + + EVENTS_READ + Read command received + 0x168 + read-write + + + EVENTS_READ + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + WRITE_SUSPEND + Shortcut between WRITE event and SUSPEND task + 13 + 13 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + READ_SUSPEND + Shortcut between READ event and SUSPEND task + 14 + 14 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STOPPED + Enable or disable interrupt for STOPPED event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ERROR + Enable or disable interrupt for ERROR event + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXSTARTED + Enable or disable interrupt for RXSTARTED event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXSTARTED + Enable or disable interrupt for TXSTARTED event + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + WRITE + Enable or disable interrupt for WRITE event + 25 + 25 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + READ + Enable or disable interrupt for READ event + 26 + 26 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to enable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXSTARTED + Write '1' to enable interrupt for RXSTARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXSTARTED + Write '1' to enable interrupt for TXSTARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + WRITE + Write '1' to enable interrupt for WRITE event + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + READ + Write '1' to enable interrupt for READ event + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to disable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXSTARTED + Write '1' to disable interrupt for RXSTARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXSTARTED + Write '1' to disable interrupt for TXSTARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + WRITE + Write '1' to disable interrupt for WRITE event + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + READ + Write '1' to disable interrupt for READ event + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x4D0 + read-write + oneToClear + + + OVERFLOW + RX buffer overflow detected, and prevented + 0 + 0 + + + NotDetected + Error did not occur + 0 + + + Detected + Error occurred + 1 + + + + + DNACK + NACK sent after receiving a data byte + 2 + 2 + + + NotReceived + Error did not occur + 0 + + + Received + Error occurred + 1 + + + + + OVERREAD + TX buffer over-read detected, and prevented + 3 + 3 + + + NotDetected + Error did not occur + 0 + + + Detected + Error occurred + 1 + + + + + + + MATCH + Status register indicating which address had a match + 0x4D4 + read-only + + + MATCH + Which of the addresses in {ADDRESS} matched the incoming address + 0 + 0 + + + + + ENABLE + Enable TWIS + 0x500 + read-write + + + ENABLE + Enable or disable TWIS + 0 + 3 + + + Disabled + Disable TWIS + 0 + + + Enabled + Enable TWIS + 9 + + + + + + + PSEL + Unspecified + TWIS_PSEL + 0x508 + + SCL + Pin select for SCL signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDA + Pin select for SDA signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + RXD + RXD EasyDMA channel + TWIS_RXD + 0x534 + + PTR + RXD Data pointer + 0x000 + read-write + + + PTR + RXD Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in RXD buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in RXD buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last RXD transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last RXD transaction + 0 + 15 + + + + + + TXD + TXD EasyDMA channel + TWIS_TXD + 0x544 + + PTR + TXD Data pointer + 0x000 + read-write + + + PTR + TXD Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in TXD buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in TXD buffer + 0 + 15 + + + + + AMOUNT + Number of bytes transferred in the last TXD transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last TXD transaction + 0 + 15 + + + + + + 0x2 + 0x4 + ADDRESS[%s] + Description collection[n]: TWI slave address n + 0x588 + read-write + + + ADDRESS + TWI slave address + 0 + 6 + + + + + CONFIG + Configuration register for the address match mechanism + 0x594 + read-write + 0x00000001 + + + ADDRESS0 + Enable or disable address matching on ADDRESS[0] + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ADDRESS1 + Enable or disable address matching on ADDRESS[1] + 1 + 1 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + + + ORC + Over-read character. Character sent out in case of an over-read of the transmit buffer. + 0x5C0 + read-write + + + ORC + Over-read character. Character sent out in case of an over-read of the transmit buffer. + 0 + 7 + + + + + + + SPI1 + Serial Peripheral Interface 1 + 0x40004000 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + SPIM1 + Serial Peripheral Interface Master with EasyDMA 1 + 0x40004000 + SPI1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + SPIS1 + SPI Slave 1 + 0x40004000 + SPI1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + TWI1 + I2C compatible Two-Wire Interface 1 + 0x40004000 + SPI1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + TWIM1 + I2C compatible Two-Wire Master Interface with EasyDMA 1 + 0x40004000 + SPI1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + TWIS1 + I2C compatible Two-Wire Slave Interface with EasyDMA 1 + 0x40004000 + SPI1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + NFCT + NFC-A compatible radio + 0x40005000 + + 0 + 0x1000 + registers + + + NFCT + 5 + + NFCT + 0x20 + + + TASKS_ACTIVATE + Activate NFCT peripheral for incoming and outgoing frames, change state to activated + 0x000 + write-only + + + TASKS_ACTIVATE + 0 + 0 + + + + + TASKS_DISABLE + Disable NFCT peripheral + 0x004 + write-only + + + TASKS_DISABLE + 0 + 0 + + + + + TASKS_SENSE + Enable NFC sense field mode, change state to sense mode + 0x008 + write-only + + + TASKS_SENSE + 0 + 0 + + + + + TASKS_STARTTX + Start transmission of an outgoing frame, change state to transmit + 0x00C + write-only + + + TASKS_STARTTX + 0 + 0 + + + + + TASKS_ENABLERXDATA + Initializes the EasyDMA for receive. + 0x01C + write-only + + + TASKS_ENABLERXDATA + 0 + 0 + + + + + TASKS_GOIDLE + Force state machine to IDLE state + 0x024 + write-only + + + TASKS_GOIDLE + 0 + 0 + + + + + TASKS_GOSLEEP + Force state machine to SLEEP_A state + 0x028 + write-only + + + TASKS_GOSLEEP + 0 + 0 + + + + + EVENTS_READY + The NFCT peripheral is ready to receive and send frames + 0x100 + read-write + + + EVENTS_READY + 0 + 0 + + + + + EVENTS_FIELDDETECTED + Remote NFC field detected + 0x104 + read-write + + + EVENTS_FIELDDETECTED + 0 + 0 + + + + + EVENTS_FIELDLOST + Remote NFC field lost + 0x108 + read-write + + + EVENTS_FIELDLOST + 0 + 0 + + + + + EVENTS_TXFRAMESTART + Marks the start of the first symbol of a transmitted frame + 0x10C + read-write + + + EVENTS_TXFRAMESTART + 0 + 0 + + + + + EVENTS_TXFRAMEEND + Marks the end of the last transmitted on-air symbol of a frame + 0x110 + read-write + + + EVENTS_TXFRAMEEND + 0 + 0 + + + + + EVENTS_RXFRAMESTART + Marks the end of the first symbol of a received frame + 0x114 + read-write + + + EVENTS_RXFRAMESTART + 0 + 0 + + + + + EVENTS_RXFRAMEEND + Received data has been checked (CRC, parity) and transferred to RAM, and EasyDMA has ended accessing the RX buffer + 0x118 + read-write + + + EVENTS_RXFRAMEEND + 0 + 0 + + + + + EVENTS_ERROR + NFC error reported. The ERRORSTATUS register contains details on the source of the error. + 0x11C + read-write + + + EVENTS_ERROR + 0 + 0 + + + + + EVENTS_RXERROR + NFC RX frame error reported. The FRAMESTATUS.RX register contains details on the source of the error. + 0x128 + read-write + + + EVENTS_RXERROR + 0 + 0 + + + + + EVENTS_ENDRX + RX buffer (as defined by PACKETPTR and MAXLEN) in Data RAM full. + 0x12C + read-write + + + EVENTS_ENDRX + 0 + 0 + + + + + EVENTS_ENDTX + Transmission of data in RAM has ended, and EasyDMA has ended accessing the TX buffer + 0x130 + read-write + + + EVENTS_ENDTX + 0 + 0 + + + + + EVENTS_AUTOCOLRESSTARTED + Auto collision resolution process has started + 0x138 + read-write + + + EVENTS_AUTOCOLRESSTARTED + 0 + 0 + + + + + EVENTS_COLLISION + NFC auto collision resolution error reported. + 0x148 + read-write + + + EVENTS_COLLISION + 0 + 0 + + + + + EVENTS_SELECTED + NFC auto collision resolution successfully completed + 0x14C + read-write + + + EVENTS_SELECTED + 0 + 0 + + + + + EVENTS_STARTED + EasyDMA is ready to receive or send frames. + 0x150 + read-write + + + EVENTS_STARTED + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + FIELDDETECTED_ACTIVATE + Shortcut between FIELDDETECTED event and ACTIVATE task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + FIELDLOST_SENSE + Shortcut between FIELDLOST event and SENSE task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + TXFRAMEEND_ENABLERXDATA + Shortcut between TXFRAMEEND event and ENABLERXDATA task + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + READY + Enable or disable interrupt for READY event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + FIELDDETECTED + Enable or disable interrupt for FIELDDETECTED event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + FIELDLOST + Enable or disable interrupt for FIELDLOST event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXFRAMESTART + Enable or disable interrupt for TXFRAMESTART event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXFRAMEEND + Enable or disable interrupt for TXFRAMEEND event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXFRAMESTART + Enable or disable interrupt for RXFRAMESTART event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXFRAMEEND + Enable or disable interrupt for RXFRAMEEND event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ERROR + Enable or disable interrupt for ERROR event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXERROR + Enable or disable interrupt for RXERROR event + 10 + 10 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDRX + Enable or disable interrupt for ENDRX event + 11 + 11 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDTX + Enable or disable interrupt for ENDTX event + 12 + 12 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + AUTOCOLRESSTARTED + Enable or disable interrupt for AUTOCOLRESSTARTED event + 14 + 14 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + COLLISION + Enable or disable interrupt for COLLISION event + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SELECTED + Enable or disable interrupt for SELECTED event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STARTED + Enable or disable interrupt for STARTED event + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to enable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + FIELDDETECTED + Write '1' to enable interrupt for FIELDDETECTED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + FIELDLOST + Write '1' to enable interrupt for FIELDLOST event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXFRAMESTART + Write '1' to enable interrupt for TXFRAMESTART event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXFRAMEEND + Write '1' to enable interrupt for TXFRAMEEND event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXFRAMESTART + Write '1' to enable interrupt for RXFRAMESTART event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXFRAMEEND + Write '1' to enable interrupt for RXFRAMEEND event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for ERROR event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXERROR + Write '1' to enable interrupt for RXERROR event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDRX + Write '1' to enable interrupt for ENDRX event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDTX + Write '1' to enable interrupt for ENDTX event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + AUTOCOLRESSTARTED + Write '1' to enable interrupt for AUTOCOLRESSTARTED event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COLLISION + Write '1' to enable interrupt for COLLISION event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SELECTED + Write '1' to enable interrupt for SELECTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STARTED + Write '1' to enable interrupt for STARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to disable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + FIELDDETECTED + Write '1' to disable interrupt for FIELDDETECTED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + FIELDLOST + Write '1' to disable interrupt for FIELDLOST event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXFRAMESTART + Write '1' to disable interrupt for TXFRAMESTART event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXFRAMEEND + Write '1' to disable interrupt for TXFRAMEEND event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXFRAMESTART + Write '1' to disable interrupt for RXFRAMESTART event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXFRAMEEND + Write '1' to disable interrupt for RXFRAMEEND event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for ERROR event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXERROR + Write '1' to disable interrupt for RXERROR event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDRX + Write '1' to disable interrupt for ENDRX event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDTX + Write '1' to disable interrupt for ENDTX event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + AUTOCOLRESSTARTED + Write '1' to disable interrupt for AUTOCOLRESSTARTED event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COLLISION + Write '1' to disable interrupt for COLLISION event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SELECTED + Write '1' to disable interrupt for SELECTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STARTED + Write '1' to disable interrupt for STARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSTATUS + NFC Error Status register + 0x404 + read-write + oneToClear + + + FRAMEDELAYTIMEOUT + No STARTTX task triggered before expiration of the time set in FRAMEDELAYMAX + 0 + 0 + + + + + FRAMESTATUS + Unspecified + NFCT_FRAMESTATUS + 0x40C + + RX + Result of last incoming frame + 0x000 + read-write + oneToClear + + + CRCERROR + No valid end of frame (EoF) detected + 0 + 0 + + + CRCCorrect + Valid CRC detected + 0 + + + CRCError + CRC received does not match local check + 1 + + + + + PARITYSTATUS + Parity status of received frame + 2 + 2 + + + ParityOK + Frame received with parity OK + 0 + + + ParityError + Frame received with parity error + 1 + + + + + OVERRUN + Overrun detected + 3 + 3 + + + NoOverrun + No overrun detected + 0 + + + Overrun + Overrun error + 1 + + + + + + + + NFCTAGSTATE + NfcTag state register + 0x410 + read-only + + + NFCTAGSTATE + NfcTag state + 0 + 2 + + + Disabled + Disabled or sense + 0 + + + RampUp + RampUp + 2 + + + Idle + Idle + 3 + + + Receive + Receive + 4 + + + FrameDelay + FrameDelay + 5 + + + Transmit + Transmit + 6 + + + + + + + SLEEPSTATE + Sleep state during automatic collision resolution + 0x420 + read-only + 0x00000000 + + + SLEEPSTATE + Reflects the sleep state during automatic collision resolution. Set to IDLE + by a GOIDLE task. Set to SLEEP_A when a valid SLEEP_REQ frame is received or by a + GOSLEEP task. + 0 + 0 + + + Idle + State is IDLE. + 0 + + + SleepA + State is SLEEP_A. + 1 + + + + + + + FIELDPRESENT + Indicates the presence or not of a valid field + 0x43C + read-only + + + FIELDPRESENT + Indicates if a valid field is present. Available only in the activated state. + 0 + 0 + + + NoField + No valid field detected + 0 + + + FieldPresent + Valid field detected + 1 + + + + + LOCKDETECT + Indicates if the low level has locked to the field + 1 + 1 + + + NotLocked + Not locked to field + 0 + + + Locked + Locked to field + 1 + + + + + + + FRAMEDELAYMIN + Minimum frame delay + 0x504 + read-write + 0x00000480 + + + FRAMEDELAYMIN + Minimum frame delay in number of 13.56 MHz clocks + 0 + 15 + + + + + FRAMEDELAYMAX + Maximum frame delay + 0x508 + read-write + 0x00001000 + + + FRAMEDELAYMAX + Maximum frame delay in number of 13.56 MHz clocks + 0 + 19 + + + + + FRAMEDELAYMODE + Configuration register for the Frame Delay Timer + 0x50C + read-write + 0x00000001 + + + FRAMEDELAYMODE + Configuration register for the Frame Delay Timer + 0 + 1 + + + FreeRun + Transmission is independent of frame timer and will start when the STARTTX task is triggered. No timeout. + 0 + + + Window + Frame is transmitted between FRAMEDELAYMIN and FRAMEDELAYMAX + 1 + + + ExactVal + Frame is transmitted exactly at FRAMEDELAYMAX + 2 + + + WindowGrid + Frame is transmitted on a bit grid between FRAMEDELAYMIN and FRAMEDELAYMAX + 3 + + + + + + + PACKETPTR + Packet pointer for TXD and RXD data storage in Data RAM + 0x510 + read-write + 0x00000000 + + + PTR + Packet pointer for TXD and RXD data storage in Data RAM. This address is a byte-aligned RAM address. + 0 + 31 + + + + + MAXLEN + Size of the RAM buffer allocated to TXD and RXD data storage each + 0x514 + read-write + + + MAXLEN + Size of the RAM buffer allocated to TXD and RXD data storage each + 0 + 8 + + + + + TXD + Unspecified + NFCT_TXD + 0x518 + + FRAMECONFIG + Configuration of outgoing frames + 0x000 + read-write + 0x00000017 + + + PARITY + Indicates if parity is added to the frame + 0 + 0 + + + NoParity + Parity is not added to TX frames + 0 + + + Parity + Parity is added to TX frames + 1 + + + + + DISCARDMODE + Discarding unused bits at start or end of a frame + 1 + 1 + + + DiscardEnd + Unused bits are discarded at end of frame (EoF) + 0 + + + DiscardStart + Unused bits are discarded at start of frame (SoF) + 1 + + + + + SOF + Adding SoF or not in TX frames + 2 + 2 + + + NoSoF + SoF symbol not added + 0 + + + SoF + SoF symbol added + 1 + + + + + CRCMODETX + CRC mode for outgoing frames + 4 + 4 + + + NoCRCTX + CRC is not added to the frame + 0 + + + CRC16TX + 16 bit CRC added to the frame based on all the data read from RAM that is used in the frame + 1 + + + + + + + AMOUNT + Size of outgoing frame + 0x004 + read-write + + + TXDATABITS + Number of bits in the last or first byte read from RAM that shall be included in the frame (excluding parity bit). + 0 + 2 + + + TXDATABYTES + Number of complete bytes that shall be included in the frame, excluding CRC, parity and framing + 3 + 11 + + + + + + RXD + Unspecified + NFCT_RXD + 0x520 + + FRAMECONFIG + Configuration of incoming frames + 0x000 + read-write + 0x00000015 + + + PARITY + Indicates if parity expected in RX frame + 0 + 0 + + + NoParity + Parity is not expected in RX frames + 0 + + + Parity + Parity is expected in RX frames + 1 + + + + + SOF + SoF expected or not in RX frames + 2 + 2 + + + NoSoF + SoF symbol is not expected in RX frames + 0 + + + SoF + SoF symbol is expected in RX frames + 1 + + + + + CRCMODERX + CRC mode for incoming frames + 4 + 4 + + + NoCRCRX + CRC is not expected in RX frames + 0 + + + CRC16RX + Last 16 bits in RX frame is CRC, CRC is checked and CRCSTATUS updated + 1 + + + + + + + AMOUNT + Size of last incoming frame + 0x004 + read-only + + + RXDATABITS + Number of bits in the last byte in the frame, if less than 8 (including CRC, but excluding parity and SoF/EoF framing). + 0 + 2 + + + RXDATABYTES + Number of complete bytes received in the frame (including CRC, but excluding parity and SoF/EoF framing) + 3 + 11 + + + + + + NFCID1_LAST + Last NFCID1 part (4, 7 or 10 bytes ID) + 0x590 + read-write + 0x00006363 + + + NFCID1_Z + NFCID1 byte Z (very last byte sent) + 0 + 7 + + + NFCID1_Y + NFCID1 byte Y + 8 + 15 + + + NFCID1_X + NFCID1 byte X + 16 + 23 + + + NFCID1_W + NFCID1 byte W + 24 + 31 + + + + + NFCID1_2ND_LAST + Second last NFCID1 part (7 or 10 bytes ID) + 0x594 + read-write + + + NFCID1_V + NFCID1 byte V + 0 + 7 + + + NFCID1_U + NFCID1 byte U + 8 + 15 + + + NFCID1_T + NFCID1 byte T + 16 + 23 + + + + + NFCID1_3RD_LAST + Third last NFCID1 part (10 bytes ID) + 0x598 + read-write + + + NFCID1_S + NFCID1 byte S + 0 + 7 + + + NFCID1_R + NFCID1 byte R + 8 + 15 + + + NFCID1_Q + NFCID1 byte Q + 16 + 23 + + + + + AUTOCOLRESCONFIG + Controls the auto collision resolution function. This setting must be done before the NFCT peripheral is enabled. + 0x59C + read-write + 0x00000002 + + + MODE + Enables/disables auto collision resolution + 0 + 0 + + + Enabled + Auto collision resolution enabled + 0 + + + Disabled + Auto collision resolution disabled + 1 + + + + + + + SENSRES + NFC-A SENS_RES auto-response settings + 0x5A0 + read-write + 0x00000001 + + + BITFRAMESDD + Bit frame SDD as defined by the b5:b1 of byte 1 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification + 0 + 4 + + + SDD00000 + SDD pattern 00000 + 0 + + + SDD00001 + SDD pattern 00001 + 1 + + + SDD00010 + SDD pattern 00010 + 2 + + + SDD00100 + SDD pattern 00100 + 4 + + + SDD01000 + SDD pattern 01000 + 8 + + + SDD10000 + SDD pattern 10000 + 16 + + + + + RFU5 + Reserved for future use. Shall be 0. + 5 + 5 + + + NFCIDSIZE + NFCID1 size. This value is used by the auto collision resolution engine. + 6 + 7 + + + NFCID1Single + NFCID1 size: single (4 bytes) + 0 + + + NFCID1Double + NFCID1 size: double (7 bytes) + 1 + + + NFCID1Triple + NFCID1 size: triple (10 bytes) + 2 + + + + + PLATFCONFIG + Tag platform configuration as defined by the b4:b1 of byte 2 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification + 8 + 11 + + + RFU74 + Reserved for future use. Shall be 0. + 12 + 15 + + + + + SELRES + NFC-A SEL_RES auto-response settings + 0x5A4 + read-write + + + RFU10 + Reserved for future use. Shall be 0. + 0 + 1 + + + CASCADE + Cascade as defined by the b3 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification (controlled by hardware, shall be 0) + 2 + 2 + + + RFU43 + Reserved for future use. Shall be 0. + 3 + 4 + + + PROTOCOL + Protocol as defined by the b7:b6 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification + 5 + 6 + + + RFU7 + Reserved for future use. Shall be 0. + 7 + 7 + + + + + + + GPIOTE + GPIO Tasks and Events + 0x40006000 + + 0 + 0x1000 + registers + + + GPIOTE + 6 + + GPIOTE + 0x20 + + + 0x8 + 0x4 + TASKS_OUT[%s] + Description collection[n]: Task for writing to pin specified in CONFIG[n].PSEL. Action on pin is configured in CONFIG[n].POLARITY. + 0x000 + write-only + + + TASKS_OUT + 0 + 0 + + + + + 0x8 + 0x4 + TASKS_SET[%s] + Description collection[n]: Task for writing to pin specified in CONFIG[n].PSEL. Action on pin is to set it high. + 0x030 + write-only + + + TASKS_SET + 0 + 0 + + + + + 0x8 + 0x4 + TASKS_CLR[%s] + Description collection[n]: Task for writing to pin specified in CONFIG[n].PSEL. Action on pin is to set it low. + 0x060 + write-only + + + TASKS_CLR + 0 + 0 + + + + + 0x8 + 0x4 + EVENTS_IN[%s] + Description collection[n]: Event generated from pin specified in CONFIG[n].PSEL + 0x100 + read-write + + + EVENTS_IN + 0 + 0 + + + + + EVENTS_PORT + Event generated from multiple input GPIO pins with SENSE mechanism enabled + 0x17C + read-write + + + EVENTS_PORT + 0 + 0 + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + IN0 + Write '1' to enable interrupt for IN[0] event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN1 + Write '1' to enable interrupt for IN[1] event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN2 + Write '1' to enable interrupt for IN[2] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN3 + Write '1' to enable interrupt for IN[3] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN4 + Write '1' to enable interrupt for IN[4] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN5 + Write '1' to enable interrupt for IN[5] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN6 + Write '1' to enable interrupt for IN[6] event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN7 + Write '1' to enable interrupt for IN[7] event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PORT + Write '1' to enable interrupt for PORT event + 31 + 31 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + IN0 + Write '1' to disable interrupt for IN[0] event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN1 + Write '1' to disable interrupt for IN[1] event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN2 + Write '1' to disable interrupt for IN[2] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN3 + Write '1' to disable interrupt for IN[3] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN4 + Write '1' to disable interrupt for IN[4] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN5 + Write '1' to disable interrupt for IN[5] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN6 + Write '1' to disable interrupt for IN[6] event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN7 + Write '1' to disable interrupt for IN[7] event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PORT + Write '1' to disable interrupt for PORT event + 31 + 31 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + 0x8 + 0x4 + CONFIG[%s] + Description collection[n]: Configuration for OUT[n], SET[n] and CLR[n] tasks and IN[n] event + 0x510 + read-write + + + MODE + Mode + 0 + 1 + + + Disabled + Disabled. Pin specified by PSEL will not be acquired by the GPIOTE module. + 0 + + + Event + Event mode + 1 + + + Task + Task mode + 3 + + + + + PSEL + GPIO number associated with SET[n], CLR[n] and OUT[n] tasks and IN[n] event + 8 + 12 + + + PORT + Port number + 13 + 13 + + + POLARITY + When In task mode: Operation to be performed on output when OUT[n] task is triggered. When In event mode: Operation on input that shall trigger IN[n] event. + 16 + 17 + + + None + Task mode: No effect on pin from OUT[n] task. Event mode: no IN[n] event generated on pin activity. + 0 + + + LoToHi + Task mode: Set pin from OUT[n] task. Event mode: Generate IN[n] event when rising edge on pin. + 1 + + + HiToLo + Task mode: Clear pin from OUT[n] task. Event mode: Generate IN[n] event when falling edge on pin. + 2 + + + Toggle + Task mode: Toggle pin from OUT[n]. Event mode: Generate IN[n] when any change on pin. + 3 + + + + + OUTINIT + When in task mode: Initial value of the output when the GPIOTE channel is configured. When in event mode: No effect. + 20 + 20 + + + Low + Task mode: Initial value of pin before task triggering is low + 0 + + + High + Task mode: Initial value of pin before task triggering is high + 1 + + + + + + + + + SAADC + Successive approximation register (SAR) analog-to-digital converter + 0x40007000 + + 0 + 0x1000 + registers + + + SAADC + 7 + + SAADC + 0x20 + + + TASKS_START + Starts the SAADC and prepares the result buffer in RAM + 0x000 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_SAMPLE + Takes one SAADC sample + 0x004 + write-only + + + TASKS_SAMPLE + 0 + 0 + + + + + TASKS_STOP + Stops the SAADC and terminates all on-going conversions + 0x008 + write-only + + + TASKS_STOP + 0 + 0 + + + + + TASKS_CALIBRATEOFFSET + Starts offset auto-calibration + 0x00C + write-only + + + TASKS_CALIBRATEOFFSET + 0 + 0 + + + + + EVENTS_STARTED + The SAADC has started + 0x100 + read-write + + + EVENTS_STARTED + 0 + 0 + + + + + EVENTS_END + The SAADC has filled up the result buffer + 0x104 + read-write + + + EVENTS_END + 0 + 0 + + + + + EVENTS_DONE + A conversion task has been completed. Depending on the configuration, multiple conversions might be needed for a result to be transferred to RAM. + 0x108 + read-write + + + EVENTS_DONE + 0 + 0 + + + + + EVENTS_RESULTDONE + Result ready for transfer to RAM + 0x10C + read-write + + + EVENTS_RESULTDONE + 0 + 0 + + + + + EVENTS_CALIBRATEDONE + Calibration is complete + 0x110 + read-write + + + EVENTS_CALIBRATEDONE + 0 + 0 + + + + + EVENTS_STOPPED + The SAADC has stopped + 0x114 + read-write + + + EVENTS_STOPPED + 0 + 0 + + + + + 8 + 0x008 + EVENTS_CH[%s] + Unspecified + SAADC_EVENTS_CH + 0x118 + + LIMITH + Description cluster[n]: Last result is equal or above CH[n].LIMIT.HIGH + 0x000 + read-write + + + LIMITH + 0 + 0 + + + + + LIMITL + Description cluster[n]: Last result is equal or below CH[n].LIMIT.LOW + 0x004 + read-write + + + LIMITL + 0 + 0 + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STARTED + Enable or disable interrupt for STARTED event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + END + Enable or disable interrupt for END event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + DONE + Enable or disable interrupt for DONE event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RESULTDONE + Enable or disable interrupt for RESULTDONE event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CALIBRATEDONE + Enable or disable interrupt for CALIBRATEDONE event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STOPPED + Enable or disable interrupt for STOPPED event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH0LIMITH + Enable or disable interrupt for CH[0].LIMITH event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH0LIMITL + Enable or disable interrupt for CH[0].LIMITL event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH1LIMITH + Enable or disable interrupt for CH[1].LIMITH event + 8 + 8 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH1LIMITL + Enable or disable interrupt for CH[1].LIMITL event + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH2LIMITH + Enable or disable interrupt for CH[2].LIMITH event + 10 + 10 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH2LIMITL + Enable or disable interrupt for CH[2].LIMITL event + 11 + 11 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH3LIMITH + Enable or disable interrupt for CH[3].LIMITH event + 12 + 12 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH3LIMITL + Enable or disable interrupt for CH[3].LIMITL event + 13 + 13 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH4LIMITH + Enable or disable interrupt for CH[4].LIMITH event + 14 + 14 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH4LIMITL + Enable or disable interrupt for CH[4].LIMITL event + 15 + 15 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH5LIMITH + Enable or disable interrupt for CH[5].LIMITH event + 16 + 16 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH5LIMITL + Enable or disable interrupt for CH[5].LIMITL event + 17 + 17 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH6LIMITH + Enable or disable interrupt for CH[6].LIMITH event + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH6LIMITL + Enable or disable interrupt for CH[6].LIMITL event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH7LIMITH + Enable or disable interrupt for CH[7].LIMITH event + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH7LIMITL + Enable or disable interrupt for CH[7].LIMITL event + 21 + 21 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STARTED + Write '1' to enable interrupt for STARTED event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + END + Write '1' to enable interrupt for END event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DONE + Write '1' to enable interrupt for DONE event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RESULTDONE + Write '1' to enable interrupt for RESULTDONE event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CALIBRATEDONE + Write '1' to enable interrupt for CALIBRATEDONE event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STOPPED + Write '1' to enable interrupt for STOPPED event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH0LIMITH + Write '1' to enable interrupt for CH[0].LIMITH event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH0LIMITL + Write '1' to enable interrupt for CH[0].LIMITL event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH1LIMITH + Write '1' to enable interrupt for CH[1].LIMITH event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH1LIMITL + Write '1' to enable interrupt for CH[1].LIMITL event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH2LIMITH + Write '1' to enable interrupt for CH[2].LIMITH event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH2LIMITL + Write '1' to enable interrupt for CH[2].LIMITL event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH3LIMITH + Write '1' to enable interrupt for CH[3].LIMITH event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH3LIMITL + Write '1' to enable interrupt for CH[3].LIMITL event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH4LIMITH + Write '1' to enable interrupt for CH[4].LIMITH event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH4LIMITL + Write '1' to enable interrupt for CH[4].LIMITL event + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH5LIMITH + Write '1' to enable interrupt for CH[5].LIMITH event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH5LIMITL + Write '1' to enable interrupt for CH[5].LIMITL event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH6LIMITH + Write '1' to enable interrupt for CH[6].LIMITH event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH6LIMITL + Write '1' to enable interrupt for CH[6].LIMITL event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH7LIMITH + Write '1' to enable interrupt for CH[7].LIMITH event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH7LIMITL + Write '1' to enable interrupt for CH[7].LIMITL event + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STARTED + Write '1' to disable interrupt for STARTED event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + END + Write '1' to disable interrupt for END event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DONE + Write '1' to disable interrupt for DONE event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RESULTDONE + Write '1' to disable interrupt for RESULTDONE event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CALIBRATEDONE + Write '1' to disable interrupt for CALIBRATEDONE event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STOPPED + Write '1' to disable interrupt for STOPPED event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH0LIMITH + Write '1' to disable interrupt for CH[0].LIMITH event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH0LIMITL + Write '1' to disable interrupt for CH[0].LIMITL event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH1LIMITH + Write '1' to disable interrupt for CH[1].LIMITH event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH1LIMITL + Write '1' to disable interrupt for CH[1].LIMITL event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH2LIMITH + Write '1' to disable interrupt for CH[2].LIMITH event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH2LIMITL + Write '1' to disable interrupt for CH[2].LIMITL event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH3LIMITH + Write '1' to disable interrupt for CH[3].LIMITH event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH3LIMITL + Write '1' to disable interrupt for CH[3].LIMITL event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH4LIMITH + Write '1' to disable interrupt for CH[4].LIMITH event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH4LIMITL + Write '1' to disable interrupt for CH[4].LIMITL event + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH5LIMITH + Write '1' to disable interrupt for CH[5].LIMITH event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH5LIMITL + Write '1' to disable interrupt for CH[5].LIMITL event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH6LIMITH + Write '1' to disable interrupt for CH[6].LIMITH event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH6LIMITL + Write '1' to disable interrupt for CH[6].LIMITL event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH7LIMITH + Write '1' to disable interrupt for CH[7].LIMITH event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH7LIMITL + Write '1' to disable interrupt for CH[7].LIMITL event + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + STATUS + Status + 0x400 + read-only + + + STATUS + Status + 0 + 0 + + + Ready + SAADC is ready. No on-going conversions. + 0 + + + Busy + SAADC is busy. Conversion in progress. + 1 + + + + + + + ENABLE + Enable or disable SAADC + 0x500 + read-write + + + ENABLE + Enable or disable SAADC + 0 + 0 + + + Disabled + Disable SAADC + 0 + + + Enabled + Enable SAADC + 1 + + + + + + + 8 + 0x010 + CH[%s] + Unspecified + SAADC_CH + 0x510 + + PSELP + Description cluster[n]: Input positive pin selection for CH[n] + 0x000 + read-write + 0x00000000 + + + PSELP + Analog positive input channel + 0 + 4 + + + NC + Not connected + 0 + + + AnalogInput0 + AIN0 + 1 + + + AnalogInput1 + AIN1 + 2 + + + AnalogInput2 + AIN2 + 3 + + + AnalogInput3 + AIN3 + 4 + + + AnalogInput4 + AIN4 + 5 + + + AnalogInput5 + AIN5 + 6 + + + AnalogInput6 + AIN6 + 7 + + + AnalogInput7 + AIN7 + 8 + + + VDD + VDD + 9 + + + VDDHDIV5 + VDDH/5 + 0x0D + + + + + + + PSELN + Description cluster[n]: Input negative pin selection for CH[n] + 0x004 + read-write + 0x00000000 + + + PSELN + Analog negative input, enables differential channel + 0 + 4 + + + NC + Not connected + 0 + + + AnalogInput0 + AIN0 + 1 + + + AnalogInput1 + AIN1 + 2 + + + AnalogInput2 + AIN2 + 3 + + + AnalogInput3 + AIN3 + 4 + + + AnalogInput4 + AIN4 + 5 + + + AnalogInput5 + AIN5 + 6 + + + AnalogInput6 + AIN6 + 7 + + + AnalogInput7 + AIN7 + 8 + + + VDD + VDD + 9 + + + VDDHDIV5 + VDDH/5 + 0x0D + + + + + + + CONFIG + Description cluster[n]: Input configuration for CH[n] + 0x008 + read-write + 0x00020000 + + + RESP + Positive channel resistor control + 0 + 1 + + + Bypass + Bypass resistor ladder + 0 + + + Pulldown + Pull-down to GND + 1 + + + Pullup + Pull-up to VDD + 2 + + + VDD1_2 + Set input at VDD/2 + 3 + + + + + RESN + Negative channel resistor control + 4 + 5 + + + Bypass + Bypass resistor ladder + 0 + + + Pulldown + Pull-down to GND + 1 + + + Pullup + Pull-up to VDD + 2 + + + VDD1_2 + Set input at VDD/2 + 3 + + + + + GAIN + Gain control + 8 + 10 + + + Gain1_6 + 1/6 + 0 + + + Gain1_5 + 1/5 + 1 + + + Gain1_4 + 1/4 + 2 + + + Gain1_3 + 1/3 + 3 + + + Gain1_2 + 1/2 + 4 + + + Gain1 + 1 + 5 + + + Gain2 + 2 + 6 + + + Gain4 + 4 + 7 + + + + + REFSEL + Reference control + 12 + 12 + + + Internal + Internal reference (0.6 V) + 0 + + + VDD1_4 + VDD/4 as reference + 1 + + + + + TACQ + Acquisition time, the time the SAADC uses to sample the input voltage + 16 + 18 + + + 3us + 3 us + 0 + + + 5us + 5 us + 1 + + + 10us + 10 us + 2 + + + 15us + 15 us + 3 + + + 20us + 20 us + 4 + + + 40us + 40 us + 5 + + + + + MODE + Enable differential mode + 20 + 20 + + + SE + Single-ended, PSELN will be ignored, negative input to SAADC shorted to GND + 0 + + + Diff + Differential + 1 + + + + + BURST + Enable burst mode + 24 + 24 + + + Disabled + Burst mode is disabled (normal operation) + 0 + + + Enabled + Burst mode is enabled. SAADC takes 2^OVERSAMPLE number of samples as fast as it can, and sends the average to Data RAM. + 1 + + + + + + + LIMIT + Description cluster[n]: High/low limits for event monitoring of a channel + 0x00C + read-write + 0x7FFF8000 + + + LOW + Low level limit + 0 + 15 + + + HIGH + High level limit + 16 + 31 + + + + + + RESOLUTION + Resolution configuration + 0x5F0 + read-write + 0x00000001 + + + VAL + Set the resolution + 0 + 2 + + + 8bit + 8 bits + 0 + + + 10bit + 10 bits + 1 + + + 12bit + 12 bits + 2 + + + 14bit + 14 bits + 3 + + + + + + + OVERSAMPLE + Oversampling configuration. The RESOLUTION is applied before averaging, thus for high OVERSAMPLE a higher RESOLUTION should be used. + 0x5F4 + read-write + + + OVERSAMPLE + Oversample control + 0 + 3 + + + Bypass + Bypass oversampling + 0 + + + Over2x + Oversample 2x + 1 + + + Over4x + Oversample 4x + 2 + + + Over8x + Oversample 8x + 3 + + + Over16x + Oversample 16x + 4 + + + Over32x + Oversample 32x + 5 + + + Over64x + Oversample 64x + 6 + + + Over128x + Oversample 128x + 7 + + + Over256x + Oversample 256x + 8 + + + + + + + SAMPLERATE + Controls normal or continuous sample rate + 0x5F8 + read-write + + + CC + Capture and compare value. Sample rate is 16 MHz/CC + 0 + 10 + + + MODE + Select mode for sample rate control + 12 + 12 + + + Task + Rate is controlled from SAMPLE task + 0 + + + Timers + Rate is controlled from local timer (use CC to control the rate) + 1 + + + + + + + RESULT + RESULT EasyDMA channel + SAADC_RESULT + 0x62C + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of 16-bit samples to be written to output RAM buffer + 0x004 + read-write + + + MAXCNT + Maximum number of 16-bit samples to be written to output RAM buffer + 0 + 14 + + + + + AMOUNT + Number of 16-bit samples written to output RAM buffer since the previous START task + 0x008 + read-only + + + AMOUNT + Number of 16-bit samples written to output RAM buffer since the previous START task. This register can be read after an END or STOPPED event. + 0 + 14 + + + + + + + + TIMER0 + Timer/Counter 0 + 0x40008000 + TIMER + + 0 + 0x1000 + registers + + + TIMER0 + 8 + + TIMER + 0x20 + + + TASKS_START + Start Timer + 0x000 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_STOP + Stop Timer + 0x004 + write-only + + + TASKS_STOP + 0 + 0 + + + + + TASKS_COUNT + Increment Timer (Counter mode only) + 0x008 + write-only + + + TASKS_COUNT + 0 + 0 + + + + + TASKS_CLEAR + Clear time + 0x00C + write-only + + + TASKS_CLEAR + 0 + 0 + + + + + TASKS_SHUTDOWN + Deprecated register - Shut down timer + 0x010 + write-only + + + TASKS_SHUTDOWN + 0 + 0 + + + + + 0x6 + 0x4 + TASKS_CAPTURE[%s] + Description collection[n]: Capture Timer value to CC[n] register + 0x040 + write-only + + + TASKS_CAPTURE + 0 + 0 + + + + + 0x6 + 0x4 + EVENTS_COMPARE[%s] + Description collection[n]: Compare event on CC[n] match + 0x140 + read-write + + + EVENTS_COMPARE + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + COMPARE0_CLEAR + Shortcut between COMPARE[0] event and CLEAR task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE1_CLEAR + Shortcut between COMPARE[1] event and CLEAR task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE2_CLEAR + Shortcut between COMPARE[2] event and CLEAR task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE3_CLEAR + Shortcut between COMPARE[3] event and CLEAR task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE4_CLEAR + Shortcut between COMPARE[4] event and CLEAR task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE5_CLEAR + Shortcut between COMPARE[5] event and CLEAR task + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE0_STOP + Shortcut between COMPARE[0] event and STOP task + 8 + 8 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE1_STOP + Shortcut between COMPARE[1] event and STOP task + 9 + 9 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE2_STOP + Shortcut between COMPARE[2] event and STOP task + 10 + 10 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE3_STOP + Shortcut between COMPARE[3] event and STOP task + 11 + 11 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE4_STOP + Shortcut between COMPARE[4] event and STOP task + 12 + 12 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE5_STOP + Shortcut between COMPARE[5] event and STOP task + 13 + 13 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + COMPARE0 + Write '1' to enable interrupt for COMPARE[0] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE1 + Write '1' to enable interrupt for COMPARE[1] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE2 + Write '1' to enable interrupt for COMPARE[2] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE3 + Write '1' to enable interrupt for COMPARE[3] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE4 + Write '1' to enable interrupt for COMPARE[4] event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE5 + Write '1' to enable interrupt for COMPARE[5] event + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + COMPARE0 + Write '1' to disable interrupt for COMPARE[0] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE1 + Write '1' to disable interrupt for COMPARE[1] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE2 + Write '1' to disable interrupt for COMPARE[2] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE3 + Write '1' to disable interrupt for COMPARE[3] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE4 + Write '1' to disable interrupt for COMPARE[4] event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE5 + Write '1' to disable interrupt for COMPARE[5] event + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + MODE + Timer mode selection + 0x504 + read-write + + + MODE + Timer mode + 0 + 1 + + + Timer + Select Timer mode + 0 + + + Counter + Deprecated enumerator - Select Counter mode + 1 + + + LowPowerCounter + Select Low Power Counter mode + 2 + + + + + + + BITMODE + Configure the number of bits used by the TIMER + 0x508 + read-write + + + BITMODE + Timer bit width + 0 + 1 + + + 16Bit + 16 bit timer bit width + 0 + + + 08Bit + 8 bit timer bit width + 1 + + + 24Bit + 24 bit timer bit width + 2 + + + 32Bit + 32 bit timer bit width + 3 + + + + + + + PRESCALER + Timer prescaler register + 0x510 + read-write + 0x00000004 + + + PRESCALER + Prescaler value + 0 + 3 + + + + + 0x6 + 0x4 + CC[%s] + Description collection[n]: Capture/Compare register n + 0x540 + read-write + + + CC + Capture/Compare value + 0 + 31 + + + + + + + TIMER1 + Timer/Counter 1 + 0x40009000 + + TIMER1 + 9 + + + + TIMER2 + Timer/Counter 2 + 0x4000A000 + + TIMER2 + 10 + + + + RTC0 + Real time counter 0 + 0x4000B000 + RTC + + 0 + 0x1000 + registers + + + RTC0 + 11 + + RTC + 0x20 + + + TASKS_START + Start RTC COUNTER + 0x000 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_STOP + Stop RTC COUNTER + 0x004 + write-only + + + TASKS_STOP + 0 + 0 + + + + + TASKS_CLEAR + Clear RTC COUNTER + 0x008 + write-only + + + TASKS_CLEAR + 0 + 0 + + + + + TASKS_TRIGOVRFLW + Set COUNTER to 0xFFFFF0 + 0x00C + write-only + + + TASKS_TRIGOVRFLW + 0 + 0 + + + + + EVENTS_TICK + Event on COUNTER increment + 0x100 + read-write + + + EVENTS_TICK + 0 + 0 + + + + + EVENTS_OVRFLW + Event on COUNTER overflow + 0x104 + read-write + + + EVENTS_OVRFLW + 0 + 0 + + + + + 0x4 + 0x4 + EVENTS_COMPARE[%s] + Description collection[n]: Compare event on CC[n] match + 0x140 + read-write + + + EVENTS_COMPARE + 0 + 0 + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + TICK + Write '1' to enable interrupt for TICK event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + OVRFLW + Write '1' to enable interrupt for OVRFLW event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE0 + Write '1' to enable interrupt for COMPARE[0] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE1 + Write '1' to enable interrupt for COMPARE[1] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE2 + Write '1' to enable interrupt for COMPARE[2] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE3 + Write '1' to enable interrupt for COMPARE[3] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + TICK + Write '1' to disable interrupt for TICK event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + OVRFLW + Write '1' to disable interrupt for OVRFLW event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE0 + Write '1' to disable interrupt for COMPARE[0] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE1 + Write '1' to disable interrupt for COMPARE[1] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE2 + Write '1' to disable interrupt for COMPARE[2] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE3 + Write '1' to disable interrupt for COMPARE[3] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + EVTEN + Enable or disable event routing + 0x340 + read-write + + + TICK + Enable or disable event routing for TICK event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + OVRFLW + Enable or disable event routing for OVRFLW event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + COMPARE0 + Enable or disable event routing for COMPARE[0] event + 16 + 16 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + COMPARE1 + Enable or disable event routing for COMPARE[1] event + 17 + 17 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + COMPARE2 + Enable or disable event routing for COMPARE[2] event + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + COMPARE3 + Enable or disable event routing for COMPARE[3] event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + EVTENSET + Enable event routing + 0x344 + read-write + + + TICK + Write '1' to enable event routing for TICK event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + OVRFLW + Write '1' to enable event routing for OVRFLW event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE0 + Write '1' to enable event routing for COMPARE[0] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE1 + Write '1' to enable event routing for COMPARE[1] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE2 + Write '1' to enable event routing for COMPARE[2] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE3 + Write '1' to enable event routing for COMPARE[3] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + EVTENCLR + Disable event routing + 0x348 + read-write + + + TICK + Write '1' to disable event routing for TICK event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + OVRFLW + Write '1' to disable event routing for OVRFLW event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE0 + Write '1' to disable event routing for COMPARE[0] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE1 + Write '1' to disable event routing for COMPARE[1] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE2 + Write '1' to disable event routing for COMPARE[2] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE3 + Write '1' to disable event routing for COMPARE[3] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + COUNTER + Current COUNTER value + 0x504 + read-only + + + COUNTER + Counter value + 0 + 23 + + + + + PRESCALER + 12 bit prescaler for COUNTER frequency (32768/(PRESCALER+1)).Must be written when RTC is stopped + 0x508 + read-write + + + PRESCALER + Prescaler value + 0 + 11 + + + + + 0x4 + 0x4 + CC[%s] + Description collection[n]: Compare register n + 0x540 + read-write + + + COMPARE + Compare value + 0 + 23 + + + + + + + TEMP + Temperature Sensor + 0x4000C000 + + 0 + 0x1000 + registers + + + TEMP + 12 + + TEMP + 0x20 + + + TASKS_START + Start temperature measurement + 0x000 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_STOP + Stop temperature measurement + 0x004 + write-only + + + TASKS_STOP + 0 + 0 + + + + + EVENTS_DATARDY + Temperature measurement complete, data ready + 0x100 + read-write + + + EVENTS_DATARDY + 0 + 0 + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + DATARDY + Write '1' to enable interrupt for DATARDY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + DATARDY + Write '1' to disable interrupt for DATARDY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + TEMP + Temperature in degC (0.25deg steps) + 0x508 + read-only + int32_t + + + TEMP + Temperature in degC (0.25deg steps) + 0 + 31 + + + + + A0 + Slope of 1st piece wise linear function + 0x520 + read-write + 0x00000326 + + + A0 + Slope of 1st piece wise linear function + 0 + 11 + + + + + A1 + Slope of 2nd piece wise linear function + 0x524 + read-write + 0x00000348 + + + A1 + Slope of 2nd piece wise linear function + 0 + 11 + + + + + A2 + Slope of 3rd piece wise linear function + 0x528 + read-write + 0x000003AA + + + A2 + Slope of 3rd piece wise linear function + 0 + 11 + + + + + A3 + Slope of 4th piece wise linear function + 0x52C + read-write + 0x0000040E + + + A3 + Slope of 4th piece wise linear function + 0 + 11 + + + + + A4 + Slope of 5th piece wise linear function + 0x530 + read-write + 0x000004BD + + + A4 + Slope of 5th piece wise linear function + 0 + 11 + + + + + A5 + Slope of 6th piece wise linear function + 0x534 + read-write + 0x000005A3 + + + A5 + Slope of 6th piece wise linear function + 0 + 11 + + + + + B0 + y-intercept of 1st piece wise linear function + 0x540 + read-write + 0x00003FEF + + + B0 + y-intercept of 1st piece wise linear function + 0 + 13 + + + + + B1 + y-intercept of 2nd piece wise linear function + 0x544 + read-write + 0x00003FBE + + + B1 + y-intercept of 2nd piece wise linear function + 0 + 13 + + + + + B2 + y-intercept of 3rd piece wise linear function + 0x548 + read-write + 0x00003FBE + + + B2 + y-intercept of 3rd piece wise linear function + 0 + 13 + + + + + B3 + y-intercept of 4th piece wise linear function + 0x54C + read-write + 0x00000012 + + + B3 + y-intercept of 4th piece wise linear function + 0 + 13 + + + + + B4 + y-intercept of 5th piece wise linear function + 0x550 + read-write + 0x00000124 + + + B4 + y-intercept of 5th piece wise linear function + 0 + 13 + + + + + B5 + y-intercept of 6th piece wise linear function + 0x554 + read-write + 0x0000027C + + + B5 + y-intercept of 6th piece wise linear function + 0 + 13 + + + + + T0 + End point of 1st piece wise linear function + 0x560 + read-write + 0x000000E2 + + + T0 + End point of 1st piece wise linear function + 0 + 7 + + + + + T1 + End point of 2nd piece wise linear function + 0x564 + read-write + 0x00000000 + + + T1 + End point of 2nd piece wise linear function + 0 + 7 + + + + + T2 + End point of 3rd piece wise linear function + 0x568 + read-write + 0x00000019 + + + T2 + End point of 3rd piece wise linear function + 0 + 7 + + + + + T3 + End point of 4th piece wise linear function + 0x56C + read-write + 0x0000003C + + + T3 + End point of 4th piece wise linear function + 0 + 7 + + + + + T4 + End point of 5th piece wise linear function + 0x570 + read-write + 0x00000050 + + + T4 + End point of 5th piece wise linear function + 0 + 7 + + + + + + + RNG + Random Number Generator + 0x4000D000 + + 0 + 0x1000 + registers + + + RNG + 13 + + RNG + 0x20 + + + TASKS_START + Task starting the random number generator + 0x000 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_STOP + Task stopping the random number generator + 0x004 + write-only + + + TASKS_STOP + 0 + 0 + + + + + EVENTS_VALRDY + Event being generated for every new random number written to the VALUE register + 0x100 + read-write + + + EVENTS_VALRDY + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + VALRDY_STOP + Shortcut between VALRDY event and STOP task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + VALRDY + Write '1' to enable interrupt for VALRDY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + VALRDY + Write '1' to disable interrupt for VALRDY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + CONFIG + Configuration register + 0x504 + read-write + + + DERCEN + Bias correction + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + + + VALUE + Output random number + 0x508 + read-only + + + VALUE + Generated random number + 0 + 7 + + + + + + + ECB + AES ECB Mode Encryption + 0x4000E000 + + 0 + 0x1000 + registers + + + ECB + 14 + + ECB + 0x20 + + + TASKS_STARTECB + Start ECB block encrypt + 0x000 + write-only + + + TASKS_STARTECB + 0 + 0 + + + + + TASKS_STOPECB + Abort a possible executing ECB operation + 0x004 + write-only + + + TASKS_STOPECB + 0 + 0 + + + + + EVENTS_ENDECB + ECB block encrypt complete + 0x100 + read-write + + + EVENTS_ENDECB + 0 + 0 + + + + + EVENTS_ERRORECB + ECB block encrypt aborted because of a STOPECB task or due to an error + 0x104 + read-write + + + EVENTS_ERRORECB + 0 + 0 + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + ENDECB + Write '1' to enable interrupt for ENDECB event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERRORECB + Write '1' to enable interrupt for ERRORECB event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + ENDECB + Write '1' to disable interrupt for ENDECB event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERRORECB + Write '1' to disable interrupt for ERRORECB event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ECBDATAPTR + ECB block encrypt memory pointers + 0x504 + read-write + + + ECBDATAPTR + Pointer to the ECB data structure (see Table 1 ECB data structure overview) + 0 + 31 + + + + + + + AAR + Accelerated Address Resolver + 0x4000F000 + + 0 + 0x1000 + registers + + + CCM_AAR + 15 + + AAR + 0x20 + + + TASKS_START + Start resolving addresses based on IRKs specified in the IRK data structure + 0x000 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_STOP + Stop resolving addresses + 0x008 + write-only + + + TASKS_STOP + 0 + 0 + + + + + EVENTS_END + Address resolution procedure complete + 0x100 + read-write + + + EVENTS_END + 0 + 0 + + + + + EVENTS_RESOLVED + Address resolved + 0x104 + read-write + + + EVENTS_RESOLVED + 0 + 0 + + + + + EVENTS_NOTRESOLVED + Address not resolved + 0x108 + read-write + + + EVENTS_NOTRESOLVED + 0 + 0 + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + END + Write '1' to enable interrupt for END event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RESOLVED + Write '1' to enable interrupt for RESOLVED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + NOTRESOLVED + Write '1' to enable interrupt for NOTRESOLVED event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + END + Write '1' to disable interrupt for END event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RESOLVED + Write '1' to disable interrupt for RESOLVED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + NOTRESOLVED + Write '1' to disable interrupt for NOTRESOLVED event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + STATUS + Resolution status + 0x400 + read-only + + + STATUS + The IRK that was used last time an address was resolved + 0 + 3 + + + + + ENABLE + Enable AAR + 0x500 + read-write + + + ENABLE + Enable or disable AAR + 0 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 3 + + + + + + + NIRK + Number of IRKs + 0x504 + read-write + 0x00000001 + + + NIRK + Number of Identity root keys available in the IRK data structure + 0 + 4 + + + + + IRKPTR + Pointer to IRK data structure + 0x508 + read-write + + + IRKPTR + Pointer to the IRK data structure + 0 + 31 + + + + + ADDRPTR + Pointer to the resolvable address + 0x510 + read-write + + + ADDRPTR + Pointer to the resolvable address (6-bytes) + 0 + 31 + + + + + SCRATCHPTR + Pointer to data area used for temporary storage + 0x514 + read-write + + + SCRATCHPTR + Pointer to a scratch data area used for temporary storage during resolution.A space of minimum 3 bytes must be reserved. + 0 + 31 + + + + + + + CCM + AES CCM Mode Encryption + 0x4000F000 + AAR + + 0 + 0x1000 + registers + + + CCM_AAR + 15 + + CCM + 0x20 + + + TASKS_KSGEN + Start generation of key-stream. This operation will stop by itself when completed. + 0x000 + write-only + + + TASKS_KSGEN + 0 + 0 + + + + + TASKS_CRYPT + Start encryption/decryption. This operation will stop by itself when completed. + 0x004 + write-only + + + TASKS_CRYPT + 0 + 0 + + + + + TASKS_STOP + Stop encryption/decryption + 0x008 + write-only + + + TASKS_STOP + 0 + 0 + + + + + TASKS_RATEOVERRIDE + Override DATARATE setting in MODE register with the contents of the RATEOVERRIDE register for any ongoing encryption/decryption + 0x00C + write-only + + + TASKS_RATEOVERRIDE + 0 + 0 + + + + + EVENTS_ENDKSGEN + Key-stream generation complete + 0x100 + read-write + + + EVENTS_ENDKSGEN + 0 + 0 + + + + + EVENTS_ENDCRYPT + Encrypt/decrypt complete + 0x104 + read-write + + + EVENTS_ENDCRYPT + 0 + 0 + + + + + EVENTS_ERROR + Deprecated register - CCM error event + 0x108 + read-write + + + EVENTS_ERROR + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + ENDKSGEN_CRYPT + Shortcut between ENDKSGEN event and CRYPT task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + ENDKSGEN + Write '1' to enable interrupt for ENDKSGEN event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDCRYPT + Write '1' to enable interrupt for ENDCRYPT event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to enable interrupt for ERROR event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + ENDKSGEN + Write '1' to disable interrupt for ENDKSGEN event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDCRYPT + Write '1' to disable interrupt for ENDCRYPT event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to disable interrupt for ERROR event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + MICSTATUS + MIC check result + 0x400 + read-only + + + MICSTATUS + The result of the MIC check performed during the previous decryption operation + 0 + 0 + + + CheckFailed + MIC check failed + 0 + + + CheckPassed + MIC check passed + 1 + + + + + + + ENABLE + Enable + 0x500 + read-write + + + ENABLE + Enable or disable CCM + 0 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 2 + + + + + + + MODE + Operation mode + 0x504 + read-write + 0x00000001 + + + MODE + The mode of operation to be used. The settings in this register apply whenever either the KSGEN or CRYPT tasks are triggered. + 0 + 0 + + + Encryption + AES CCM packet encryption mode + 0 + + + Decryption + AES CCM packet decryption mode + 1 + + + + + DATARATE + Radio data rate that the CCM shall run synchronous with + 16 + 17 + + + 1Mbit + 1 Mbps + 0 + + + 2Mbit + 2 Mbps + 1 + + + 125Kbps + 125 Kbps + 2 + + + 500Kbps + 500 Kbps + 3 + + + + + LENGTH + Packet length configuration + 24 + 24 + + + Default + Default length. Effective length of LENGTH field in encrypted/decrypted packet is 5 bits. A key-stream for packet payloads up to 27 bytes will be generated. + 0 + + + Extended + Extended length. Effective length of LENGTH field in encrypted/decrypted packet is 8 bits. A key-stream for packet payloads up to MAXPACKETSIZE bytes will be generated. + 1 + + + + + + + CNFPTR + Pointer to data structure holding AES key and NONCE vector + 0x508 + read-write + + + CNFPTR + Pointer to the data structure holding the AES key and the CCM NONCE vector (see Table 1 CCM data structure overview) + 0 + 31 + + + + + INPTR + Input pointer + 0x50C + read-write + + + INPTR + Input pointer + 0 + 31 + + + + + OUTPTR + Output pointer + 0x510 + read-write + + + OUTPTR + Output pointer + 0 + 31 + + + + + SCRATCHPTR + Pointer to data area used for temporary storage + 0x514 + read-write + + + SCRATCHPTR + Pointer to a scratch data area used for temporary storage during key-stream generation, + MIC generation and encryption/decryption. + 0 + 31 + + + + + MAXPACKETSIZE + Length of key-stream generated when MODE.LENGTH = Extended. + 0x518 + read-write + 0x000000FB + + + MAXPACKETSIZE + Length of key-stream generated when MODE.LENGTH = Extended. This value must be greater or equal to the subsequent packet payload to be encrypted/decrypted. + 0 + 7 + + + + + RATEOVERRIDE + Data rate override setting. + 0x51C + read-write + 0x00000000 + + + RATEOVERRIDE + Data rate override setting. + 0 + 1 + + + 1Mbit + 1 Mbps + 0 + + + 2Mbit + 2 Mbps + 1 + + + 125Kbps + 125 Kbps + 2 + + + 500Kbps + 500 Kbps + 3 + + + + + + + + + WDT + Watchdog Timer + 0x40010000 + + 0 + 0x1000 + registers + + + WDT + 16 + + WDT + 0x20 + + + TASKS_START + Start the watchdog + 0x000 + write-only + + + TASKS_START + 0 + 0 + + + + + EVENTS_TIMEOUT + Watchdog timeout + 0x100 + read-write + + + EVENTS_TIMEOUT + 0 + 0 + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + TIMEOUT + Write '1' to enable interrupt for TIMEOUT event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + TIMEOUT + Write '1' to disable interrupt for TIMEOUT event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + RUNSTATUS + Run status + 0x400 + read-only + + + RUNSTATUS + Indicates whether or not the watchdog is running + 0 + 0 + + + NotRunning + Watchdog not running + 0 + + + Running + Watchdog is running + 1 + + + + + + + REQSTATUS + Request status + 0x404 + read-only + 0x00000001 + + + RR0 + Request status for RR[0] register + 0 + 0 + + + DisabledOrRequested + RR[0] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[0] register is enabled, and are not yet requesting reload + 1 + + + + + RR1 + Request status for RR[1] register + 1 + 1 + + + DisabledOrRequested + RR[1] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[1] register is enabled, and are not yet requesting reload + 1 + + + + + RR2 + Request status for RR[2] register + 2 + 2 + + + DisabledOrRequested + RR[2] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[2] register is enabled, and are not yet requesting reload + 1 + + + + + RR3 + Request status for RR[3] register + 3 + 3 + + + DisabledOrRequested + RR[3] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[3] register is enabled, and are not yet requesting reload + 1 + + + + + RR4 + Request status for RR[4] register + 4 + 4 + + + DisabledOrRequested + RR[4] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[4] register is enabled, and are not yet requesting reload + 1 + + + + + RR5 + Request status for RR[5] register + 5 + 5 + + + DisabledOrRequested + RR[5] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[5] register is enabled, and are not yet requesting reload + 1 + + + + + RR6 + Request status for RR[6] register + 6 + 6 + + + DisabledOrRequested + RR[6] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[6] register is enabled, and are not yet requesting reload + 1 + + + + + RR7 + Request status for RR[7] register + 7 + 7 + + + DisabledOrRequested + RR[7] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[7] register is enabled, and are not yet requesting reload + 1 + + + + + + + CRV + Counter reload value + 0x504 + read-write + 0xFFFFFFFF + + + CRV + Counter reload value in number of cycles of the 32.768 kHz clock + 0 + 31 + + + + + RREN + Enable register for reload request registers + 0x508 + read-write + 0x00000001 + + + RR0 + Enable or disable RR[0] register + 0 + 0 + + + Disabled + Disable RR[0] register + 0 + + + Enabled + Enable RR[0] register + 1 + + + + + RR1 + Enable or disable RR[1] register + 1 + 1 + + + Disabled + Disable RR[1] register + 0 + + + Enabled + Enable RR[1] register + 1 + + + + + RR2 + Enable or disable RR[2] register + 2 + 2 + + + Disabled + Disable RR[2] register + 0 + + + Enabled + Enable RR[2] register + 1 + + + + + RR3 + Enable or disable RR[3] register + 3 + 3 + + + Disabled + Disable RR[3] register + 0 + + + Enabled + Enable RR[3] register + 1 + + + + + RR4 + Enable or disable RR[4] register + 4 + 4 + + + Disabled + Disable RR[4] register + 0 + + + Enabled + Enable RR[4] register + 1 + + + + + RR5 + Enable or disable RR[5] register + 5 + 5 + + + Disabled + Disable RR[5] register + 0 + + + Enabled + Enable RR[5] register + 1 + + + + + RR6 + Enable or disable RR[6] register + 6 + 6 + + + Disabled + Disable RR[6] register + 0 + + + Enabled + Enable RR[6] register + 1 + + + + + RR7 + Enable or disable RR[7] register + 7 + 7 + + + Disabled + Disable RR[7] register + 0 + + + Enabled + Enable RR[7] register + 1 + + + + + + + CONFIG + Configuration register + 0x50C + read-write + 0x00000001 + + + SLEEP + Configure the watchdog to either be paused, or kept running, while the CPU is sleeping + 0 + 0 + + + Pause + Pause watchdog while the CPU is sleeping + 0 + + + Run + Keep the watchdog running while the CPU is sleeping + 1 + + + + + HALT + Configure the watchdog to either be paused, or kept running, while the CPU is halted by the debugger + 3 + 3 + + + Pause + Pause watchdog while the CPU is halted by the debugger + 0 + + + Run + Keep the watchdog running while the CPU is halted by the debugger + 1 + + + + + + + 0x8 + 0x4 + RR[%s] + Description collection[n]: Reload request n + 0x600 + write-only + + + RR + Reload request register + 0 + 31 + + + Reload + Value to request a reload of the watchdog timer + 0x6E524635 + + + + + + + + + RTC1 + Real time counter 1 + 0x40011000 + + RTC1 + 17 + + + + QDEC + Quadrature Decoder + 0x40012000 + + 0 + 0x1000 + registers + + + QDEC + 18 + + QDEC + 0x20 + + + TASKS_START + Task starting the quadrature decoder + 0x000 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_STOP + Task stopping the quadrature decoder + 0x004 + write-only + + + TASKS_STOP + 0 + 0 + + + + + TASKS_READCLRACC + Read and clear ACC and ACCDBL + 0x008 + write-only + + + TASKS_READCLRACC + 0 + 0 + + + + + TASKS_RDCLRACC + Read and clear ACC + 0x00C + write-only + + + TASKS_RDCLRACC + 0 + 0 + + + + + TASKS_RDCLRDBL + Read and clear ACCDBL + 0x010 + write-only + + + TASKS_RDCLRDBL + 0 + 0 + + + + + EVENTS_SAMPLERDY + Event being generated for every new sample value written to the SAMPLE register + 0x100 + read-write + + + EVENTS_SAMPLERDY + 0 + 0 + + + + + EVENTS_REPORTRDY + Non-null report ready + 0x104 + read-write + + + EVENTS_REPORTRDY + 0 + 0 + + + + + EVENTS_ACCOF + ACC or ACCDBL register overflow + 0x108 + read-write + + + EVENTS_ACCOF + 0 + 0 + + + + + EVENTS_DBLRDY + Double displacement(s) detected + 0x10C + read-write + + + EVENTS_DBLRDY + 0 + 0 + + + + + EVENTS_STOPPED + QDEC has been stopped + 0x110 + read-write + + + EVENTS_STOPPED + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + REPORTRDY_READCLRACC + Shortcut between REPORTRDY event and READCLRACC task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + SAMPLERDY_STOP + Shortcut between SAMPLERDY event and STOP task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + REPORTRDY_RDCLRACC + Shortcut between REPORTRDY event and RDCLRACC task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + REPORTRDY_STOP + Shortcut between REPORTRDY event and STOP task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DBLRDY_RDCLRDBL + Shortcut between DBLRDY event and RDCLRDBL task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DBLRDY_STOP + Shortcut between DBLRDY event and STOP task + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + SAMPLERDY_READCLRACC + Shortcut between SAMPLERDY event and READCLRACC task + 6 + 6 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + SAMPLERDY + Write '1' to enable interrupt for SAMPLERDY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REPORTRDY + Write '1' to enable interrupt for REPORTRDY event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ACCOF + Write '1' to enable interrupt for ACCOF event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DBLRDY + Write '1' to enable interrupt for DBLRDY event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STOPPED + Write '1' to enable interrupt for STOPPED event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + SAMPLERDY + Write '1' to disable interrupt for SAMPLERDY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REPORTRDY + Write '1' to disable interrupt for REPORTRDY event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ACCOF + Write '1' to disable interrupt for ACCOF event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DBLRDY + Write '1' to disable interrupt for DBLRDY event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STOPPED + Write '1' to disable interrupt for STOPPED event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + Enable the quadrature decoder + 0x500 + read-write + + + ENABLE + Enable or disable the quadrature decoder + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + LEDPOL + LED output pin polarity + 0x504 + read-write + + + LEDPOL + LED output pin polarity + 0 + 0 + + + ActiveLow + Led active on output pin low + 0 + + + ActiveHigh + Led active on output pin high + 1 + + + + + + + SAMPLEPER + Sample period + 0x508 + read-write + + + SAMPLEPER + Sample period. The SAMPLE register will be updated for every new sample + 0 + 3 + + + 128us + 128 us + 0 + + + 256us + 256 us + 1 + + + 512us + 512 us + 2 + + + 1024us + 1024 us + 3 + + + 2048us + 2048 us + 4 + + + 4096us + 4096 us + 5 + + + 8192us + 8192 us + 6 + + + 16384us + 16384 us + 7 + + + 32ms + 32768 us + 8 + + + 65ms + 65536 us + 9 + + + 131ms + 131072 us + 10 + + + + + + + SAMPLE + Motion sample value + 0x50C + read-only + int32_t + + + SAMPLE + Last motion sample + 0 + 31 + + + + + REPORTPER + Number of samples to be taken before REPORTRDY and DBLRDY events can be generated + 0x510 + read-write + + + REPORTPER + Specifies the number of samples to be accumulated in the ACC register before the REPORTRDY and DBLRDY events can be generated + 0 + 3 + + + 10Smpl + 10 samples / report + 0 + + + 40Smpl + 40 samples / report + 1 + + + 80Smpl + 80 samples / report + 2 + + + 120Smpl + 120 samples / report + 3 + + + 160Smpl + 160 samples / report + 4 + + + 200Smpl + 200 samples / report + 5 + + + 240Smpl + 240 samples / report + 6 + + + 280Smpl + 280 samples / report + 7 + + + 1Smpl + 1 sample / report + 8 + + + + + + + ACC + Register accumulating the valid transitions + 0x514 + read-only + int32_t + + + ACC + Register accumulating all valid samples (not double transition) read from the SAMPLE register + 0 + 31 + + + + + ACCREAD + Snapshot of the ACC register, updated by the READCLRACC or RDCLRACC task + 0x518 + read-only + int32_t + + + ACCREAD + Snapshot of the ACC register. + 0 + 31 + + + + + PSEL + Unspecified + QDEC_PSEL + 0x51C + + LED + Pin select for LED signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + A + Pin select for A signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + B + Pin select for B signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + DBFEN + Enable input debounce filters + 0x528 + read-write + + + DBFEN + Enable input debounce filters + 0 + 0 + + + Disabled + Debounce input filters disabled + 0 + + + Enabled + Debounce input filters enabled + 1 + + + + + + + LEDPRE + Time period the LED is switched ON prior to sampling + 0x540 + read-write + 0x00000010 + + + LEDPRE + Period in us the LED is switched on prior to sampling + 0 + 8 + + + + + ACCDBL + Register accumulating the number of detected double transitions + 0x544 + read-only + + + ACCDBL + Register accumulating the number of detected double or illegal transitions. ( SAMPLE = 2 ). + 0 + 3 + + + + + ACCDBLREAD + Snapshot of the ACCDBL, updated by the READCLRACC or RDCLRDBL task + 0x548 + read-only + + + ACCDBLREAD + Snapshot of the ACCDBL register. This field is updated when the READCLRACC or RDCLRDBL task is triggered. + 0 + 3 + + + + + + + COMP + Comparator + 0x40013000 + + 0 + 0x1000 + registers + + + COMP_LPCOMP + 19 + + COMP + 0x20 + + + TASKS_START + Start comparator + 0x000 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_STOP + Stop comparator + 0x004 + write-only + + + TASKS_STOP + 0 + 0 + + + + + TASKS_SAMPLE + Sample comparator value + 0x008 + write-only + + + TASKS_SAMPLE + 0 + 0 + + + + + EVENTS_READY + COMP is ready and output is valid + 0x100 + read-write + + + EVENTS_READY + 0 + 0 + + + + + EVENTS_DOWN + Downward crossing + 0x104 + read-write + + + EVENTS_DOWN + 0 + 0 + + + + + EVENTS_UP + Upward crossing + 0x108 + read-write + + + EVENTS_UP + 0 + 0 + + + + + EVENTS_CROSS + Downward or upward crossing + 0x10C + read-write + + + EVENTS_CROSS + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + READY_SAMPLE + Shortcut between READY event and SAMPLE task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + READY_STOP + Shortcut between READY event and STOP task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DOWN_STOP + Shortcut between DOWN event and STOP task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + UP_STOP + Shortcut between UP event and STOP task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + CROSS_STOP + Shortcut between CROSS event and STOP task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + READY + Enable or disable interrupt for READY event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + DOWN + Enable or disable interrupt for DOWN event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + UP + Enable or disable interrupt for UP event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CROSS + Enable or disable interrupt for CROSS event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to enable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DOWN + Write '1' to enable interrupt for DOWN event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + UP + Write '1' to enable interrupt for UP event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CROSS + Write '1' to enable interrupt for CROSS event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to disable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DOWN + Write '1' to disable interrupt for DOWN event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + UP + Write '1' to disable interrupt for UP event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CROSS + Write '1' to disable interrupt for CROSS event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + RESULT + Compare result + 0x400 + read-only + + + RESULT + Result of last compare. Decision point SAMPLE task. + 0 + 0 + + + Below + Input voltage is below the threshold (VIN+ &lt; VIN-) + 0 + + + Above + Input voltage is above the threshold (VIN+ &gt; VIN-) + 1 + + + + + + + ENABLE + COMP enable + 0x500 + read-write + + + ENABLE + Enable or disable COMP + 0 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 2 + + + + + + + PSEL + Pin select + 0x504 + read-write + + + PSEL + Analog pin select + 0 + 2 + + + AnalogInput0 + AIN0 selected as analog input + 0 + + + AnalogInput1 + AIN1 selected as analog input + 1 + + + AnalogInput2 + AIN2 selected as analog input + 2 + + + AnalogInput3 + AIN3 selected as analog input + 3 + + + AnalogInput4 + AIN4 selected as analog input + 4 + + + AnalogInput5 + AIN5 selected as analog input + 5 + + + AnalogInput6 + AIN6 selected as analog input + 6 + + + AnalogInput7 + AIN7 selected as analog input + 7 + + + + + + + REFSEL + Reference source select for single-ended mode + 0x508 + read-write + 0x00000004 + + + REFSEL + Reference select + 0 + 2 + + + Int1V2 + VREF = internal 1.2 V reference (VDD &gt;= 1.7 V) + 0 + + + Int1V8 + VREF = internal 1.8 V reference (VDD &gt;= VREF + 0.2 V) + 1 + + + Int2V4 + VREF = internal 2.4 V reference (VDD &gt;= VREF + 0.2 V) + 2 + + + VDD + VREF = VDD + 4 + + + ARef + VREF = AREF (VDD &gt;= VREF &gt;= AREFMIN) + 5 + + + + + + + EXTREFSEL + External reference select + 0x50C + read-write + + + EXTREFSEL + External analog reference select + 0 + 2 + + + AnalogReference0 + Use AIN0 as external analog reference + 0 + + + AnalogReference1 + Use AIN1 as external analog reference + 1 + + + AnalogReference2 + Use AIN2 as external analog reference + 2 + + + AnalogReference3 + Use AIN3 as external analog reference + 3 + + + AnalogReference4 + Use AIN4 as external analog reference + 4 + + + AnalogReference5 + Use AIN5 as external analog reference + 5 + + + AnalogReference6 + Use AIN6 as external analog reference + 6 + + + AnalogReference7 + Use AIN7 as external analog reference + 7 + + + + + + + TH + Threshold configuration for hysteresis unit + 0x530 + read-write + 0x00000000 + + + THDOWN + VDOWN = (THDOWN+1)/64*VREF + 0 + 5 + + + THUP + VUP = (THUP+1)/64*VREF + 8 + 13 + + + + + MODE + Mode configuration + 0x534 + read-write + + + SP + Speed and power modes + 0 + 1 + + + Low + Low-power mode + 0 + + + Normal + Normal mode + 1 + + + High + High-speed mode + 2 + + + + + MAIN + Main operation modes + 8 + 8 + + + SE + Single-ended mode + 0 + + + Diff + Differential mode + 1 + + + + + + + HYST + Comparator hysteresis enable + 0x538 + read-write + + + HYST + Comparator hysteresis + 0 + 0 + + + NoHyst + Comparator hysteresis disabled + 0 + + + Hyst50mV + Comparator hysteresis enabled + 1 + + + + + + + + + LPCOMP + Low Power Comparator + 0x40013000 + COMP + + 0 + 0x1000 + registers + + + COMP_LPCOMP + 19 + + LPCOMP + 0x20 + + + TASKS_START + Start comparator + 0x000 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_STOP + Stop comparator + 0x004 + write-only + + + TASKS_STOP + 0 + 0 + + + + + TASKS_SAMPLE + Sample comparator value + 0x008 + write-only + + + TASKS_SAMPLE + 0 + 0 + + + + + EVENTS_READY + LPCOMP is ready and output is valid + 0x100 + read-write + + + EVENTS_READY + 0 + 0 + + + + + EVENTS_DOWN + Downward crossing + 0x104 + read-write + + + EVENTS_DOWN + 0 + 0 + + + + + EVENTS_UP + Upward crossing + 0x108 + read-write + + + EVENTS_UP + 0 + 0 + + + + + EVENTS_CROSS + Downward or upward crossing + 0x10C + read-write + + + EVENTS_CROSS + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + READY_SAMPLE + Shortcut between READY event and SAMPLE task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + READY_STOP + Shortcut between READY event and STOP task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DOWN_STOP + Shortcut between DOWN event and STOP task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + UP_STOP + Shortcut between UP event and STOP task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + CROSS_STOP + Shortcut between CROSS event and STOP task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to enable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DOWN + Write '1' to enable interrupt for DOWN event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + UP + Write '1' to enable interrupt for UP event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CROSS + Write '1' to enable interrupt for CROSS event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to disable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DOWN + Write '1' to disable interrupt for DOWN event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + UP + Write '1' to disable interrupt for UP event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CROSS + Write '1' to disable interrupt for CROSS event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + RESULT + Compare result + 0x400 + read-only + + + RESULT + Result of last compare. Decision point SAMPLE task. + 0 + 0 + + + Below + Input voltage is below the reference threshold (VIN+ &lt; VIN-). + 0 + + + Above + Input voltage is above the reference threshold (VIN+ &gt; VIN-). + 1 + + + + + + + ENABLE + Enable LPCOMP + 0x500 + read-write + + + ENABLE + Enable or disable LPCOMP + 0 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + PSEL + Input pin select + 0x504 + read-write + + + PSEL + Analog pin select + 0 + 2 + + + AnalogInput0 + AIN0 selected as analog input + 0 + + + AnalogInput1 + AIN1 selected as analog input + 1 + + + AnalogInput2 + AIN2 selected as analog input + 2 + + + AnalogInput3 + AIN3 selected as analog input + 3 + + + AnalogInput4 + AIN4 selected as analog input + 4 + + + AnalogInput5 + AIN5 selected as analog input + 5 + + + AnalogInput6 + AIN6 selected as analog input + 6 + + + AnalogInput7 + AIN7 selected as analog input + 7 + + + + + + + REFSEL + Reference select + 0x508 + read-write + 0x00000004 + + + REFSEL + Reference select + 0 + 3 + + + Ref1_8Vdd + VDD * 1/8 selected as reference + 0 + + + Ref2_8Vdd + VDD * 2/8 selected as reference + 1 + + + Ref3_8Vdd + VDD * 3/8 selected as reference + 2 + + + Ref4_8Vdd + VDD * 4/8 selected as reference + 3 + + + Ref5_8Vdd + VDD * 5/8 selected as reference + 4 + + + Ref6_8Vdd + VDD * 6/8 selected as reference + 5 + + + Ref7_8Vdd + VDD * 7/8 selected as reference + 6 + + + ARef + External analog reference selected + 7 + + + Ref1_16Vdd + VDD * 1/16 selected as reference + 8 + + + Ref3_16Vdd + VDD * 3/16 selected as reference + 9 + + + Ref5_16Vdd + VDD * 5/16 selected as reference + 10 + + + Ref7_16Vdd + VDD * 7/16 selected as reference + 11 + + + Ref9_16Vdd + VDD * 9/16 selected as reference + 12 + + + Ref11_16Vdd + VDD * 11/16 selected as reference + 13 + + + Ref13_16Vdd + VDD * 13/16 selected as reference + 14 + + + Ref15_16Vdd + VDD * 15/16 selected as reference + 15 + + + + + + + EXTREFSEL + External reference select + 0x50C + read-write + + + EXTREFSEL + External analog reference select + 0 + 0 + + + AnalogReference0 + Use AIN0 as external analog reference + 0 + + + AnalogReference1 + Use AIN1 as external analog reference + 1 + + + + + + + ANADETECT + Analog detect configuration + 0x520 + read-write + + + ANADETECT + Analog detect configuration + 0 + 1 + + + Cross + Generate ANADETECT on crossing, both upward crossing and downward crossing + 0 + + + Up + Generate ANADETECT on upward crossing only + 1 + + + Down + Generate ANADETECT on downward crossing only + 2 + + + + + + + HYST + Comparator hysteresis enable + 0x538 + read-write + + + HYST + Comparator hysteresis enable + 0 + 0 + + + Disabled + Comparator hysteresis disabled + 0 + + + Enabled + Comparator hysteresis enabled + 1 + + + + + + + + + EGU0 + Event Generator Unit 0 + 0x40014000 + EGU + + 0 + 0x1000 + registers + + + SWI0_EGU0 + 20 + + EGU + 0x20 + + + 0x10 + 0x4 + TASKS_TRIGGER[%s] + Description collection[n]: Trigger n for triggering the corresponding TRIGGERED[n] event + 0x000 + write-only + + + TASKS_TRIGGER + 0 + 0 + + + + + 0x10 + 0x4 + EVENTS_TRIGGERED[%s] + Description collection[n]: Event number n generated by triggering the corresponding TRIGGER[n] task + 0x100 + read-write + + + EVENTS_TRIGGERED + 0 + 0 + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + TRIGGERED0 + Enable or disable interrupt for TRIGGERED[0] event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED1 + Enable or disable interrupt for TRIGGERED[1] event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED2 + Enable or disable interrupt for TRIGGERED[2] event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED3 + Enable or disable interrupt for TRIGGERED[3] event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED4 + Enable or disable interrupt for TRIGGERED[4] event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED5 + Enable or disable interrupt for TRIGGERED[5] event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED6 + Enable or disable interrupt for TRIGGERED[6] event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED7 + Enable or disable interrupt for TRIGGERED[7] event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED8 + Enable or disable interrupt for TRIGGERED[8] event + 8 + 8 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED9 + Enable or disable interrupt for TRIGGERED[9] event + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED10 + Enable or disable interrupt for TRIGGERED[10] event + 10 + 10 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED11 + Enable or disable interrupt for TRIGGERED[11] event + 11 + 11 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED12 + Enable or disable interrupt for TRIGGERED[12] event + 12 + 12 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED13 + Enable or disable interrupt for TRIGGERED[13] event + 13 + 13 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED14 + Enable or disable interrupt for TRIGGERED[14] event + 14 + 14 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED15 + Enable or disable interrupt for TRIGGERED[15] event + 15 + 15 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + TRIGGERED0 + Write '1' to enable interrupt for TRIGGERED[0] event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED1 + Write '1' to enable interrupt for TRIGGERED[1] event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED2 + Write '1' to enable interrupt for TRIGGERED[2] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED3 + Write '1' to enable interrupt for TRIGGERED[3] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED4 + Write '1' to enable interrupt for TRIGGERED[4] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED5 + Write '1' to enable interrupt for TRIGGERED[5] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED6 + Write '1' to enable interrupt for TRIGGERED[6] event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED7 + Write '1' to enable interrupt for TRIGGERED[7] event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED8 + Write '1' to enable interrupt for TRIGGERED[8] event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED9 + Write '1' to enable interrupt for TRIGGERED[9] event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED10 + Write '1' to enable interrupt for TRIGGERED[10] event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED11 + Write '1' to enable interrupt for TRIGGERED[11] event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED12 + Write '1' to enable interrupt for TRIGGERED[12] event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED13 + Write '1' to enable interrupt for TRIGGERED[13] event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED14 + Write '1' to enable interrupt for TRIGGERED[14] event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED15 + Write '1' to enable interrupt for TRIGGERED[15] event + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + TRIGGERED0 + Write '1' to disable interrupt for TRIGGERED[0] event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED1 + Write '1' to disable interrupt for TRIGGERED[1] event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED2 + Write '1' to disable interrupt for TRIGGERED[2] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED3 + Write '1' to disable interrupt for TRIGGERED[3] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED4 + Write '1' to disable interrupt for TRIGGERED[4] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED5 + Write '1' to disable interrupt for TRIGGERED[5] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED6 + Write '1' to disable interrupt for TRIGGERED[6] event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED7 + Write '1' to disable interrupt for TRIGGERED[7] event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED8 + Write '1' to disable interrupt for TRIGGERED[8] event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED9 + Write '1' to disable interrupt for TRIGGERED[9] event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED10 + Write '1' to disable interrupt for TRIGGERED[10] event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED11 + Write '1' to disable interrupt for TRIGGERED[11] event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED12 + Write '1' to disable interrupt for TRIGGERED[12] event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED13 + Write '1' to disable interrupt for TRIGGERED[13] event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED14 + Write '1' to disable interrupt for TRIGGERED[14] event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED15 + Write '1' to disable interrupt for TRIGGERED[15] event + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + + + SWI0 + Software interrupt 0 + 0x40014000 + EGU0 + SWI + + 0 + 0x1000 + registers + + + SWI0_EGU0 + 20 + + SWI + 0x20 + + + UNUSED + Unused. + 0x000 + 0x00000000 + read-only + + + + + EGU1 + Event Generator Unit 1 + 0x40015000 + + SWI1_EGU1 + 21 + + + + SWI1 + Software interrupt 1 + 0x40015000 + EGU1 + + SWI1_EGU1 + 21 + + + + EGU2 + Event Generator Unit 2 + 0x40016000 + + SWI2_EGU2 + 22 + + + + SWI2 + Software interrupt 2 + 0x40016000 + EGU2 + + SWI2_EGU2 + 22 + + + + EGU3 + Event Generator Unit 3 + 0x40017000 + + SWI3_EGU3 + 23 + + + + SWI3 + Software interrupt 3 + 0x40017000 + EGU3 + + SWI3_EGU3 + 23 + + + + EGU4 + Event Generator Unit 4 + 0x40018000 + + SWI4_EGU4 + 24 + + + + SWI4 + Software interrupt 4 + 0x40018000 + EGU4 + + SWI4_EGU4 + 24 + + + + EGU5 + Event Generator Unit 5 + 0x40019000 + + SWI5_EGU5 + 25 + + + + SWI5 + Software interrupt 5 + 0x40019000 + EGU5 + + SWI5_EGU5 + 25 + + + + TIMER3 + Timer/Counter 3 + 0x4001A000 + + TIMER3 + 26 + + + + TIMER4 + Timer/Counter 4 + 0x4001B000 + + TIMER4 + 27 + + + + PWM0 + Pulse width modulation unit 0 + 0x4001C000 + PWM + + 0 + 0x1000 + registers + + + PWM0 + 28 + + PWM + 0x20 + + + TASKS_STOP + Stops PWM pulse generation on all channels at the end of current PWM period, and stops sequence playback + 0x004 + write-only + + + TASKS_STOP + 0 + 0 + + + + + 0x2 + 0x4 + TASKS_SEQSTART[%s] + Description collection[n]: Loads the first PWM value on all enabled channels from sequence n, and starts playing that sequence at the rate defined in SEQ[n]REFRESH and/or DECODER.MODE. Causes PWM generation to start if not running. + 0x008 + write-only + + + TASKS_SEQSTART + 0 + 0 + + + + + TASKS_NEXTSTEP + Steps by one value in the current sequence on all enabled channels if DECODER.MODE=NextStep. Does not cause PWM generation to start if not running. + 0x010 + write-only + + + TASKS_NEXTSTEP + 0 + 0 + + + + + EVENTS_STOPPED + Response to STOP task, emitted when PWM pulses are no longer generated + 0x104 + read-write + + + EVENTS_STOPPED + 0 + 0 + + + + + 0x2 + 0x4 + EVENTS_SEQSTARTED[%s] + Description collection[n]: First PWM period started on sequence n + 0x108 + read-write + + + EVENTS_SEQSTARTED + 0 + 0 + + + + + 0x2 + 0x4 + EVENTS_SEQEND[%s] + Description collection[n]: Emitted at end of every sequence n, when last value from RAM has been applied to wave counter + 0x110 + read-write + + + EVENTS_SEQEND + 0 + 0 + + + + + EVENTS_PWMPERIODEND + Emitted at the end of each PWM period + 0x118 + read-write + + + EVENTS_PWMPERIODEND + 0 + 0 + + + + + EVENTS_LOOPSDONE + Concatenated sequences have been played the amount of times defined in LOOP.CNT + 0x11C + read-write + + + EVENTS_LOOPSDONE + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + SEQEND0_STOP + Shortcut between SEQEND[0] event and STOP task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + SEQEND1_STOP + Shortcut between SEQEND[1] event and STOP task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LOOPSDONE_SEQSTART0 + Shortcut between LOOPSDONE event and SEQSTART[0] task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LOOPSDONE_SEQSTART1 + Shortcut between LOOPSDONE event and SEQSTART[1] task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LOOPSDONE_STOP + Shortcut between LOOPSDONE event and STOP task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STOPPED + Enable or disable interrupt for STOPPED event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SEQSTARTED0 + Enable or disable interrupt for SEQSTARTED[0] event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SEQSTARTED1 + Enable or disable interrupt for SEQSTARTED[1] event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SEQEND0 + Enable or disable interrupt for SEQEND[0] event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SEQEND1 + Enable or disable interrupt for SEQEND[1] event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PWMPERIODEND + Enable or disable interrupt for PWMPERIODEND event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + LOOPSDONE + Enable or disable interrupt for LOOPSDONE event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to enable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SEQSTARTED0 + Write '1' to enable interrupt for SEQSTARTED[0] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SEQSTARTED1 + Write '1' to enable interrupt for SEQSTARTED[1] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SEQEND0 + Write '1' to enable interrupt for SEQEND[0] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SEQEND1 + Write '1' to enable interrupt for SEQEND[1] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PWMPERIODEND + Write '1' to enable interrupt for PWMPERIODEND event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + LOOPSDONE + Write '1' to enable interrupt for LOOPSDONE event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to disable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SEQSTARTED0 + Write '1' to disable interrupt for SEQSTARTED[0] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SEQSTARTED1 + Write '1' to disable interrupt for SEQSTARTED[1] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SEQEND0 + Write '1' to disable interrupt for SEQEND[0] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SEQEND1 + Write '1' to disable interrupt for SEQEND[1] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PWMPERIODEND + Write '1' to disable interrupt for PWMPERIODEND event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + LOOPSDONE + Write '1' to disable interrupt for LOOPSDONE event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + PWM module enable register + 0x500 + read-write + 0x00000000 + + + ENABLE + Enable or disable PWM module + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enable + 1 + + + + + + + MODE + Selects operating mode of the wave counter + 0x504 + read-write + 0x00000000 + + + UPDOWN + Selects up mode or up-and-down mode for the counter + 0 + 0 + + + Up + Up counter, edge-aligned PWM duty cycle + 0 + + + UpAndDown + Up and down counter, center-aligned PWM duty cycle + 1 + + + + + + + COUNTERTOP + Value up to which the pulse generator counter counts + 0x508 + read-write + 0x000003FF + + + COUNTERTOP + Value up to which the pulse generator counter counts. This register is ignored when DECODER.MODE=WaveForm and only values from RAM are used. + 0 + 14 + + + + + PRESCALER + Configuration for PWM_CLK + 0x50C + read-write + 0x00000000 + + + PRESCALER + Prescaler of PWM_CLK + 0 + 2 + + + DIV_1 + Divide by 1 (16 MHz) + 0 + + + DIV_2 + Divide by 2 (8 MHz) + 1 + + + DIV_4 + Divide by 4 (4 MHz) + 2 + + + DIV_8 + Divide by 8 (2 MHz) + 3 + + + DIV_16 + Divide by 16 (1 MHz) + 4 + + + DIV_32 + Divide by 32 (500 kHz) + 5 + + + DIV_64 + Divide by 64 (250 kHz) + 6 + + + DIV_128 + Divide by 128 (125 kHz) + 7 + + + + + + + DECODER + Configuration of the decoder + 0x510 + read-write + 0x00000000 + + + LOAD + How a sequence is read from RAM and spread to the compare register + 0 + 1 + + + Common + 1st half word (16-bit) used in all PWM channels 0..3 + 0 + + + Grouped + 1st half word (16-bit) used in channel 0..1; 2nd word in channel 2..3 + 1 + + + Individual + 1st half word (16-bit) in ch.0; 2nd in ch.1; ...; 4th in ch.3 + 2 + + + WaveForm + 1st half word (16-bit) in ch.0; 2nd in ch.1; ...; 4th in COUNTERTOP + 3 + + + + + MODE + Selects source for advancing the active sequence + 8 + 8 + + + RefreshCount + SEQ[n].REFRESH is used to determine loading internal compare registers + 0 + + + NextStep + NEXTSTEP task causes a new value to be loaded to internal compare registers + 1 + + + + + + + LOOP + Number of playbacks of a loop + 0x514 + read-write + 0x00000000 + + + CNT + Number of playbacks of pattern cycles + 0 + 15 + + + Disabled + Looping disabled (stop at the end of the sequence) + 0 + + + + + + + 2 + 0x020 + SEQ[%s] + Unspecified + PWM_SEQ + 0x520 + + PTR + Description cluster[n]: Beginning address in RAM of this sequence + 0x000 + read-write + 0x00000000 + + + PTR + Beginning address in RAM of this sequence + 0 + 31 + + + + + CNT + Description cluster[n]: Number of values (duty cycles) in this sequence + 0x004 + read-write + 0x00000000 + + + CNT + Number of values (duty cycles) in this sequence + 0 + 14 + + + Disabled + Sequence is disabled, and shall not be started as it is empty + 0 + + + + + + + REFRESH + Description cluster[n]: Number of additional PWM periods between samples loaded into compare register + 0x008 + read-write + 0x00000001 + + + CNT + Number of additional PWM periods between samples loaded into compare register (load every REFRESH.CNT+1 PWM periods) + 0 + 23 + + + Continuous + Update every PWM period + 0 + + + + + + + ENDDELAY + Description cluster[n]: Time added after the sequence + 0x00C + read-write + 0x00000000 + + + CNT + Time added after the sequence in PWM periods + 0 + 23 + + + + + + PSEL + Unspecified + PWM_PSEL + 0x560 + + 0x4 + 0x4 + OUT[%s] + Description collection[n]: Output pin select for PWM channel n + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + + + PDM + Pulse Density Modulation (Digital Microphone) Interface + 0x4001D000 + + 0 + 0x1000 + registers + + + PDM + 29 + + PDM + 0x20 + + + TASKS_START + Starts continuous PDM transfer + 0x000 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_STOP + Stops PDM transfer + 0x004 + write-only + + + TASKS_STOP + 0 + 0 + + + + + EVENTS_STARTED + PDM transfer has started + 0x100 + read-write + + + EVENTS_STARTED + 0 + 0 + + + + + EVENTS_STOPPED + PDM transfer has finished + 0x104 + read-write + + + EVENTS_STOPPED + 0 + 0 + + + + + EVENTS_END + The PDM has written the last sample specified by SAMPLE.MAXCNT (or the last sample after a STOP task has been received) to Data RAM + 0x108 + read-write + + + EVENTS_END + 0 + 0 + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STARTED + Enable or disable interrupt for STARTED event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STOPPED + Enable or disable interrupt for STOPPED event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + END + Enable or disable interrupt for END event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STARTED + Write '1' to enable interrupt for STARTED event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STOPPED + Write '1' to enable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + END + Write '1' to enable interrupt for END event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STARTED + Write '1' to disable interrupt for STARTED event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STOPPED + Write '1' to disable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + END + Write '1' to disable interrupt for END event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + PDM module enable register + 0x500 + read-write + 0x00000000 + + + ENABLE + Enable or disable PDM module + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + PDMCLKCTRL + PDM clock generator control + 0x504 + read-write + 0x08400000 + + + FREQ + PDM_CLK frequency + 0 + 31 + + + 1000K + PDM_CLK = 32 MHz / 32 = 1.000 MHz + 0x08000000 + + + Default + PDM_CLK = 32 MHz / 31 = 1.032 MHz. Nominal clock for RATIO=Ratio64. + 0x08400000 + + + 1067K + PDM_CLK = 32 MHz / 30 = 1.067 MHz + 0x08800000 + + + 1231K + PDM_CLK = 32 MHz / 26 = 1.231 MHz + 0x09800000 + + + 1280K + PDM_CLK = 32 MHz / 25 = 1.280 MHz. Nominal clock for RATIO=Ratio80. + 0x0A000000 + + + 1333K + PDM_CLK = 32 MHz / 24 = 1.333 MHz + 0x0A800000 + + + + + + + MODE + Defines the routing of the connected PDM microphones' signals + 0x508 + read-write + 0x00000000 + + + OPERATION + Mono or stereo operation + 0 + 0 + + + Stereo + Sample and store one pair (Left + Right) of 16bit samples per RAM word R=[31:16]; L=[15:0] + 0 + + + Mono + Sample and store two successive Left samples (16 bit each) per RAM word L1=[31:16]; L0=[15:0] + 1 + + + + + EDGE + Defines on which PDM_CLK edge Left (or mono) is sampled + 1 + 1 + + + LeftFalling + Left (or mono) is sampled on falling edge of PDM_CLK + 0 + + + LeftRising + Left (or mono) is sampled on rising edge of PDM_CLK + 1 + + + + + + + GAINL + Left output gain adjustment + 0x518 + read-write + 0x00000028 + + + GAINL + Left output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters) 0x00 -20 dB gain adjust 0x01 -19.5 dB gain adjust (...) 0x27 -0.5 dB gain adjust 0x28 0 dB gain adjust 0x29 +0.5 dB gain adjust (...) 0x4F +19.5 dB gain adjust 0x50 +20 dB gain adjust + 0 + 6 + + + MinGain + -20dB gain adjustment (minimum) + 0x00 + + + DefaultGain + 0dB gain adjustment + 0x28 + + + MaxGain + +20dB gain adjustment (maximum) + 0x50 + + + + + + + GAINR + Right output gain adjustment + 0x51C + read-write + 0x00000028 + + + GAINR + Right output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters) + 0 + 6 + + + MinGain + -20dB gain adjustment (minimum) + 0x00 + + + DefaultGain + 0dB gain adjustment + 0x28 + + + MaxGain + +20dB gain adjustment (maximum) + 0x50 + + + + + + + RATIO + Selects the ratio between PDM_CLK and output sample rate. Change PDMCLKCTRL accordingly. + 0x520 + read-write + 0x00000000 + + + RATIO + Selects the ratio between PDM_CLK and output sample rate + 0 + 0 + + + Ratio64 + Ratio of 64 + 0 + + + Ratio80 + Ratio of 80 + 1 + + + + + + + PSEL + Unspecified + PDM_PSEL + 0x540 + + CLK + Pin number configuration for PDM CLK signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + DIN + Pin number configuration for PDM DIN signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + SAMPLE + Unspecified + PDM_SAMPLE + 0x560 + + PTR + RAM address pointer to write samples to with EasyDMA + 0x000 + read-write + + + SAMPLEPTR + Address to write PDM samples to over DMA + 0 + 31 + + + + + MAXCNT + Number of samples to allocate memory for in EasyDMA mode + 0x004 + read-write + + + BUFFSIZE + Length of DMA RAM allocation in number of samples + 0 + 14 + + + + + + + + ACL + Access control lists + 0x4001E000 + + 0 + 0x1000 + registers + + ACL + 0x20 + + + 8 + 0x010 + ACL[%s] + Unspecified + ACL_ACL + 0x800 + + ADDR + Description cluster[n]: Configure the word-aligned start address of region n to protect + 0x000 + read-write + 0x00000000 + + + ADDR + Valid word-aligned start address of region n to protect. Address must point to a flash page boundary. + 0 + 31 + + + + + SIZE + Description cluster[n]: Size of region to protect counting from address ACL[n].ADDR. Write '0' as no effect. + 0x004 + read-write + 0x00000000 + + + SIZE + Size of flash region n in bytes. Must be a multiple of the flash page size, and the maximum region size is limited to 512kB. + 0 + 31 + + + + + PERM + Description cluster[n]: Access permissions for region n as defined by start address ACL[n].ADDR and size ACL[n].SIZE + 0x008 + read-write + 0x00000000 + + + WRITE + Configure write and erase permissions for region n. Write '0' has no effect. + 1 + 1 + + + Enable + Allow write and erase instructions to region n + 0 + + + Disable + Block write and erase instructions to region n + 1 + + + + + READ + Configure read permissions for region n. Write '0' has no effect. + 2 + 2 + + + Enable + Allow read instructions to region n + 0 + + + Disable + Block read instructions to region n + 1 + + + + + + + UNUSED0 + Unspecified + 0x00C + read-write + + + + + + NVMC + Non Volatile Memory Controller + 0x4001E000 + ACL + + 0 + 0x1000 + registers + + NVMC + 0x20 + + + READY + Ready flag + 0x400 + read-only + 0x00000001 + + + READY + NVMC is ready or busy + 0 + 0 + + + Busy + NVMC is busy (on-going write or erase operation) + 0 + + + Ready + NVMC is ready + 1 + + + + + + + READYNEXT + Ready flag + 0x408 + read-only + + + READYNEXT + NVMC can accept a new write operation + 0 + 0 + + + Busy + NVMC cannot accept any write operation + 0 + + + Ready + NVMC is ready + 1 + + + + + + + CONFIG + Configuration register + 0x504 + read-write + + + WEN + Program memory access mode. It is strongly recommended to only activate erase and write modes when they are actively used. Enabling write or erase will invalidate the cache and keep it invalidated. + 0 + 1 + + + Ren + Read only access + 0 + + + Wen + Write enabled + 1 + + + Een + Erase enabled + 2 + + + + + + + ERASEPAGE + Register for erasing a page in code area + 0x508 + read-write + + + ERASEPAGE + Register for starting erase of a page in code area + 0 + 31 + + + + + ERASEPCR1 + Deprecated register - Register for erasing a page in code area. Equivalent to ERASEPAGE. + 0x508 + read-write + ERASEPAGE + + + ERASEPCR1 + Register for erasing a page in code area. Equivalent to ERASEPAGE. + 0 + 31 + + + + + ERASEALL + Register for erasing all non-volatile user memory + 0x50C + read-write + + + ERASEALL + Erase all non-volatile memory including UICR registers. Note that the erase must be enabled using CONFIG.WEN before the non-volatile memory can be erased. + 0 + 0 + + + NoOperation + No operation + 0 + + + Erase + Start chip erase + 1 + + + + + + + ERASEPCR0 + Deprecated register - Register for erasing a page in code area. Equivalent to ERASEPAGE. + 0x510 + read-write + + + ERASEPCR0 + Register for starting erase of a page in code area. Equivalent to ERASEPAGE. + 0 + 31 + + + + + ERASEUICR + Register for erasing user information configuration registers + 0x514 + read-write + + + ERASEUICR + Register starting erase of all user information configuration registers. Note that the erase must be enabled using CONFIG.WEN before the UICR can be erased. + 0 + 0 + + + NoOperation + No operation + 0 + + + Erase + Start erase of UICR + 1 + + + + + + + ERASEPAGEPARTIAL + Register for partial erase of a page in code area + 0x518 + read-write + + + ERASEPAGEPARTIAL + Register for starting partial erase of a page in code area + 0 + 31 + + + + + ERASEPAGEPARTIALCFG + Register for partial erase configuration + 0x51C + read-write + 0x0000000A + + + DURATION + Duration of the partial erase in milliseconds + 0 + 6 + + + + + ICACHECNF + I-code cache configuration register. + 0x540 + read-write + 0x00000000 + + + CACHEEN + Cache enable + 0 + 0 + + + Disabled + Disable cache. Invalidates all cache entries. + 0 + + + Enabled + Enable cache + 1 + + + + + CACHEPROFEN + Cache profiling enable + 8 + 8 + + + Disabled + Disable cache profiling + 0 + + + Enabled + Enable cache profiling + 1 + + + + + + + IHIT + I-code cache hit counter. + 0x548 + read-write + + + HITS + Number of cache hits + 0 + 31 + + + + + IMISS + I-code cache miss counter. + 0x54C + read-write + + + MISSES + Number of cache misses + 0 + 31 + + + + + + + PPI + Programmable Peripheral Interconnect + 0x4001F000 + + 0 + 0x1000 + registers + + PPI + 0x20 + + + 6 + 0x008 + TASKS_CHG[%s] + Channel group tasks + PPI_TASKS_CHG + 0x000 + + EN + Description cluster[n]: Enable channel group n + 0x000 + write-only + + + EN + 0 + 0 + + + + + DIS + Description cluster[n]: Disable channel group n + 0x004 + write-only + + + DIS + 0 + 0 + + + + + + CHEN + Channel enable register + 0x500 + read-write + + + CH0 + Enable or disable channel 0 + 0 + 0 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH1 + Enable or disable channel 1 + 1 + 1 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH2 + Enable or disable channel 2 + 2 + 2 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH3 + Enable or disable channel 3 + 3 + 3 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH4 + Enable or disable channel 4 + 4 + 4 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH5 + Enable or disable channel 5 + 5 + 5 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH6 + Enable or disable channel 6 + 6 + 6 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH7 + Enable or disable channel 7 + 7 + 7 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH8 + Enable or disable channel 8 + 8 + 8 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH9 + Enable or disable channel 9 + 9 + 9 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH10 + Enable or disable channel 10 + 10 + 10 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH11 + Enable or disable channel 11 + 11 + 11 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH12 + Enable or disable channel 12 + 12 + 12 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH13 + Enable or disable channel 13 + 13 + 13 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH14 + Enable or disable channel 14 + 14 + 14 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH15 + Enable or disable channel 15 + 15 + 15 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH16 + Enable or disable channel 16 + 16 + 16 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH17 + Enable or disable channel 17 + 17 + 17 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH18 + Enable or disable channel 18 + 18 + 18 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH19 + Enable or disable channel 19 + 19 + 19 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH20 + Enable or disable channel 20 + 20 + 20 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH21 + Enable or disable channel 21 + 21 + 21 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH22 + Enable or disable channel 22 + 22 + 22 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH23 + Enable or disable channel 23 + 23 + 23 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH24 + Enable or disable channel 24 + 24 + 24 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH25 + Enable or disable channel 25 + 25 + 25 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH26 + Enable or disable channel 26 + 26 + 26 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH27 + Enable or disable channel 27 + 27 + 27 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH28 + Enable or disable channel 28 + 28 + 28 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH29 + Enable or disable channel 29 + 29 + 29 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH30 + Enable or disable channel 30 + 30 + 30 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH31 + Enable or disable channel 31 + 31 + 31 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + + + CHENSET + Channel enable set register + 0x504 + read-write + oneToSet + + + CH0 + Channel 0 enable set register. Writing '0' has no effect + 0 + 0 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH1 + Channel 1 enable set register. Writing '0' has no effect + 1 + 1 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH2 + Channel 2 enable set register. Writing '0' has no effect + 2 + 2 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH3 + Channel 3 enable set register. Writing '0' has no effect + 3 + 3 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH4 + Channel 4 enable set register. Writing '0' has no effect + 4 + 4 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH5 + Channel 5 enable set register. Writing '0' has no effect + 5 + 5 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH6 + Channel 6 enable set register. Writing '0' has no effect + 6 + 6 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH7 + Channel 7 enable set register. Writing '0' has no effect + 7 + 7 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH8 + Channel 8 enable set register. Writing '0' has no effect + 8 + 8 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH9 + Channel 9 enable set register. Writing '0' has no effect + 9 + 9 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH10 + Channel 10 enable set register. Writing '0' has no effect + 10 + 10 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH11 + Channel 11 enable set register. Writing '0' has no effect + 11 + 11 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH12 + Channel 12 enable set register. Writing '0' has no effect + 12 + 12 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH13 + Channel 13 enable set register. Writing '0' has no effect + 13 + 13 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH14 + Channel 14 enable set register. Writing '0' has no effect + 14 + 14 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH15 + Channel 15 enable set register. Writing '0' has no effect + 15 + 15 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH16 + Channel 16 enable set register. Writing '0' has no effect + 16 + 16 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH17 + Channel 17 enable set register. Writing '0' has no effect + 17 + 17 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH18 + Channel 18 enable set register. Writing '0' has no effect + 18 + 18 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH19 + Channel 19 enable set register. Writing '0' has no effect + 19 + 19 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH20 + Channel 20 enable set register. Writing '0' has no effect + 20 + 20 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH21 + Channel 21 enable set register. Writing '0' has no effect + 21 + 21 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH22 + Channel 22 enable set register. Writing '0' has no effect + 22 + 22 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH23 + Channel 23 enable set register. Writing '0' has no effect + 23 + 23 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH24 + Channel 24 enable set register. Writing '0' has no effect + 24 + 24 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH25 + Channel 25 enable set register. Writing '0' has no effect + 25 + 25 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH26 + Channel 26 enable set register. Writing '0' has no effect + 26 + 26 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH27 + Channel 27 enable set register. Writing '0' has no effect + 27 + 27 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH28 + Channel 28 enable set register. Writing '0' has no effect + 28 + 28 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH29 + Channel 29 enable set register. Writing '0' has no effect + 29 + 29 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH30 + Channel 30 enable set register. Writing '0' has no effect + 30 + 30 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH31 + Channel 31 enable set register. Writing '0' has no effect + 31 + 31 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + + + CHENCLR + Channel enable clear register + 0x508 + read-write + oneToClear + + + CH0 + Channel 0 enable clear register. Writing '0' has no effect + 0 + 0 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH1 + Channel 1 enable clear register. Writing '0' has no effect + 1 + 1 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH2 + Channel 2 enable clear register. Writing '0' has no effect + 2 + 2 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH3 + Channel 3 enable clear register. Writing '0' has no effect + 3 + 3 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH4 + Channel 4 enable clear register. Writing '0' has no effect + 4 + 4 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH5 + Channel 5 enable clear register. Writing '0' has no effect + 5 + 5 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH6 + Channel 6 enable clear register. Writing '0' has no effect + 6 + 6 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH7 + Channel 7 enable clear register. Writing '0' has no effect + 7 + 7 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH8 + Channel 8 enable clear register. Writing '0' has no effect + 8 + 8 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH9 + Channel 9 enable clear register. Writing '0' has no effect + 9 + 9 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH10 + Channel 10 enable clear register. Writing '0' has no effect + 10 + 10 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH11 + Channel 11 enable clear register. Writing '0' has no effect + 11 + 11 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH12 + Channel 12 enable clear register. Writing '0' has no effect + 12 + 12 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH13 + Channel 13 enable clear register. Writing '0' has no effect + 13 + 13 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH14 + Channel 14 enable clear register. Writing '0' has no effect + 14 + 14 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH15 + Channel 15 enable clear register. Writing '0' has no effect + 15 + 15 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH16 + Channel 16 enable clear register. Writing '0' has no effect + 16 + 16 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH17 + Channel 17 enable clear register. Writing '0' has no effect + 17 + 17 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH18 + Channel 18 enable clear register. Writing '0' has no effect + 18 + 18 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH19 + Channel 19 enable clear register. Writing '0' has no effect + 19 + 19 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH20 + Channel 20 enable clear register. Writing '0' has no effect + 20 + 20 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH21 + Channel 21 enable clear register. Writing '0' has no effect + 21 + 21 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH22 + Channel 22 enable clear register. Writing '0' has no effect + 22 + 22 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH23 + Channel 23 enable clear register. Writing '0' has no effect + 23 + 23 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH24 + Channel 24 enable clear register. Writing '0' has no effect + 24 + 24 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH25 + Channel 25 enable clear register. Writing '0' has no effect + 25 + 25 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH26 + Channel 26 enable clear register. Writing '0' has no effect + 26 + 26 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH27 + Channel 27 enable clear register. Writing '0' has no effect + 27 + 27 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH28 + Channel 28 enable clear register. Writing '0' has no effect + 28 + 28 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH29 + Channel 29 enable clear register. Writing '0' has no effect + 29 + 29 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH30 + Channel 30 enable clear register. Writing '0' has no effect + 30 + 30 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH31 + Channel 31 enable clear register. Writing '0' has no effect + 31 + 31 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + + + 20 + 0x008 + CH[%s] + PPI Channel + PPI_CH + 0x510 + + EEP + Description cluster[n]: Channel n event end-point + 0x000 + read-write + + + EEP + Pointer to event register. Accepts only addresses to registers from the Event group. + 0 + 31 + + + + + TEP + Description cluster[n]: Channel n task end-point + 0x004 + read-write + + + TEP + Pointer to task register. Accepts only addresses to registers from the Task group. + 0 + 31 + + + + + + 0x6 + 0x4 + CHG[%s] + Description collection[n]: Channel group n + 0x800 + read-write + + + CH0 + Include or exclude channel 0 + 0 + 0 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH1 + Include or exclude channel 1 + 1 + 1 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH2 + Include or exclude channel 2 + 2 + 2 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH3 + Include or exclude channel 3 + 3 + 3 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH4 + Include or exclude channel 4 + 4 + 4 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH5 + Include or exclude channel 5 + 5 + 5 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH6 + Include or exclude channel 6 + 6 + 6 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH7 + Include or exclude channel 7 + 7 + 7 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH8 + Include or exclude channel 8 + 8 + 8 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH9 + Include or exclude channel 9 + 9 + 9 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH10 + Include or exclude channel 10 + 10 + 10 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH11 + Include or exclude channel 11 + 11 + 11 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH12 + Include or exclude channel 12 + 12 + 12 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH13 + Include or exclude channel 13 + 13 + 13 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH14 + Include or exclude channel 14 + 14 + 14 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH15 + Include or exclude channel 15 + 15 + 15 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH16 + Include or exclude channel 16 + 16 + 16 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH17 + Include or exclude channel 17 + 17 + 17 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH18 + Include or exclude channel 18 + 18 + 18 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH19 + Include or exclude channel 19 + 19 + 19 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH20 + Include or exclude channel 20 + 20 + 20 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH21 + Include or exclude channel 21 + 21 + 21 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH22 + Include or exclude channel 22 + 22 + 22 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH23 + Include or exclude channel 23 + 23 + 23 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH24 + Include or exclude channel 24 + 24 + 24 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH25 + Include or exclude channel 25 + 25 + 25 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH26 + Include or exclude channel 26 + 26 + 26 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH27 + Include or exclude channel 27 + 27 + 27 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH28 + Include or exclude channel 28 + 28 + 28 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH29 + Include or exclude channel 29 + 29 + 29 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH30 + Include or exclude channel 30 + 30 + 30 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH31 + Include or exclude channel 31 + 31 + 31 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + + + 32 + 0x004 + FORK[%s] + Fork + PPI_FORK + 0x910 + + TEP + Description cluster[n]: Channel n task end-point + 0x000 + read-write + + + TEP + Pointer to task register + 0 + 31 + + + + + + + + MWU + Memory Watch Unit + 0x40020000 + + 0 + 0x1000 + registers + + + MWU + 32 + + MWU + 0x20 + + + 4 + 0x008 + EVENTS_REGION[%s] + Unspecified + MWU_EVENTS_REGION + 0x100 + + WA + Description cluster[n]: Write access to region n detected + 0x000 + read-write + + + WA + 0 + 0 + + + + + RA + Description cluster[n]: Read access to region n detected + 0x004 + read-write + + + RA + 0 + 0 + + + + + + 2 + 0x008 + EVENTS_PREGION[%s] + Unspecified + MWU_EVENTS_PREGION + 0x160 + + WA + Description cluster[n]: Write access to peripheral region n detected + 0x000 + read-write + + + WA + 0 + 0 + + + + + RA + Description cluster[n]: Read access to peripheral region n detected + 0x004 + read-write + + + RA + 0 + 0 + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + REGION0WA + Enable or disable interrupt for REGION[0].WA event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION0RA + Enable or disable interrupt for REGION[0].RA event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION1WA + Enable or disable interrupt for REGION[1].WA event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION1RA + Enable or disable interrupt for REGION[1].RA event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION2WA + Enable or disable interrupt for REGION[2].WA event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION2RA + Enable or disable interrupt for REGION[2].RA event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION3WA + Enable or disable interrupt for REGION[3].WA event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION3RA + Enable or disable interrupt for REGION[3].RA event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION0WA + Enable or disable interrupt for PREGION[0].WA event + 24 + 24 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION0RA + Enable or disable interrupt for PREGION[0].RA event + 25 + 25 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION1WA + Enable or disable interrupt for PREGION[1].WA event + 26 + 26 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION1RA + Enable or disable interrupt for PREGION[1].RA event + 27 + 27 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + REGION0WA + Write '1' to enable interrupt for REGION[0].WA event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION0RA + Write '1' to enable interrupt for REGION[0].RA event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION1WA + Write '1' to enable interrupt for REGION[1].WA event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION1RA + Write '1' to enable interrupt for REGION[1].RA event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION2WA + Write '1' to enable interrupt for REGION[2].WA event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION2RA + Write '1' to enable interrupt for REGION[2].RA event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION3WA + Write '1' to enable interrupt for REGION[3].WA event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION3RA + Write '1' to enable interrupt for REGION[3].RA event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION0WA + Write '1' to enable interrupt for PREGION[0].WA event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION0RA + Write '1' to enable interrupt for PREGION[0].RA event + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION1WA + Write '1' to enable interrupt for PREGION[1].WA event + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION1RA + Write '1' to enable interrupt for PREGION[1].RA event + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + REGION0WA + Write '1' to disable interrupt for REGION[0].WA event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION0RA + Write '1' to disable interrupt for REGION[0].RA event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION1WA + Write '1' to disable interrupt for REGION[1].WA event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION1RA + Write '1' to disable interrupt for REGION[1].RA event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION2WA + Write '1' to disable interrupt for REGION[2].WA event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION2RA + Write '1' to disable interrupt for REGION[2].RA event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION3WA + Write '1' to disable interrupt for REGION[3].WA event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION3RA + Write '1' to disable interrupt for REGION[3].RA event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION0WA + Write '1' to disable interrupt for PREGION[0].WA event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION0RA + Write '1' to disable interrupt for PREGION[0].RA event + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION1WA + Write '1' to disable interrupt for PREGION[1].WA event + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION1RA + Write '1' to disable interrupt for PREGION[1].RA event + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + NMIEN + Enable or disable non-maskable interrupt + 0x320 + read-write + + + REGION0WA + Enable or disable non-maskable interrupt for REGION[0].WA event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION0RA + Enable or disable non-maskable interrupt for REGION[0].RA event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION1WA + Enable or disable non-maskable interrupt for REGION[1].WA event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION1RA + Enable or disable non-maskable interrupt for REGION[1].RA event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION2WA + Enable or disable non-maskable interrupt for REGION[2].WA event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION2RA + Enable or disable non-maskable interrupt for REGION[2].RA event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION3WA + Enable or disable non-maskable interrupt for REGION[3].WA event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION3RA + Enable or disable non-maskable interrupt for REGION[3].RA event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION0WA + Enable or disable non-maskable interrupt for PREGION[0].WA event + 24 + 24 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION0RA + Enable or disable non-maskable interrupt for PREGION[0].RA event + 25 + 25 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION1WA + Enable or disable non-maskable interrupt for PREGION[1].WA event + 26 + 26 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION1RA + Enable or disable non-maskable interrupt for PREGION[1].RA event + 27 + 27 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + NMIENSET + Enable non-maskable interrupt + 0x324 + read-write + + + REGION0WA + Write '1' to enable non-maskable interrupt for REGION[0].WA event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION0RA + Write '1' to enable non-maskable interrupt for REGION[0].RA event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION1WA + Write '1' to enable non-maskable interrupt for REGION[1].WA event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION1RA + Write '1' to enable non-maskable interrupt for REGION[1].RA event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION2WA + Write '1' to enable non-maskable interrupt for REGION[2].WA event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION2RA + Write '1' to enable non-maskable interrupt for REGION[2].RA event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION3WA + Write '1' to enable non-maskable interrupt for REGION[3].WA event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION3RA + Write '1' to enable non-maskable interrupt for REGION[3].RA event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION0WA + Write '1' to enable non-maskable interrupt for PREGION[0].WA event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION0RA + Write '1' to enable non-maskable interrupt for PREGION[0].RA event + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION1WA + Write '1' to enable non-maskable interrupt for PREGION[1].WA event + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION1RA + Write '1' to enable non-maskable interrupt for PREGION[1].RA event + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + NMIENCLR + Disable non-maskable interrupt + 0x328 + read-write + + + REGION0WA + Write '1' to disable non-maskable interrupt for REGION[0].WA event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION0RA + Write '1' to disable non-maskable interrupt for REGION[0].RA event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION1WA + Write '1' to disable non-maskable interrupt for REGION[1].WA event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION1RA + Write '1' to disable non-maskable interrupt for REGION[1].RA event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION2WA + Write '1' to disable non-maskable interrupt for REGION[2].WA event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION2RA + Write '1' to disable non-maskable interrupt for REGION[2].RA event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION3WA + Write '1' to disable non-maskable interrupt for REGION[3].WA event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION3RA + Write '1' to disable non-maskable interrupt for REGION[3].RA event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION0WA + Write '1' to disable non-maskable interrupt for PREGION[0].WA event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION0RA + Write '1' to disable non-maskable interrupt for PREGION[0].RA event + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION1WA + Write '1' to disable non-maskable interrupt for PREGION[1].WA event + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION1RA + Write '1' to disable non-maskable interrupt for PREGION[1].RA event + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + 2 + 0x008 + PERREGION[%s] + Unspecified + MWU_PERREGION + 0x400 + + SUBSTATWA + Description cluster[n]: Source of event/interrupt in region n, write access detected while corresponding subregion was enabled for watching + 0x000 + read-write + oneToClear + + + SR0 + Subregion 0 in region n (write '1' to clear) + 0 + 0 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR1 + Subregion 1 in region n (write '1' to clear) + 1 + 1 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR2 + Subregion 2 in region n (write '1' to clear) + 2 + 2 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR3 + Subregion 3 in region n (write '1' to clear) + 3 + 3 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR4 + Subregion 4 in region n (write '1' to clear) + 4 + 4 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR5 + Subregion 5 in region n (write '1' to clear) + 5 + 5 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR6 + Subregion 6 in region n (write '1' to clear) + 6 + 6 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR7 + Subregion 7 in region n (write '1' to clear) + 7 + 7 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR8 + Subregion 8 in region n (write '1' to clear) + 8 + 8 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR9 + Subregion 9 in region n (write '1' to clear) + 9 + 9 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR10 + Subregion 10 in region n (write '1' to clear) + 10 + 10 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR11 + Subregion 11 in region n (write '1' to clear) + 11 + 11 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR12 + Subregion 12 in region n (write '1' to clear) + 12 + 12 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR13 + Subregion 13 in region n (write '1' to clear) + 13 + 13 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR14 + Subregion 14 in region n (write '1' to clear) + 14 + 14 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR15 + Subregion 15 in region n (write '1' to clear) + 15 + 15 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR16 + Subregion 16 in region n (write '1' to clear) + 16 + 16 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR17 + Subregion 17 in region n (write '1' to clear) + 17 + 17 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR18 + Subregion 18 in region n (write '1' to clear) + 18 + 18 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR19 + Subregion 19 in region n (write '1' to clear) + 19 + 19 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR20 + Subregion 20 in region n (write '1' to clear) + 20 + 20 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR21 + Subregion 21 in region n (write '1' to clear) + 21 + 21 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR22 + Subregion 22 in region n (write '1' to clear) + 22 + 22 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR23 + Subregion 23 in region n (write '1' to clear) + 23 + 23 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR24 + Subregion 24 in region n (write '1' to clear) + 24 + 24 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR25 + Subregion 25 in region n (write '1' to clear) + 25 + 25 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR26 + Subregion 26 in region n (write '1' to clear) + 26 + 26 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR27 + Subregion 27 in region n (write '1' to clear) + 27 + 27 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR28 + Subregion 28 in region n (write '1' to clear) + 28 + 28 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR29 + Subregion 29 in region n (write '1' to clear) + 29 + 29 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR30 + Subregion 30 in region n (write '1' to clear) + 30 + 30 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR31 + Subregion 31 in region n (write '1' to clear) + 31 + 31 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + + + SUBSTATRA + Description cluster[n]: Source of event/interrupt in region n, read access detected while corresponding subregion was enabled for watching + 0x004 + read-write + oneToClear + + + SR0 + Subregion 0 in region n (write '1' to clear) + 0 + 0 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR1 + Subregion 1 in region n (write '1' to clear) + 1 + 1 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR2 + Subregion 2 in region n (write '1' to clear) + 2 + 2 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR3 + Subregion 3 in region n (write '1' to clear) + 3 + 3 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR4 + Subregion 4 in region n (write '1' to clear) + 4 + 4 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR5 + Subregion 5 in region n (write '1' to clear) + 5 + 5 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR6 + Subregion 6 in region n (write '1' to clear) + 6 + 6 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR7 + Subregion 7 in region n (write '1' to clear) + 7 + 7 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR8 + Subregion 8 in region n (write '1' to clear) + 8 + 8 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR9 + Subregion 9 in region n (write '1' to clear) + 9 + 9 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR10 + Subregion 10 in region n (write '1' to clear) + 10 + 10 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR11 + Subregion 11 in region n (write '1' to clear) + 11 + 11 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR12 + Subregion 12 in region n (write '1' to clear) + 12 + 12 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR13 + Subregion 13 in region n (write '1' to clear) + 13 + 13 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR14 + Subregion 14 in region n (write '1' to clear) + 14 + 14 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR15 + Subregion 15 in region n (write '1' to clear) + 15 + 15 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR16 + Subregion 16 in region n (write '1' to clear) + 16 + 16 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR17 + Subregion 17 in region n (write '1' to clear) + 17 + 17 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR18 + Subregion 18 in region n (write '1' to clear) + 18 + 18 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR19 + Subregion 19 in region n (write '1' to clear) + 19 + 19 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR20 + Subregion 20 in region n (write '1' to clear) + 20 + 20 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR21 + Subregion 21 in region n (write '1' to clear) + 21 + 21 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR22 + Subregion 22 in region n (write '1' to clear) + 22 + 22 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR23 + Subregion 23 in region n (write '1' to clear) + 23 + 23 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR24 + Subregion 24 in region n (write '1' to clear) + 24 + 24 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR25 + Subregion 25 in region n (write '1' to clear) + 25 + 25 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR26 + Subregion 26 in region n (write '1' to clear) + 26 + 26 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR27 + Subregion 27 in region n (write '1' to clear) + 27 + 27 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR28 + Subregion 28 in region n (write '1' to clear) + 28 + 28 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR29 + Subregion 29 in region n (write '1' to clear) + 29 + 29 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR30 + Subregion 30 in region n (write '1' to clear) + 30 + 30 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR31 + Subregion 31 in region n (write '1' to clear) + 31 + 31 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + + + + REGIONEN + Enable/disable regions watch + 0x510 + read-write + + + RGN0WA + Enable/disable write access watch in region[0] + 0 + 0 + + + Disable + Disable write access watch in this region + 0 + + + Enable + Enable write access watch in this region + 1 + + + + + RGN0RA + Enable/disable read access watch in region[0] + 1 + 1 + + + Disable + Disable read access watch in this region + 0 + + + Enable + Enable read access watch in this region + 1 + + + + + RGN1WA + Enable/disable write access watch in region[1] + 2 + 2 + + + Disable + Disable write access watch in this region + 0 + + + Enable + Enable write access watch in this region + 1 + + + + + RGN1RA + Enable/disable read access watch in region[1] + 3 + 3 + + + Disable + Disable read access watch in this region + 0 + + + Enable + Enable read access watch in this region + 1 + + + + + RGN2WA + Enable/disable write access watch in region[2] + 4 + 4 + + + Disable + Disable write access watch in this region + 0 + + + Enable + Enable write access watch in this region + 1 + + + + + RGN2RA + Enable/disable read access watch in region[2] + 5 + 5 + + + Disable + Disable read access watch in this region + 0 + + + Enable + Enable read access watch in this region + 1 + + + + + RGN3WA + Enable/disable write access watch in region[3] + 6 + 6 + + + Disable + Disable write access watch in this region + 0 + + + Enable + Enable write access watch in this region + 1 + + + + + RGN3RA + Enable/disable read access watch in region[3] + 7 + 7 + + + Disable + Disable read access watch in this region + 0 + + + Enable + Enable read access watch in this region + 1 + + + + + PRGN0WA + Enable/disable write access watch in PREGION[0] + 24 + 24 + + + Disable + Disable write access watch in this PREGION + 0 + + + Enable + Enable write access watch in this PREGION + 1 + + + + + PRGN0RA + Enable/disable read access watch in PREGION[0] + 25 + 25 + + + Disable + Disable read access watch in this PREGION + 0 + + + Enable + Enable read access watch in this PREGION + 1 + + + + + PRGN1WA + Enable/disable write access watch in PREGION[1] + 26 + 26 + + + Disable + Disable write access watch in this PREGION + 0 + + + Enable + Enable write access watch in this PREGION + 1 + + + + + PRGN1RA + Enable/disable read access watch in PREGION[1] + 27 + 27 + + + Disable + Disable read access watch in this PREGION + 0 + + + Enable + Enable read access watch in this PREGION + 1 + + + + + + + REGIONENSET + Enable regions watch + 0x514 + read-write + + + RGN0WA + Enable write access watch in region[0] + 0 + 0 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Set + Enable write access watch in this region + 1 + + + + + RGN0RA + Enable read access watch in region[0] + 1 + 1 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Set + Enable read access watch in this region + 1 + + + + + RGN1WA + Enable write access watch in region[1] + 2 + 2 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Set + Enable write access watch in this region + 1 + + + + + RGN1RA + Enable read access watch in region[1] + 3 + 3 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Set + Enable read access watch in this region + 1 + + + + + RGN2WA + Enable write access watch in region[2] + 4 + 4 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Set + Enable write access watch in this region + 1 + + + + + RGN2RA + Enable read access watch in region[2] + 5 + 5 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Set + Enable read access watch in this region + 1 + + + + + RGN3WA + Enable write access watch in region[3] + 6 + 6 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Set + Enable write access watch in this region + 1 + + + + + RGN3RA + Enable read access watch in region[3] + 7 + 7 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Set + Enable read access watch in this region + 1 + + + + + PRGN0WA + Enable write access watch in PREGION[0] + 24 + 24 + + read + + Disabled + Write access watch in this PREGION is disabled + 0 + + + Enabled + Write access watch in this PREGION is enabled + 1 + + + + write + + Set + Enable write access watch in this PREGION + 1 + + + + + PRGN0RA + Enable read access watch in PREGION[0] + 25 + 25 + + read + + Disabled + Read access watch in this PREGION is disabled + 0 + + + Enabled + Read access watch in this PREGION is enabled + 1 + + + + write + + Set + Enable read access watch in this PREGION + 1 + + + + + PRGN1WA + Enable write access watch in PREGION[1] + 26 + 26 + + read + + Disabled + Write access watch in this PREGION is disabled + 0 + + + Enabled + Write access watch in this PREGION is enabled + 1 + + + + write + + Set + Enable write access watch in this PREGION + 1 + + + + + PRGN1RA + Enable read access watch in PREGION[1] + 27 + 27 + + read + + Disabled + Read access watch in this PREGION is disabled + 0 + + + Enabled + Read access watch in this PREGION is enabled + 1 + + + + write + + Set + Enable read access watch in this PREGION + 1 + + + + + + + REGIONENCLR + Disable regions watch + 0x518 + read-write + + + RGN0WA + Disable write access watch in region[0] + 0 + 0 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Clear + Disable write access watch in this region + 1 + + + + + RGN0RA + Disable read access watch in region[0] + 1 + 1 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Clear + Disable read access watch in this region + 1 + + + + + RGN1WA + Disable write access watch in region[1] + 2 + 2 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Clear + Disable write access watch in this region + 1 + + + + + RGN1RA + Disable read access watch in region[1] + 3 + 3 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Clear + Disable read access watch in this region + 1 + + + + + RGN2WA + Disable write access watch in region[2] + 4 + 4 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Clear + Disable write access watch in this region + 1 + + + + + RGN2RA + Disable read access watch in region[2] + 5 + 5 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Clear + Disable read access watch in this region + 1 + + + + + RGN3WA + Disable write access watch in region[3] + 6 + 6 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Clear + Disable write access watch in this region + 1 + + + + + RGN3RA + Disable read access watch in region[3] + 7 + 7 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Clear + Disable read access watch in this region + 1 + + + + + PRGN0WA + Disable write access watch in PREGION[0] + 24 + 24 + + read + + Disabled + Write access watch in this PREGION is disabled + 0 + + + Enabled + Write access watch in this PREGION is enabled + 1 + + + + write + + Clear + Disable write access watch in this PREGION + 1 + + + + + PRGN0RA + Disable read access watch in PREGION[0] + 25 + 25 + + read + + Disabled + Read access watch in this PREGION is disabled + 0 + + + Enabled + Read access watch in this PREGION is enabled + 1 + + + + write + + Clear + Disable read access watch in this PREGION + 1 + + + + + PRGN1WA + Disable write access watch in PREGION[1] + 26 + 26 + + read + + Disabled + Write access watch in this PREGION is disabled + 0 + + + Enabled + Write access watch in this PREGION is enabled + 1 + + + + write + + Clear + Disable write access watch in this PREGION + 1 + + + + + PRGN1RA + Disable read access watch in PREGION[1] + 27 + 27 + + read + + Disabled + Read access watch in this PREGION is disabled + 0 + + + Enabled + Read access watch in this PREGION is enabled + 1 + + + + write + + Clear + Disable read access watch in this PREGION + 1 + + + + + + + 4 + 0x010 + REGION[%s] + Unspecified + MWU_REGION + 0x600 + + START + Description cluster[n]: Start address for region n + 0x000 + read-write + 0x00000000 + + + START + Start address for region + 0 + 31 + + + + + END + Description cluster[n]: End address of region n + 0x004 + read-write + + + END + End address of region. + 0 + 31 + + + + + + 2 + 0x010 + PREGION[%s] + Unspecified + MWU_PREGION + 0x6C0 + + START + Description cluster[n]: Reserved for future use + 0x000 + read-only + + + START + Reserved for future use + 0 + 31 + + + + + END + Description cluster[n]: Reserved for future use + 0x004 + read-only + + + END + Reserved for future use + 0 + 31 + + + + + SUBS + Description cluster[n]: Subregions of region n + 0x008 + read-write + 0x00000000 + + + SR0 + Include or exclude subregion 0 in region + 0 + 0 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR1 + Include or exclude subregion 1 in region + 1 + 1 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR2 + Include or exclude subregion 2 in region + 2 + 2 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR3 + Include or exclude subregion 3 in region + 3 + 3 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR4 + Include or exclude subregion 4 in region + 4 + 4 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR5 + Include or exclude subregion 5 in region + 5 + 5 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR6 + Include or exclude subregion 6 in region + 6 + 6 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR7 + Include or exclude subregion 7 in region + 7 + 7 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR8 + Include or exclude subregion 8 in region + 8 + 8 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR9 + Include or exclude subregion 9 in region + 9 + 9 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR10 + Include or exclude subregion 10 in region + 10 + 10 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR11 + Include or exclude subregion 11 in region + 11 + 11 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR12 + Include or exclude subregion 12 in region + 12 + 12 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR13 + Include or exclude subregion 13 in region + 13 + 13 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR14 + Include or exclude subregion 14 in region + 14 + 14 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR15 + Include or exclude subregion 15 in region + 15 + 15 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR16 + Include or exclude subregion 16 in region + 16 + 16 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR17 + Include or exclude subregion 17 in region + 17 + 17 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR18 + Include or exclude subregion 18 in region + 18 + 18 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR19 + Include or exclude subregion 19 in region + 19 + 19 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR20 + Include or exclude subregion 20 in region + 20 + 20 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR21 + Include or exclude subregion 21 in region + 21 + 21 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR22 + Include or exclude subregion 22 in region + 22 + 22 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR23 + Include or exclude subregion 23 in region + 23 + 23 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR24 + Include or exclude subregion 24 in region + 24 + 24 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR25 + Include or exclude subregion 25 in region + 25 + 25 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR26 + Include or exclude subregion 26 in region + 26 + 26 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR27 + Include or exclude subregion 27 in region + 27 + 27 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR28 + Include or exclude subregion 28 in region + 28 + 28 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR29 + Include or exclude subregion 29 in region + 29 + 29 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR30 + Include or exclude subregion 30 in region + 30 + 30 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR31 + Include or exclude subregion 31 in region + 31 + 31 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + + + + + + PWM1 + Pulse width modulation unit 1 + 0x40021000 + + PWM1 + 33 + + + + PWM2 + Pulse width modulation unit 2 + 0x40022000 + + PWM2 + 34 + + + + SPI2 + Serial Peripheral Interface 2 + 0x40023000 + + SPIM2_SPIS2_SPI2 + 35 + + + + SPIM2 + Serial Peripheral Interface Master with EasyDMA 2 + 0x40023000 + SPI2 + + SPIM2_SPIS2_SPI2 + 35 + + + + SPIS2 + SPI Slave 2 + 0x40023000 + SPI2 + + SPIM2_SPIS2_SPI2 + 35 + + + + RTC2 + Real time counter 2 + 0x40024000 + + RTC2 + 36 + + + + I2S + Inter-IC Sound + 0x40025000 + + 0 + 0x1000 + registers + + + I2S + 37 + + I2S + 0x20 + + + TASKS_START + Starts continuous I2S transfer. Also starts MCK generator when this is enabled. + 0x000 + write-only + + + TASKS_START + 0 + 0 + + + + + TASKS_STOP + Stops I2S transfer. Also stops MCK generator. Triggering this task will cause the {event:STOPPED} event to be generated. + 0x004 + write-only + + + TASKS_STOP + 0 + 0 + + + + + EVENTS_RXPTRUPD + The RXD.PTR register has been copied to internal double-buffers. + When the I2S module is started and RX is enabled, this event will be generated for every RXTXD.MAXCNT words that are received on the SDIN pin. + 0x104 + read-write + + + EVENTS_RXPTRUPD + 0 + 0 + + + + + EVENTS_STOPPED + I2S transfer stopped. + 0x108 + read-write + + + EVENTS_STOPPED + 0 + 0 + + + + + EVENTS_TXPTRUPD + The TDX.PTR register has been copied to internal double-buffers. + When the I2S module is started and TX is enabled, this event will be generated for every RXTXD.MAXCNT words that are sent on the SDOUT pin. + 0x114 + read-write + + + EVENTS_TXPTRUPD + 0 + 0 + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + RXPTRUPD + Enable or disable interrupt for RXPTRUPD event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STOPPED + Enable or disable interrupt for STOPPED event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXPTRUPD + Enable or disable interrupt for TXPTRUPD event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + RXPTRUPD + Write '1' to enable interrupt for RXPTRUPD event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STOPPED + Write '1' to enable interrupt for STOPPED event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXPTRUPD + Write '1' to enable interrupt for TXPTRUPD event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + RXPTRUPD + Write '1' to disable interrupt for RXPTRUPD event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STOPPED + Write '1' to disable interrupt for STOPPED event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXPTRUPD + Write '1' to disable interrupt for TXPTRUPD event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + Enable I2S module. + 0x500 + read-write + 0x00000000 + + + ENABLE + Enable I2S module. + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + CONFIG + Unspecified + I2S_CONFIG + 0x504 + + MODE + I2S mode. + 0x000 + read-write + 0x00000000 + + + MODE + I2S mode. + 0 + 0 + + + Master + Master mode. SCK and LRCK generated from internal master clcok (MCK) and output on pins defined by PSEL.xxx. + 0 + + + Slave + Slave mode. SCK and LRCK generated by external master and received on pins defined by PSEL.xxx + 1 + + + + + + + RXEN + Reception (RX) enable. + 0x004 + read-write + 0x00000000 + + + RXEN + Reception (RX) enable. + 0 + 0 + + + Disabled + Reception disabled and now data will be written to the RXD.PTR address. + 0 + + + Enabled + Reception enabled. + 1 + + + + + + + TXEN + Transmission (TX) enable. + 0x008 + read-write + 0x00000001 + + + TXEN + Transmission (TX) enable. + 0 + 0 + + + Disabled + Transmission disabled and now data will be read from the RXD.TXD address. + 0 + + + Enabled + Transmission enabled. + 1 + + + + + + + MCKEN + Master clock generator enable. + 0x00C + read-write + 0x00000001 + + + MCKEN + Master clock generator enable. + 0 + 0 + + + Disabled + Master clock generator disabled and PSEL.MCK not connected(available as GPIO). + 0 + + + Enabled + Master clock generator running and MCK output on PSEL.MCK. + 1 + + + + + + + MCKFREQ + Master clock generator frequency. + 0x010 + read-write + 0x20000000 + + + MCKFREQ + Master clock generator frequency. + 0 + 31 + + + 32MDIV2 + 32 MHz / 2 = 16.0 MHz + 0x80000000 + + + 32MDIV3 + 32 MHz / 3 = 10.6666667 MHz + 0x50000000 + + + 32MDIV4 + 32 MHz / 4 = 8.0 MHz + 0x40000000 + + + 32MDIV5 + 32 MHz / 5 = 6.4 MHz + 0x30000000 + + + 32MDIV6 + 32 MHz / 6 = 5.3333333 MHz + 0x28000000 + + + 32MDIV8 + 32 MHz / 8 = 4.0 MHz + 0x20000000 + + + 32MDIV10 + 32 MHz / 10 = 3.2 MHz + 0x18000000 + + + 32MDIV11 + 32 MHz / 11 = 2.9090909 MHz + 0x16000000 + + + 32MDIV15 + 32 MHz / 15 = 2.1333333 MHz + 0x11000000 + + + 32MDIV16 + 32 MHz / 16 = 2.0 MHz + 0x10000000 + + + 32MDIV21 + 32 MHz / 21 = 1.5238095 + 0x0C000000 + + + 32MDIV23 + 32 MHz / 23 = 1.3913043 MHz + 0x0B000000 + + + 32MDIV30 + 32 MHz / 30 = 1.0666667 MHz + 0x08800000 + + + 32MDIV31 + 32 MHz / 31 = 1.0322581 MHz + 0x08400000 + + + 32MDIV32 + 32 MHz / 32 = 1.0 MHz + 0x08000000 + + + 32MDIV42 + 32 MHz / 42 = 0.7619048 MHz + 0x06000000 + + + 32MDIV63 + 32 MHz / 63 = 0.5079365 MHz + 0x04100000 + + + 32MDIV125 + 32 MHz / 125 = 0.256 MHz + 0x020C0000 + + + + + + + RATIO + MCK / LRCK ratio. + 0x014 + read-write + 0x00000006 + + + RATIO + MCK / LRCK ratio. + 0 + 3 + + + 32X + LRCK = MCK / 32 + 0 + + + 48X + LRCK = MCK / 48 + 1 + + + 64X + LRCK = MCK / 64 + 2 + + + 96X + LRCK = MCK / 96 + 3 + + + 128X + LRCK = MCK / 128 + 4 + + + 192X + LRCK = MCK / 192 + 5 + + + 256X + LRCK = MCK / 256 + 6 + + + 384X + LRCK = MCK / 384 + 7 + + + 512X + LRCK = MCK / 512 + 8 + + + + + + + SWIDTH + Sample width. + 0x018 + read-write + 0x00000001 + + + SWIDTH + Sample width. + 0 + 1 + + + 8Bit + 8 bit. + 0 + + + 16Bit + 16 bit. + 1 + + + 24Bit + 24 bit. + 2 + + + + + + + ALIGN + Alignment of sample within a frame. + 0x01C + read-write + 0x00000000 + + + ALIGN + Alignment of sample within a frame. + 0 + 0 + + + Left + Left-aligned. + 0 + + + Right + Right-aligned. + 1 + + + + + + + FORMAT + Frame format. + 0x020 + read-write + 0x00000000 + + + FORMAT + Frame format. + 0 + 0 + + + I2S + Original I2S format. + 0 + + + Aligned + Alternate (left- or right-aligned) format. + 1 + + + + + + + CHANNELS + Enable channels. + 0x024 + read-write + 0x00000000 + + + CHANNELS + Enable channels. + 0 + 1 + + + Stereo + Stereo. + 0 + + + Left + Left only. + 1 + + + Right + Right only. + 2 + + + + + + + + RXD + Unspecified + I2S_RXD + 0x538 + + PTR + Receive buffer RAM start address. + 0x000 + read-write + 0x00000000 + + + PTR + Receive buffer Data RAM start address. When receiving, words containing samples will be written to this address. This address is a word aligned Data RAM address. + 0 + 31 + + + + + + TXD + Unspecified + I2S_TXD + 0x540 + + PTR + Transmit buffer RAM start address. + 0x000 + read-write + 0x00000000 + + + PTR + Transmit buffer Data RAM start address. When transmitting, words containing samples will be fetched from this address. This address is a word aligned Data RAM address. + 0 + 31 + + + + + + RXTXD + Unspecified + I2S_RXTXD + 0x550 + + MAXCNT + Size of RXD and TXD buffers. + 0x000 + read-write + 0x00000000 + + + MAXCNT + Size of RXD and TXD buffers in number of 32 bit words. + 0 + 13 + + + + + + PSEL + Unspecified + I2S_PSEL + 0x560 + + MCK + Pin select for MCK signal. + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SCK + Pin select for SCK signal. + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + LRCK + Pin select for LRCK signal. + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDIN + Pin select for SDIN signal. + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDOUT + Pin select for SDOUT signal. + 0x010 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + + + FPU + FPU + 0x40026000 + + 0 + 0x1000 + registers + + + FPU + 38 + + FPU + 0x20 + + + UNUSED + Unused. + 0x000 + 0x00000000 + read-only + + + + + USBD + Universal serial bus device + 0x40027000 + + 0 + 0x1000 + registers + + + USBD + 39 + + USBD + 0x20 + + + 0x8 + 0x4 + TASKS_STARTEPIN[%s] + Description collection[n]: Captures the EPIN[n].PTR and EPIN[n].MAXCNT registers values, and enables endpoint IN n to respond to traffic from host + 0x004 + write-only + + + TASKS_STARTEPIN + 0 + 0 + + + + + TASKS_STARTISOIN + Captures the ISOIN.PTR and ISOIN.MAXCNT registers values, and enables sending data on ISO endpoint + 0x024 + write-only + + + TASKS_STARTISOIN + 0 + 0 + + + + + 0x8 + 0x4 + TASKS_STARTEPOUT[%s] + Description collection[n]: Captures the EPOUT[n].PTR and EPOUT[n].MAXCNT registers values, and enables endpoint n to respond to traffic from host + 0x028 + write-only + + + TASKS_STARTEPOUT + 0 + 0 + + + + + TASKS_STARTISOOUT + Captures the ISOOUT.PTR and ISOOUT.MAXCNT registers values, and enables receiving of data on ISO endpoint + 0x048 + write-only + + + TASKS_STARTISOOUT + 0 + 0 + + + + + TASKS_EP0RCVOUT + Allows OUT data stage on control endpoint 0 + 0x04C + write-only + + + TASKS_EP0RCVOUT + 0 + 0 + + + + + TASKS_EP0STATUS + Allows status stage on control endpoint 0 + 0x050 + write-only + + + TASKS_EP0STATUS + 0 + 0 + + + + + TASKS_EP0STALL + Stalls data and status stage on control endpoint 0 + 0x054 + write-only + + + TASKS_EP0STALL + 0 + 0 + + + + + TASKS_DPDMDRIVE + Forces D+ and D- lines into the state defined in the DPDMVALUE register + 0x058 + write-only + + + TASKS_DPDMDRIVE + 0 + 0 + + + + + TASKS_DPDMNODRIVE + Stops forcing D+ and D- lines into any state (USB engine takes control) + 0x05C + write-only + + + TASKS_DPDMNODRIVE + 0 + 0 + + + + + EVENTS_USBRESET + Signals that a USB reset condition has been detected on USB lines + 0x100 + read-write + + + EVENTS_USBRESET + 0 + 0 + + + + + EVENTS_STARTED + Confirms that the EPIN[n].PTR and EPIN[n].MAXCNT, or EPOUT[n].PTR and EPOUT[n].MAXCNT registers have been captured on all endpoints reported in the EPSTATUS register + 0x104 + read-write + + + EVENTS_STARTED + 0 + 0 + + + + + 0x8 + 0x4 + EVENTS_ENDEPIN[%s] + Description collection[n]: The whole EPIN[n] buffer has been consumed. The RAM buffer can be accessed safely by software. + 0x108 + read-write + + + EVENTS_ENDEPIN + 0 + 0 + + + + + EVENTS_EP0DATADONE + An acknowledged data transfer has taken place on the control endpoint + 0x128 + read-write + + + EVENTS_EP0DATADONE + 0 + 0 + + + + + EVENTS_ENDISOIN + The whole ISOIN buffer has been consumed. The RAM buffer can be accessed safely by software. + 0x12C + read-write + + + EVENTS_ENDISOIN + 0 + 0 + + + + + 0x8 + 0x4 + EVENTS_ENDEPOUT[%s] + Description collection[n]: The whole EPOUT[n] buffer has been consumed. The RAM buffer can be accessed safely by software. + 0x130 + read-write + + + EVENTS_ENDEPOUT + 0 + 0 + + + + + EVENTS_ENDISOOUT + The whole ISOOUT buffer has been consumed. The RAM buffer can be accessed safely by software. + 0x150 + read-write + + + EVENTS_ENDISOOUT + 0 + 0 + + + + + EVENTS_SOF + Signals that a SOF (start of frame) condition has been detected on USB lines + 0x154 + read-write + + + EVENTS_SOF + 0 + 0 + + + + + EVENTS_USBEVENT + An event or an error not covered by specific events has occurred. Check EVENTCAUSE register to find the cause. + 0x158 + read-write + + + EVENTS_USBEVENT + 0 + 0 + + + + + EVENTS_EP0SETUP + A valid SETUP token has been received (and acknowledged) on the control endpoint + 0x15C + read-write + + + EVENTS_EP0SETUP + 0 + 0 + + + + + EVENTS_EPDATA + A data transfer has occurred on a data endpoint, indicated by the EPDATASTATUS register + 0x160 + read-write + + + EVENTS_EPDATA + 0 + 0 + + + + + SHORTS + Shortcut register + 0x200 + read-write + + + EP0DATADONE_STARTEPIN0 + Shortcut between EP0DATADONE event and STARTEPIN[0] task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + EP0DATADONE_STARTEPOUT0 + Shortcut between EP0DATADONE event and STARTEPOUT[0] task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + EP0DATADONE_EP0STATUS + Shortcut between EP0DATADONE event and EP0STATUS task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ENDEPOUT0_EP0STATUS + Shortcut between ENDEPOUT[0] event and EP0STATUS task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ENDEPOUT0_EP0RCVOUT + Shortcut between ENDEPOUT[0] event and EP0RCVOUT task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + USBRESET + Enable or disable interrupt for USBRESET event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STARTED + Enable or disable interrupt for STARTED event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN0 + Enable or disable interrupt for ENDEPIN[0] event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN1 + Enable or disable interrupt for ENDEPIN[1] event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN2 + Enable or disable interrupt for ENDEPIN[2] event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN3 + Enable or disable interrupt for ENDEPIN[3] event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN4 + Enable or disable interrupt for ENDEPIN[4] event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN5 + Enable or disable interrupt for ENDEPIN[5] event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN6 + Enable or disable interrupt for ENDEPIN[6] event + 8 + 8 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPIN7 + Enable or disable interrupt for ENDEPIN[7] event + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + EP0DATADONE + Enable or disable interrupt for EP0DATADONE event + 10 + 10 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDISOIN + Enable or disable interrupt for ENDISOIN event + 11 + 11 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT0 + Enable or disable interrupt for ENDEPOUT[0] event + 12 + 12 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT1 + Enable or disable interrupt for ENDEPOUT[1] event + 13 + 13 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT2 + Enable or disable interrupt for ENDEPOUT[2] event + 14 + 14 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT3 + Enable or disable interrupt for ENDEPOUT[3] event + 15 + 15 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT4 + Enable or disable interrupt for ENDEPOUT[4] event + 16 + 16 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT5 + Enable or disable interrupt for ENDEPOUT[5] event + 17 + 17 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT6 + Enable or disable interrupt for ENDEPOUT[6] event + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDEPOUT7 + Enable or disable interrupt for ENDEPOUT[7] event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDISOOUT + Enable or disable interrupt for ENDISOOUT event + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SOF + Enable or disable interrupt for SOF event + 21 + 21 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + USBEVENT + Enable or disable interrupt for USBEVENT event + 22 + 22 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + EP0SETUP + Enable or disable interrupt for EP0SETUP event + 23 + 23 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + EPDATA + Enable or disable interrupt for EPDATA event + 24 + 24 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + USBRESET + Write '1' to enable interrupt for USBRESET event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STARTED + Write '1' to enable interrupt for STARTED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN0 + Write '1' to enable interrupt for ENDEPIN[0] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN1 + Write '1' to enable interrupt for ENDEPIN[1] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN2 + Write '1' to enable interrupt for ENDEPIN[2] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN3 + Write '1' to enable interrupt for ENDEPIN[3] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN4 + Write '1' to enable interrupt for ENDEPIN[4] event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN5 + Write '1' to enable interrupt for ENDEPIN[5] event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN6 + Write '1' to enable interrupt for ENDEPIN[6] event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPIN7 + Write '1' to enable interrupt for ENDEPIN[7] event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + EP0DATADONE + Write '1' to enable interrupt for EP0DATADONE event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDISOIN + Write '1' to enable interrupt for ENDISOIN event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT0 + Write '1' to enable interrupt for ENDEPOUT[0] event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT1 + Write '1' to enable interrupt for ENDEPOUT[1] event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT2 + Write '1' to enable interrupt for ENDEPOUT[2] event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT3 + Write '1' to enable interrupt for ENDEPOUT[3] event + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT4 + Write '1' to enable interrupt for ENDEPOUT[4] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT5 + Write '1' to enable interrupt for ENDEPOUT[5] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT6 + Write '1' to enable interrupt for ENDEPOUT[6] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDEPOUT7 + Write '1' to enable interrupt for ENDEPOUT[7] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDISOOUT + Write '1' to enable interrupt for ENDISOOUT event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SOF + Write '1' to enable interrupt for SOF event + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + USBEVENT + Write '1' to enable interrupt for USBEVENT event + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + EP0SETUP + Write '1' to enable interrupt for EP0SETUP event + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + EPDATA + Write '1' to enable interrupt for EPDATA event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + USBRESET + Write '1' to disable interrupt for USBRESET event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STARTED + Write '1' to disable interrupt for STARTED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN0 + Write '1' to disable interrupt for ENDEPIN[0] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN1 + Write '1' to disable interrupt for ENDEPIN[1] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN2 + Write '1' to disable interrupt for ENDEPIN[2] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN3 + Write '1' to disable interrupt for ENDEPIN[3] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN4 + Write '1' to disable interrupt for ENDEPIN[4] event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN5 + Write '1' to disable interrupt for ENDEPIN[5] event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN6 + Write '1' to disable interrupt for ENDEPIN[6] event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPIN7 + Write '1' to disable interrupt for ENDEPIN[7] event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + EP0DATADONE + Write '1' to disable interrupt for EP0DATADONE event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDISOIN + Write '1' to disable interrupt for ENDISOIN event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT0 + Write '1' to disable interrupt for ENDEPOUT[0] event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT1 + Write '1' to disable interrupt for ENDEPOUT[1] event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT2 + Write '1' to disable interrupt for ENDEPOUT[2] event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT3 + Write '1' to disable interrupt for ENDEPOUT[3] event + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT4 + Write '1' to disable interrupt for ENDEPOUT[4] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT5 + Write '1' to disable interrupt for ENDEPOUT[5] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT6 + Write '1' to disable interrupt for ENDEPOUT[6] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDEPOUT7 + Write '1' to disable interrupt for ENDEPOUT[7] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDISOOUT + Write '1' to disable interrupt for ENDISOOUT event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SOF + Write '1' to disable interrupt for SOF event + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + USBEVENT + Write '1' to disable interrupt for USBEVENT event + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + EP0SETUP + Write '1' to disable interrupt for EP0SETUP event + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + EPDATA + Write '1' to disable interrupt for EPDATA event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + EVENTCAUSE + Details on what caused the USBEVENT event + 0x400 + read-write + oneToClear + + + ISOOUTCRC + CRC error was detected on isochronous OUT endpoint 8. Write '1' to clear. + 0 + 0 + + + NotDetected + No error detected + 0 + + + Detected + Error detected + 1 + + + + + SUSPEND + Signals that USB lines have been idle long enough for the device to enter suspend. Write '1' to clear. + 8 + 8 + + + NotDetected + Suspend not detected + 0 + + + Detected + Suspend detected + 1 + + + + + RESUME + Signals that a RESUME condition (K state or activity restart) has been detected on USB lines. Write '1' to clear. + 9 + 9 + + + NotDetected + Resume not detected + 0 + + + Detected + Resume detected + 1 + + + + + USBWUALLOWED + USB MAC has been woken up and operational. Write '1' to clear. + 10 + 10 + + + NotAllowed + Wake up not allowed + 0 + + + Allowed + Wake up allowed + 1 + + + + + READY + USB device is ready for normal operation. Write '1' to clear. + 11 + 11 + + + NotDetected + USBEVENT was not issued due to USBD peripheral ready + 0 + + + Ready + USBD peripheral is ready + 1 + + + + + + + HALTED + Unspecified + USBD_HALTED + 0x420 + + 0x8 + 0x4 + EPIN[%s] + Description collection[n]: IN endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint. + 0x000 + read-only + + + GETSTATUS + IN endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint. + 0 + 15 + + + NotHalted + Endpoint is not halted + 0 + + + Halted + Endpoint is halted + 1 + + + + + + + 0x8 + 0x4 + EPOUT[%s] + Description collection[n]: OUT endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint. + 0x024 + read-only + + + GETSTATUS + OUT endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint. + 0 + 15 + + + NotHalted + Endpoint is not halted + 0 + + + Halted + Endpoint is halted + 1 + + + + + + + + EPSTATUS + Provides information on which endpoint's EasyDMA registers have been captured + 0x468 + read-write + oneToClear + + + EPIN0 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 0 + 0 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN1 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 1 + 1 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN2 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 2 + 2 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN3 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 3 + 3 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN4 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 4 + 4 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN5 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 5 + 5 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN6 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 6 + 6 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN7 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 7 + 7 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPIN8 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 8 + 8 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT0 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 16 + 16 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT1 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 17 + 17 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT2 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 18 + 18 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT3 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 19 + 19 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT4 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 20 + 20 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT5 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 21 + 21 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT6 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 22 + 22 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT7 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 23 + 23 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + EPOUT8 + Captured state of endpoint's EasyDMA registers. Write '1' to clear. + 24 + 24 + + + NoData + EasyDMA registers have not been captured for this endpoint + 0 + + + DataDone + EasyDMA registers have been captured for this endpoint + 1 + + + + + + + EPDATASTATUS + Provides information on which endpoint(s) an acknowledged data transfer has occurred (EPDATA event) + 0x46C + read-write + oneToClear + + + EPIN1 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 1 + 1 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPIN2 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 2 + 2 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPIN3 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 3 + 3 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPIN4 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 4 + 4 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPIN5 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 5 + 5 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPIN6 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 6 + 6 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPIN7 + Acknowledged data transfer on this IN endpoint. Write '1' to clear. + 7 + 7 + + + NotDone + No acknowledged data transfer on this endpoint + 0 + + + DataDone + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT1 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 17 + 17 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT2 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 18 + 18 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT3 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 19 + 19 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT4 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 20 + 20 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT5 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 21 + 21 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT6 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 22 + 22 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + EPOUT7 + Acknowledged data transfer on this OUT endpoint. Write '1' to clear. + 23 + 23 + + + NotStarted + No acknowledged data transfer on this endpoint + 0 + + + Started + Acknowledged data transfer on this endpoint has occurred + 1 + + + + + + + USBADDR + Device USB address + 0x470 + read-only + + + ADDR + Device USB address + 0 + 6 + + + + + BMREQUESTTYPE + SETUP data, byte 0, bmRequestType + 0x480 + read-only + 0x00000000 + + + RECIPIENT + Data transfer type + 0 + 4 + + + Device + Device + 0 + + + Interface + Interface + 1 + + + Endpoint + Endpoint + 2 + + + Other + Other + 3 + + + + + TYPE + Data transfer type + 5 + 6 + + + Standard + Standard + 0 + + + Class + Class + 1 + + + Vendor + Vendor + 2 + + + + + DIRECTION + Data transfer direction + 7 + 7 + + + HostToDevice + Host-to-device + 0 + + + DeviceToHost + Device-to-host + 1 + + + + + + + BREQUEST + SETUP data, byte 1, bRequest + 0x484 + read-only + 0x00000000 + + + BREQUEST + SETUP data, byte 1, bRequest. Values provided for standard requests only, user must implement class and vendor values. + 0 + 7 + + + STD_GET_STATUS + Standard request GET_STATUS + 0 + + + STD_CLEAR_FEATURE + Standard request CLEAR_FEATURE + 1 + + + STD_SET_FEATURE + Standard request SET_FEATURE + 3 + + + STD_SET_ADDRESS + Standard request SET_ADDRESS + 5 + + + STD_GET_DESCRIPTOR + Standard request GET_DESCRIPTOR + 6 + + + STD_SET_DESCRIPTOR + Standard request SET_DESCRIPTOR + 7 + + + STD_GET_CONFIGURATION + Standard request GET_CONFIGURATION + 8 + + + STD_SET_CONFIGURATION + Standard request SET_CONFIGURATION + 9 + + + STD_GET_INTERFACE + Standard request GET_INTERFACE + 10 + + + STD_SET_INTERFACE + Standard request SET_INTERFACE + 11 + + + STD_SYNCH_FRAME + Standard request SYNCH_FRAME + 12 + + + + + + + WVALUEL + SETUP data, byte 2, LSB of wValue + 0x488 + read-only + 0x00000000 + + + WVALUEL + SETUP data, byte 2, LSB of wValue + 0 + 7 + + + + + WVALUEH + SETUP data, byte 3, MSB of wValue + 0x48C + read-only + 0x00000000 + + + WVALUEH + SETUP data, byte 3, MSB of wValue + 0 + 7 + + + + + WINDEXL + SETUP data, byte 4, LSB of wIndex + 0x490 + read-only + 0x00000000 + + + WINDEXL + SETUP data, byte 4, LSB of wIndex + 0 + 7 + + + + + WINDEXH + SETUP data, byte 5, MSB of wIndex + 0x494 + read-only + 0x00000000 + + + WINDEXH + SETUP data, byte 5, MSB of wIndex + 0 + 7 + + + + + WLENGTHL + SETUP data, byte 6, LSB of wLength + 0x498 + read-only + 0x00000000 + + + WLENGTHL + SETUP data, byte 6, LSB of wLength + 0 + 7 + + + + + WLENGTHH + SETUP data, byte 7, MSB of wLength + 0x49C + read-only + 0x00000000 + + + WLENGTHH + SETUP data, byte 7, MSB of wLength + 0 + 7 + + + + + SIZE + Unspecified + USBD_SIZE + 0x4A0 + + 0x8 + 0x4 + EPOUT[%s] + Description collection[n]: Number of bytes received last in the data stage of this OUT endpoint + 0x000 + read-write + + + SIZE + Number of bytes received last in the data stage of this OUT endpoint + 0 + 6 + + + + + ISOOUT + Number of bytes received last on this ISO OUT data endpoint + 0x020 + read-only + 0x00010000 + + + SIZE + Number of bytes received last on this ISO OUT data endpoint + 0 + 9 + + + ZERO + Zero-length data packet received + 16 + 16 + + + Normal + No zero-length data received, use value in SIZE + 0 + + + ZeroData + Zero-length data received, ignore value in SIZE + 1 + + + + + + + + ENABLE + Enable USB + 0x500 + read-write + + + ENABLE + Enable USB + 0 + 0 + + + Disabled + USB peripheral is disabled + 0 + + + Enabled + USB peripheral is enabled + 1 + + + + + + + USBPULLUP + Control of the USB pull-up + 0x504 + read-write + + + CONNECT + Control of the USB pull-up on the D+ line + 0 + 0 + + + Disabled + Pull-up is disconnected + 0 + + + Enabled + Pull-up is connected to D+ + 1 + + + + + + + DPDMVALUE + State D+ and D- lines will be forced into by the DPDMDRIVE task. The DPDMNODRIVE task reverts the control of the lines to MAC IP (no forcing). + 0x508 + read-write + + + STATE + State D+ and D- lines will be forced into by the DPDMDRIVE task + 0 + 4 + + + Resume + D+ forced low, D- forced high (K state) for a timing preset in hardware (50 us or 5 ms, depending on bus state) + 1 + + + J + D+ forced high, D- forced low (J state) + 2 + + + K + D+ forced low, D- forced high (K state) + 4 + + + + + + + DTOGGLE + Data toggle control and status + 0x50C + read-write + 0x00000100 + + + EP + Select bulk endpoint number + 0 + 2 + + + IO + Selects IN or OUT endpoint + 7 + 7 + + + Out + Selects OUT endpoint + 0 + + + In + Selects IN endpoint + 1 + + + + + VALUE + Data toggle value + 8 + 9 + + + Nop + No action on data toggle when writing the register with this value + 0 + + + Data0 + Data toggle is DATA0 on endpoint set by EP and IO + 1 + + + Data1 + Data toggle is DATA1 on endpoint set by EP and IO + 2 + + + + + + + EPINEN + Endpoint IN enable + 0x510 + read-write + 0x00000001 + + + IN0 + Enable IN endpoint 0 + 0 + 0 + + + Disable + Disable endpoint IN 0 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 0 (response to IN tokens) + 1 + + + + + IN1 + Enable IN endpoint 1 + 1 + 1 + + + Disable + Disable endpoint IN 1 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 1 (response to IN tokens) + 1 + + + + + IN2 + Enable IN endpoint 2 + 2 + 2 + + + Disable + Disable endpoint IN 2 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 2 (response to IN tokens) + 1 + + + + + IN3 + Enable IN endpoint 3 + 3 + 3 + + + Disable + Disable endpoint IN 3 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 3 (response to IN tokens) + 1 + + + + + IN4 + Enable IN endpoint 4 + 4 + 4 + + + Disable + Disable endpoint IN 4 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 4 (response to IN tokens) + 1 + + + + + IN5 + Enable IN endpoint 5 + 5 + 5 + + + Disable + Disable endpoint IN 5 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 5 (response to IN tokens) + 1 + + + + + IN6 + Enable IN endpoint 6 + 6 + 6 + + + Disable + Disable endpoint IN 6 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 6 (response to IN tokens) + 1 + + + + + IN7 + Enable IN endpoint 7 + 7 + 7 + + + Disable + Disable endpoint IN 7 (no response to IN tokens) + 0 + + + Enable + Enable endpoint IN 7 (response to IN tokens) + 1 + + + + + ISOIN + Enable ISO IN endpoint + 8 + 8 + + + Disable + Disable ISO IN endpoint 8 + 0 + + + Enable + Enable ISO IN endpoint 8 + 1 + + + + + + + EPOUTEN + Endpoint OUT enable + 0x514 + read-write + 0x00000001 + + + OUT0 + Enable OUT endpoint 0 + 0 + 0 + + + Disable + Disable endpoint OUT 0 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 0 (response to OUT tokens) + 1 + + + + + OUT1 + Enable OUT endpoint 1 + 1 + 1 + + + Disable + Disable endpoint OUT 1 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 1 (response to OUT tokens) + 1 + + + + + OUT2 + Enable OUT endpoint 2 + 2 + 2 + + + Disable + Disable endpoint OUT 2 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 2 (response to OUT tokens) + 1 + + + + + OUT3 + Enable OUT endpoint 3 + 3 + 3 + + + Disable + Disable endpoint OUT 3 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 3 (response to OUT tokens) + 1 + + + + + OUT4 + Enable OUT endpoint 4 + 4 + 4 + + + Disable + Disable endpoint OUT 4 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 4 (response to OUT tokens) + 1 + + + + + OUT5 + Enable OUT endpoint 5 + 5 + 5 + + + Disable + Disable endpoint OUT 5 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 5 (response to OUT tokens) + 1 + + + + + OUT6 + Enable OUT endpoint 6 + 6 + 6 + + + Disable + Disable endpoint OUT 6 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 6 (response to OUT tokens) + 1 + + + + + OUT7 + Enable OUT endpoint 7 + 7 + 7 + + + Disable + Disable endpoint OUT 7 (no response to OUT tokens) + 0 + + + Enable + Enable endpoint OUT 7 (response to OUT tokens) + 1 + + + + + ISOOUT + Enable ISO OUT endpoint 8 + 8 + 8 + + + Disable + Disable ISO OUT endpoint 8 + 0 + + + Enable + Enable ISO OUT endpoint 8 + 1 + + + + + + + EPSTALL + STALL endpoints + 0x518 + write-only + 0x00000000 + modifyExternal + + + EP + Select endpoint number + 0 + 2 + + + IO + Selects IN or OUT endpoint + 7 + 7 + + + Out + Selects OUT endpoint + 0 + + + In + Selects IN endpoint + 1 + + + + + STALL + Stall selected endpoint + 8 + 8 + + + UnStall + Don't stall selected endpoint + 0 + + + Stall + Stall selected endpoint + 1 + + + + + + + ISOSPLIT + Controls the split of ISO buffers + 0x51C + read-write + + + SPLIT + Controls the split of ISO buffers + 0 + 15 + + + OneDir + Full buffer dedicated to either iso IN or OUT + 0x0000 + + + HalfIN + Lower half for IN, upper half for OUT + 0x0080 + + + + + + + FRAMECNTR + Returns the current value of the start of frame counter + 0x520 + read-only + + + FRAMECNTR + Returns the current value of the start of frame counter + 0 + 10 + + + + + LOWPOWER + Controls USBD peripheral low power mode during USB suspend + 0x52C + read-write + 0x00000000 + + + LOWPOWER + Controls USBD peripheral low-power mode during USB suspend + 0 + 0 + + + ForceNormal + Software must write this value to exit low power mode and before performing a remote wake-up + 0 + + + LowPower + Software must write this value to enter low power mode after DMA and software have finished interacting with the USB peripheral + 1 + + + + + + + ISOINCONFIG + Controls the response of the ISO IN endpoint to an IN token when no data is ready to be sent + 0x530 + read-write + + + RESPONSE + Controls the response of the ISO IN endpoint to an IN token when no data is ready to be sent + 0 + 0 + + + NoResp + Endpoint does not respond in that case + 0 + + + ZeroData + Endpoint responds with a zero-length data packet in that case + 1 + + + + + + + 8 + 0x014 + EPIN[%s] + Unspecified + USBD_EPIN + 0x600 + + PTR + Description cluster[n]: Data pointer + 0x000 + read-write + + + PTR + Data pointer. Accepts any address in Data RAM. + 0 + 31 + + + + + MAXCNT + Description cluster[n]: Maximum number of bytes to transfer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes to transfer + 0 + 6 + + + + + AMOUNT + Description cluster[n]: Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 6 + + + + + + ISOIN + Unspecified + USBD_ISOIN + 0x6A0 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer. Accepts any address in Data RAM. + 0 + 31 + + + + + MAXCNT + Maximum number of bytes to transfer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes to transfer + 0 + 9 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 9 + + + + + + 8 + 0x014 + EPOUT[%s] + Unspecified + USBD_EPOUT + 0x700 + + PTR + Description cluster[n]: Data pointer + 0x000 + read-write + + + PTR + Data pointer. Accepts any address in Data RAM. + 0 + 31 + + + + + MAXCNT + Description cluster[n]: Maximum number of bytes to transfer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes to transfer + 0 + 6 + + + + + AMOUNT + Description cluster[n]: Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 6 + + + + + + ISOOUT + Unspecified + USBD_ISOOUT + 0x7A0 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer. Accepts any address in Data RAM. + 0 + 31 + + + + + MAXCNT + Maximum number of bytes to transfer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes to transfer + 0 + 9 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 9 + + + + + + + + UARTE1 + UART with EasyDMA 1 + 0x40028000 + + UARTE1 + 40 + + + + QSPI + External flash interface + 0x40029000 + + 0 + 0x1000 + registers + + + QSPI + 41 + + QSPI + 0x20 + + + TASKS_ACTIVATE + Activate QSPI interface + 0x000 + write-only + + + TASKS_ACTIVATE + 0 + 0 + + + + + TASKS_READSTART + Start transfer from external flash memory to internal RAM + 0x004 + write-only + + + TASKS_READSTART + 0 + 0 + + + + + TASKS_WRITESTART + Start transfer from internal RAM to external flash memory + 0x008 + write-only + + + TASKS_WRITESTART + 0 + 0 + + + + + TASKS_ERASESTART + Start external flash memory erase operation + 0x00C + write-only + + + TASKS_ERASESTART + 0 + 0 + + + + + TASKS_DEACTIVATE + Deactivate QSPI interface + 0x010 + write-only + + + TASKS_DEACTIVATE + 0 + 0 + + + + + EVENTS_READY + QSPI peripheral is ready. This event will be generated as a response to any QSPI task. + 0x100 + read-write + + + EVENTS_READY + 0 + 0 + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + READY + Enable or disable interrupt for READY event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to enable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to disable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + Enable QSPI peripheral and acquire the pins selected in PSELn registers + 0x500 + read-write + + + ENABLE + Enable or disable QSPI + 0 + 0 + + + Disabled + Disable QSPI + 0 + + + Enabled + Enable QSPI + 1 + + + + + + + READ + Unspecified + QSPI_READ + 0x504 + + SRC + Flash memory source address + 0x000 + read-write + + + SRC + Word-aligned flash memory source address. + 0 + 31 + + + + + DST + RAM destination address + 0x004 + read-write + + + DST + Word-aligned RAM destination address. + 0 + 31 + + + + + CNT + Read transfer length + 0x008 + read-write + + + CNT + Read transfer length in number of bytes. The length must be a multiple of 4 bytes. + 0 + 20 + + + + + + WRITE + Unspecified + QSPI_WRITE + 0x510 + + DST + Flash destination address + 0x000 + read-write + + + DST + Word-aligned flash destination address. + 0 + 31 + + + + + SRC + RAM source address + 0x004 + read-write + + + SRC + Word-aligned RAM source address. + 0 + 31 + + + + + CNT + Write transfer length + 0x008 + read-write + + + CNT + Write transfer length in number of bytes. The length must be a multiple of 4 bytes. + 0 + 20 + + + + + + ERASE + Unspecified + QSPI_ERASE + 0x51C + + PTR + Start address of flash block to be erased + 0x000 + read-write + + + PTR + Word-aligned start address of block to be erased. + 0 + 31 + + + + + LEN + Size of block to be erased. + 0x004 + read-write + + + LEN + LEN + 0 + 1 + + + 4KB + Erase 4 kB block (flash command 0x20) + 0 + + + 64KB + Erase 64 kB block (flash command 0xD8) + 1 + + + All + Erase all (flash command 0xC7) + 2 + + + + + + + + PSEL + Unspecified + QSPI_PSEL + 0x524 + + SCK + Pin select for serial clock SCK + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + CSN + Pin select for chip select signal CSN. + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + IO0 + Pin select for serial data MOSI/IO0. + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + IO1 + Pin select for serial data MISO/IO1. + 0x010 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + IO2 + Pin select for serial data IO2. + 0x014 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + IO3 + Pin select for serial data IO3. + 0x018 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + PORT + Port number + 5 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + XIPOFFSET + Address offset into the external memory for Execute in Place operation. + 0x540 + read-write + + + XIPOFFSET + Address offset into the external memory for Execute in Place operation. Value must be a multiple of 4. + 0 + 31 + + + + + IFCONFIG0 + Interface configuration. + 0x544 + read-write + + + READOC + Configure number of data lines and opcode used for reading. + 0 + 2 + + + FASTREAD + Single data line SPI. FAST_READ (opcode 0x0B). + 0 + + + READ2O + Dual data line SPI. READ2O (opcode 0x3B). + 1 + + + READ2IO + Dual data line SPI. READ2IO (opcode 0xBB). + 2 + + + READ4O + Quad data line SPI. READ4O (opcode 0x6B). + 3 + + + READ4IO + Quad data line SPI. READ4IO (opcode 0xEB). + 4 + + + + + WRITEOC + Configure number of data lines and opcode used for writing. + 3 + 5 + + + PP + Single data line SPI. PP (opcode 0x02). + 0 + + + PP2O + Dual data line SPI. PP2O (opcode 0xA2). + 1 + + + PP4O + Quad data line SPI. PP4O (opcode 0x32). + 2 + + + PP4IO + Quad data line SPI. PP4IO (opcode 0x38). + 3 + + + + + ADDRMODE + Addressing mode. + 6 + 6 + + + 24BIT + 24-bit addressing. + 0 + + + 32BIT + 32-bit addressing. + 1 + + + + + DPMENABLE + Enable deep power-down mode (DPM) feature. + 7 + 7 + + + Disable + Disable DPM feature. + 0 + + + Enable + Enable DPM feature. + 1 + + + + + PPSIZE + Page size for commands PP, PP2O, PP4O and PP4IO. + 12 + 12 + + + 256Bytes + 256 bytes. + 0 + + + 512Bytes + 512 bytes. + 1 + + + + + + + IFCONFIG1 + Interface configuration. + 0x600 + read-write + 0x00040480 + + + SCKDELAY + Minimum amount of time that the CSN pin must stay high before it can go low again. Value is specified in number of 16 MHz periods (62.5 ns). + 0 + 7 + + + DPMEN + Enter/exit deep power-down mode (DPM) for external flash memory. + 24 + 24 + + + Exit + Exit DPM. + 0 + + + Enter + Enter DPM. + 1 + + + + + SPIMODE + Select SPI mode. + 25 + 25 + + + MODE0 + Mode 0: Data are captured on the clock rising edge and data is output on a falling edge. Base level of clock is 0 (CPOL=0, CPHA=0). + 0 + + + MODE3 + Mode 3: Data are captured on the clock falling edge and data is output on a rising edge. Base level of clock is 1 (CPOL=1, CPHA=1). + 1 + + + + + SCKFREQ + SCK frequency is given as 32 MHz / (SCKFREQ + 1). + 28 + 31 + + + + + STATUS + Status register. + 0x604 + read-only + + + DPM + Deep power-down mode (DPM) status of external flash. + 2 + 2 + + + Disabled + External flash is not in DPM. + 0 + + + Enabled + External flash is in DPM. + 1 + + + + + READY + Ready status. + 3 + 3 + + + READY + QSPI peripheral is ready. It is allowed to trigger new tasks, writing custom instructions or enter/exit DPM. + 1 + + + BUSY + QSPI peripheral is busy. It is not allowed to trigger any new tasks, writing custom instructions or enter/exit DPM. + 0 + + + + + SREG + Value of external flash device Status Register. When the external flash has two bytes status register this field includes the value of the low byte. + 24 + 31 + + + + + DPMDUR + Set the duration required to enter/exit deep power-down mode (DPM). + 0x614 + read-write + 0xFFFFFFFF + + + ENTER + Duration needed by external flash to enter DPM. Duration is given as ENTER * 256 * 62.5 ns. + 0 + 15 + + + EXIT + Duration needed by external flash to exit DPM. Duration is given as EXIT * 256 * 62.5 ns. + 16 + 31 + + + + + ADDRCONF + Extended address configuration. + 0x624 + read-write + 0x000000B7 + + + OPCODE + Opcode that enters the 32-bit addressing mode. + 0 + 7 + + + BYTE0 + Byte 0 following opcode. + 8 + 15 + + + BYTE1 + Byte 1 following byte 0. + 16 + 23 + + + MODE + Extended addressing mode. + 24 + 25 + + + NoInstr + Do not send any instruction. + 0 + + + Opcode + Send opcode. + 1 + + + OpByte0 + Send opcode, byte0. + 2 + + + All + Send opcode, byte0, byte1. + 3 + + + + + WIPWAIT + Wait for write complete before sending command. + 26 + 26 + + + Disable + No wait. + 0 + + + Enable + Wait. + 1 + + + + + WREN + Send WREN (write enable opcode 0x06) before instruction. + 27 + 27 + + + Disable + Do not send WREN. + 0 + + + Enable + Send WREN. + 1 + + + + + + + CINSTRCONF + Custom instruction configuration register. + 0x634 + read-write + 0x00002000 + + + OPCODE + Opcode of Custom instruction. + 0 + 7 + + + LENGTH + Length of custom instruction in number of bytes. + 8 + 11 + + + 1B + Send opcode only. + 1 + + + 2B + Send opcode, CINSTRDAT0.BYTE0. + 2 + + + 3B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT0.BYTE1. + 3 + + + 4B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT0.BYTE2. + 4 + + + 5B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT0.BYTE3. + 5 + + + 6B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE4. + 6 + + + 7B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE5. + 7 + + + 8B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE6. + 8 + + + 9B + Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE7. + 9 + + + + + LIO2 + Level of the IO2 pin (if connected) during transmission of custom instruction. + 12 + 12 + + + LIO3 + Level of the IO3 pin (if connected) during transmission of custom instruction. + 13 + 13 + + + WIPWAIT + Wait for write complete before sending command. + 14 + 14 + + + Disable + No wait. + 0 + + + Enable + Wait. + 1 + + + + + WREN + Send WREN (write enable opcode 0x06) before instruction. + 15 + 15 + + + Disable + Do not send WREN. + 0 + + + Enable + Send WREN. + 1 + + + + + LFEN + Enable long frame mode. When enabled, a custom instruction transaction has to be ended by writing the LFSTOP field. + 16 + 16 + + + Disable + Long frame mode disabled + 0 + + + Enable + Long frame mode enabled + 1 + + + + + LFSTOP + Stop (finalize) long frame transaction + 17 + 17 + + + Stop + Stop + 1 + + + + + + + CINSTRDAT0 + Custom instruction data register 0. + 0x638 + read-write + + + BYTE0 + Data byte 0 + 0 + 7 + + + BYTE1 + Data byte 1 + 8 + 15 + + + BYTE2 + Data byte 2 + 16 + 23 + + + BYTE3 + Data byte 3 + 24 + 31 + + + + + CINSTRDAT1 + Custom instruction data register 1. + 0x63C + read-write + + + BYTE4 + Data byte 4 + 0 + 7 + + + BYTE5 + Data byte 5 + 8 + 15 + + + BYTE6 + Data byte 6 + 16 + 23 + + + BYTE7 + Data byte 7 + 24 + 31 + + + + + IFTIMING + SPI interface timing. + 0x640 + read-write + 0x00000200 + + + RXDELAY + Timing related to sampling of the input serial data. The value of RXDELAY specifies the number of 64 MHz cycles (15.625 ns) delay from the the rising edge of the SPI Clock (SCK) until the input serial data is sampled. As en example, if set to 0 the input serial data is sampled on the rising edge of SCK. + 8 + 10 + + + + + + + PWM3 + Pulse width modulation unit 3 + 0x4002D000 + + PWM3 + 45 + + + + SPIM3 + Serial Peripheral Interface Master with EasyDMA 3 + 0x4002F000 + + SPIM3 + 47 + + + + P0 + GPIO Port 1 + 0x50000000 + GPIO + + 0 + 0x1000 + registers + + GPIO + 0x20 + + + OUT + Write GPIO port + 0x504 + read-write + + + PIN0 + Pin 0 + 0 + 0 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + + + OUTSET + Set individual bits in GPIO port + 0x508 + read-write + oneToSet + + + PIN0 + Pin 0 + 0 + 0 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + + + OUTCLR + Clear individual bits in GPIO port + 0x50C + read-write + oneToClear + + + PIN0 + Pin 0 + 0 + 0 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + + + IN + Read GPIO port + 0x510 + read-only + + + PIN0 + Pin 0 + 0 + 0 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + + + DIR + Direction of GPIO pins + 0x514 + read-write + + + PIN0 + Pin 0 + 0 + 0 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + + + DIRSET + DIR set register + 0x518 + read-write + oneToSet + + + PIN0 + Set as output pin 0 + 0 + 0 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN1 + Set as output pin 1 + 1 + 1 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN2 + Set as output pin 2 + 2 + 2 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN3 + Set as output pin 3 + 3 + 3 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN4 + Set as output pin 4 + 4 + 4 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN5 + Set as output pin 5 + 5 + 5 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN6 + Set as output pin 6 + 6 + 6 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN7 + Set as output pin 7 + 7 + 7 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN8 + Set as output pin 8 + 8 + 8 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN9 + Set as output pin 9 + 9 + 9 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN10 + Set as output pin 10 + 10 + 10 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN11 + Set as output pin 11 + 11 + 11 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN12 + Set as output pin 12 + 12 + 12 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN13 + Set as output pin 13 + 13 + 13 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN14 + Set as output pin 14 + 14 + 14 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN15 + Set as output pin 15 + 15 + 15 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN16 + Set as output pin 16 + 16 + 16 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN17 + Set as output pin 17 + 17 + 17 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN18 + Set as output pin 18 + 18 + 18 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN19 + Set as output pin 19 + 19 + 19 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN20 + Set as output pin 20 + 20 + 20 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN21 + Set as output pin 21 + 21 + 21 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN22 + Set as output pin 22 + 22 + 22 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN23 + Set as output pin 23 + 23 + 23 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN24 + Set as output pin 24 + 24 + 24 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN25 + Set as output pin 25 + 25 + 25 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN26 + Set as output pin 26 + 26 + 26 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN27 + Set as output pin 27 + 27 + 27 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN28 + Set as output pin 28 + 28 + 28 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN29 + Set as output pin 29 + 29 + 29 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN30 + Set as output pin 30 + 30 + 30 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN31 + Set as output pin 31 + 31 + 31 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + + + DIRCLR + DIR clear register + 0x51C + read-write + oneToClear + + + PIN0 + Set as input pin 0 + 0 + 0 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN1 + Set as input pin 1 + 1 + 1 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN2 + Set as input pin 2 + 2 + 2 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN3 + Set as input pin 3 + 3 + 3 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN4 + Set as input pin 4 + 4 + 4 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN5 + Set as input pin 5 + 5 + 5 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN6 + Set as input pin 6 + 6 + 6 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN7 + Set as input pin 7 + 7 + 7 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN8 + Set as input pin 8 + 8 + 8 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN9 + Set as input pin 9 + 9 + 9 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN10 + Set as input pin 10 + 10 + 10 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN11 + Set as input pin 11 + 11 + 11 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN12 + Set as input pin 12 + 12 + 12 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN13 + Set as input pin 13 + 13 + 13 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN14 + Set as input pin 14 + 14 + 14 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN15 + Set as input pin 15 + 15 + 15 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN16 + Set as input pin 16 + 16 + 16 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN17 + Set as input pin 17 + 17 + 17 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN18 + Set as input pin 18 + 18 + 18 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN19 + Set as input pin 19 + 19 + 19 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN20 + Set as input pin 20 + 20 + 20 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN21 + Set as input pin 21 + 21 + 21 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN22 + Set as input pin 22 + 22 + 22 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN23 + Set as input pin 23 + 23 + 23 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN24 + Set as input pin 24 + 24 + 24 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN25 + Set as input pin 25 + 25 + 25 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN26 + Set as input pin 26 + 26 + 26 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN27 + Set as input pin 27 + 27 + 27 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN28 + Set as input pin 28 + 28 + 28 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN29 + Set as input pin 29 + 29 + 29 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN30 + Set as input pin 30 + 30 + 30 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN31 + Set as input pin 31 + 31 + 31 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + + + LATCH + Latch register indicating what GPIO pins that have met the criteria set in the PIN_CNF[n].SENSE registers + 0x520 + read-write + + + PIN0 + Status on whether PIN0 has met criteria set in PIN_CNF0.SENSE register. Write '1' to clear. + 0 + 0 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN1 + Status on whether PIN1 has met criteria set in PIN_CNF1.SENSE register. Write '1' to clear. + 1 + 1 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN2 + Status on whether PIN2 has met criteria set in PIN_CNF2.SENSE register. Write '1' to clear. + 2 + 2 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN3 + Status on whether PIN3 has met criteria set in PIN_CNF3.SENSE register. Write '1' to clear. + 3 + 3 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN4 + Status on whether PIN4 has met criteria set in PIN_CNF4.SENSE register. Write '1' to clear. + 4 + 4 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN5 + Status on whether PIN5 has met criteria set in PIN_CNF5.SENSE register. Write '1' to clear. + 5 + 5 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN6 + Status on whether PIN6 has met criteria set in PIN_CNF6.SENSE register. Write '1' to clear. + 6 + 6 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN7 + Status on whether PIN7 has met criteria set in PIN_CNF7.SENSE register. Write '1' to clear. + 7 + 7 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN8 + Status on whether PIN8 has met criteria set in PIN_CNF8.SENSE register. Write '1' to clear. + 8 + 8 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN9 + Status on whether PIN9 has met criteria set in PIN_CNF9.SENSE register. Write '1' to clear. + 9 + 9 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN10 + Status on whether PIN10 has met criteria set in PIN_CNF10.SENSE register. Write '1' to clear. + 10 + 10 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN11 + Status on whether PIN11 has met criteria set in PIN_CNF11.SENSE register. Write '1' to clear. + 11 + 11 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN12 + Status on whether PIN12 has met criteria set in PIN_CNF12.SENSE register. Write '1' to clear. + 12 + 12 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN13 + Status on whether PIN13 has met criteria set in PIN_CNF13.SENSE register. Write '1' to clear. + 13 + 13 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN14 + Status on whether PIN14 has met criteria set in PIN_CNF14.SENSE register. Write '1' to clear. + 14 + 14 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN15 + Status on whether PIN15 has met criteria set in PIN_CNF15.SENSE register. Write '1' to clear. + 15 + 15 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN16 + Status on whether PIN16 has met criteria set in PIN_CNF16.SENSE register. Write '1' to clear. + 16 + 16 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN17 + Status on whether PIN17 has met criteria set in PIN_CNF17.SENSE register. Write '1' to clear. + 17 + 17 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN18 + Status on whether PIN18 has met criteria set in PIN_CNF18.SENSE register. Write '1' to clear. + 18 + 18 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN19 + Status on whether PIN19 has met criteria set in PIN_CNF19.SENSE register. Write '1' to clear. + 19 + 19 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN20 + Status on whether PIN20 has met criteria set in PIN_CNF20.SENSE register. Write '1' to clear. + 20 + 20 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN21 + Status on whether PIN21 has met criteria set in PIN_CNF21.SENSE register. Write '1' to clear. + 21 + 21 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN22 + Status on whether PIN22 has met criteria set in PIN_CNF22.SENSE register. Write '1' to clear. + 22 + 22 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN23 + Status on whether PIN23 has met criteria set in PIN_CNF23.SENSE register. Write '1' to clear. + 23 + 23 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN24 + Status on whether PIN24 has met criteria set in PIN_CNF24.SENSE register. Write '1' to clear. + 24 + 24 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN25 + Status on whether PIN25 has met criteria set in PIN_CNF25.SENSE register. Write '1' to clear. + 25 + 25 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN26 + Status on whether PIN26 has met criteria set in PIN_CNF26.SENSE register. Write '1' to clear. + 26 + 26 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN27 + Status on whether PIN27 has met criteria set in PIN_CNF27.SENSE register. Write '1' to clear. + 27 + 27 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN28 + Status on whether PIN28 has met criteria set in PIN_CNF28.SENSE register. Write '1' to clear. + 28 + 28 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN29 + Status on whether PIN29 has met criteria set in PIN_CNF29.SENSE register. Write '1' to clear. + 29 + 29 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN30 + Status on whether PIN30 has met criteria set in PIN_CNF30.SENSE register. Write '1' to clear. + 30 + 30 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN31 + Status on whether PIN31 has met criteria set in PIN_CNF31.SENSE register. Write '1' to clear. + 31 + 31 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + + + DETECTMODE + Select between default DETECT signal behaviour and LDETECT mode + 0x524 + read-write + + + DETECTMODE + Select between default DETECT signal behaviour and LDETECT mode + 0 + 0 + + + Default + DETECT directly connected to PIN DETECT signals + 0 + + + LDETECT + Use the latched LDETECT behaviour + 1 + + + + + + + 0x20 + 0x4 + PIN_CNF[%s] + Description collection[n]: Configuration of GPIO pins + 0x700 + read-write + 0x00000002 + + + DIR + Pin direction. Same physical register as DIR register + 0 + 0 + + + Input + Configure pin as an input pin + 0 + + + Output + Configure pin as an output pin + 1 + + + + + INPUT + Connect or disconnect input buffer + 1 + 1 + + + Connect + Connect input buffer + 0 + + + Disconnect + Disconnect input buffer + 1 + + + + + PULL + Pull configuration + 2 + 3 + + + Disabled + No pull + 0 + + + Pulldown + Pull down on pin + 1 + + + Pullup + Pull up on pin + 3 + + + + + DRIVE + Drive configuration + 8 + 10 + + + S0S1 + Standard '0', standard '1' + 0 + + + H0S1 + High drive '0', standard '1' + 1 + + + S0H1 + Standard '0', high drive '1' + 2 + + + H0H1 + High drive '0', high 'drive '1'' + 3 + + + D0S1 + Disconnect '0' standard '1' (normally used for wired-or connections) + 4 + + + D0H1 + Disconnect '0', high drive '1' (normally used for wired-or connections) + 5 + + + S0D1 + Standard '0'. disconnect '1' (normally used for wired-and connections) + 6 + + + H0D1 + High drive '0', disconnect '1' (normally used for wired-and connections) + 7 + + + + + SENSE + Pin sensing mechanism + 16 + 17 + + + Disabled + Disabled + 0 + + + High + Sense for high level + 2 + + + Low + Sense for low level + 3 + + + + + + + + + P1 + GPIO Port 2 + 0x50000300 + P0 + + + CC_HOST_RGF + CRYPTOCELL HOST_RGF interface + 0x5002A000 + + 0 + 0x2000 + registers + + CC_HOST_RGF + 0x20 + + + HOST_CRYPTOKEY_SEL + AES hardware key select + 0x1A38 + read-write + 0x00000000 + + + HOST_CRYPTOKEY_SEL + Select the source of the HW key that is used by the AES engine + 0 + 1 + + + K_DR + Use device root key K_DR from CRYPTOCELL AO power domain + 0 + + + K_PRTL + Use hard-coded RTL key K_PRTL + 1 + + + Session + Use provided session key + 2 + + + + + + + HOST_IOT_KPRTL_LOCK + This write-once register is the K_PRTL lock register. When this register is set, K_PRTL can not be used and a zeroed key will be used instead. The value of this register is saved in the CRYPTOCELL AO power domain. + 0x1A4C + read-write + 0x00000000 + + + HOST_IOT_KPRTL_LOCK + This register is the K_PRTL lock register. When this register is set, K_PRTL can not be used and a zeroed key will be used instead. The value of this register is saved in the CRYPTOCELL AO power domain. + 0 + 0 + + + Disabled + K_PRTL can be selected for use from register HOST_CRYPTOKEY_SEL + 0 + + + Enabled + K_PRTL has been locked until next power-on reset (POR). If K_PRTL is selected anyway, a zeroed key will be used instead. + 1 + + + + + + + HOST_IOT_KDR0 + This register holds bits 31:0 of K_DR. The value of this register is saved in the CRYPTOCELL AO power domain. Reading from this address returns the K_DR valid status indicating if K_DR is successfully retained. + 0x1A50 + read-write + 0x00000000 + + + HOST_IOT_KDR0 + Write: K_DR bits 31:0 Read: 0x00000000 when 128-bit K_DR key value is not yet retained in the CRYPTOCELL AO power domain Read: 0x00000001 when 128-bit K_DR key value is successfully retained in the CRYPTOCELL AO power domain + 0 + 31 + + + + + HOST_IOT_KDR1 + This register holds bits 63:32 of K_DR. The value of this register is saved in the CRYPTOCELL AO power domain. + 0x1A54 + write-only + 0x00000000 + + + HOST_IOT_KDR1 + K_DR bits 63:32 + 0 + 31 + + + + + HOST_IOT_KDR2 + This register holds bits 95:64 of K_DR. The value of this register is saved in the CRYPTOCELL AO power domain. + 0x1A58 + write-only + 0x00000000 + + + HOST_IOT_KDR2 + K_DR bits 95:64 + 0 + 31 + + + + + HOST_IOT_KDR3 + This register holds bits 127:96 of K_DR. The value of this register is saved in the CRYPTOCELL AO power domain. + 0x1A5C + write-only + 0x00000000 + + + HOST_IOT_KDR3 + K_DR bits 127:96 + 0 + 31 + + + + + HOST_IOT_LCS + Controls lifecycle state (LCS) for CRYPTOCELL subsystem + 0x1A60 + read-write + 0x00000002 + + + LCS + Lifecycle state value. This field is write-once per reset. + 0 + 2 + + + Debug + CC310 operates in debug mode + 0 + + + Secure + CC310 operates in secure mode + 2 + + + + + LCS_IS_VALID + This field is read-only and indicates if CRYPTOCELL LCS has been successfully configured since last reset + 8 + 8 + + + Invalid + A valid LCS is not yet retained in the CRYPTOCELL AO power domain + 0 + + + Valid + A valid LCS is successfully retained in the CRYPTOCELL AO power domain + 1 + + + + + + + + + CRYPTOCELL + ARM TrustZone CryptoCell register interface + 0x5002A000 + CC_HOST_RGF + + 0 + 0x2000 + registers + + + CRYPTOCELL + 42 + + CRYPTOCELL + 0x20 + + + ENABLE + Enable CRYPTOCELL subsystem + 0x500 + read-write + 0x00000000 + + + ENABLE + Enable or disable the CRYPTOCELL subsystem + 0 + 0 + + + Disabled + CRYPTOCELL subsystem disabled + 0 + + + Enabled + CRYPTOCELL subsystem enabled + 1 + + + + + + + + + \ No newline at end of file diff --git a/res/nrf52-arm/tasks.json b/res/nrf52-arm/tasks.json new file mode 100644 index 00000000..72098710 --- /dev/null +++ b/res/nrf52-arm/tasks.json @@ -0,0 +1,53 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "options": { + "shell": { + "executable": "/usr/bin/bash", + "args": ["-l", "-c"] + } + }, + "tasks": [ + { + "label": "cargo build", + "type": "shell", + "command": "cargo", + "args": [ + "build", + "--target=thumbv7em-none-eabihf", + "--example", + "lms_demo_nrf52" + ], + // "problemMatcher": [ + // "$rustc" + // ], + "group": "build", + }, + { + "label": "cargo clean", + "type": "shell", + "command": "cargo", + "args": [ + "clean" + ], + // "problemMatcher": [ + // "$rustc" + // ], + "group": "build", + }, + { + "label": "cargo run", + "type": "shell", + "command": "cargo", + "args": [ + "run" + ], + // "problemMatcher": [ + // "$rustc" + // ], + "group": "build", + }, + + ] +}