Skip to content

Implement MultiwriteNorFlash for nRF52 boards that support it #373

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions nrf-hal-common/src/nvmc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ where
}
}

// Only nRF52 boards have been checked. There are 2 things to note:
//
// 1. The nRF52832 doesn't support 2 writes per word. Instead it supports 181 writes per block,
// where a block is 128 words. So on average it's a bit less than 2 writes per word, and thus we
// can't implement MultiwriteNorFlash.
//
// 2. The nRF52820 supports 2 writes per word but doesn't have an associated feature.
#[cfg(any(
feature = "52810",
feature = "52811",
feature = "52833",
feature = "52840",
))]
impl<T: Instance> embedded_storage::nor_flash::MultiwriteNorFlash for Nvmc<T> {}

pub trait Instance: Deref<Target = nvmc::RegisterBlock> + sealed::Sealed {}

impl Instance for NVMC {}
Expand Down