aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/lib.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-12-03 20:27:02 +0000
committerGitHub <[email protected]>2023-12-03 20:27:02 +0000
commit9ba3aeada40afd3cafd64e73fee91896c15d7c8d (patch)
treee6381f751a1022f29f41f657b26b49aa3955cc99 /embassy-nrf/src/lib.rs
parenta31ae52d1a7e0607edeaea9acf30b03ea510fd83 (diff)
parentdd62bb16e541dae3ed6471d170f6de68a2a03252 (diff)
Merge pull request #2243 from peter9477/nrf52-approtect-fix
minimum build code for new APPROTECT is chip type-specific
Diffstat (limited to 'embassy-nrf/src/lib.rs')
-rw-r--r--embassy-nrf/src/lib.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs
index ed8aad89b..3274dafb1 100644
--- a/embassy-nrf/src/lib.rs
+++ b/embassy-nrf/src/lib.rs
@@ -349,10 +349,11 @@ pub fn init(config: config::Config) -> Peripherals {
349 // Get the letter for the build code (b'A' .. b'F') 349 // Get the letter for the build code (b'A' .. b'F')
350 let build_code = (variant >> 8) as u8; 350 let build_code = (variant >> 8) as u8;
351 351
352 if build_code >= b'F' { 352 if build_code >= chip::APPROTECT_MIN_BUILD_CODE {
353 // Chips with build code F and higher (revision 3 and higher) have an 353 // Chips with a certain chip type-specific build code or higher have an
354 // improved APPROTECT ("hardware and software controlled access port protection") 354 // improved APPROTECT ("hardware and software controlled access port protection")
355 // which needs explicit action by the firmware to keep it unlocked 355 // which needs explicit action by the firmware to keep it unlocked
356 // See https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/working-with-the-nrf52-series-improved-approtect
356 357
357 // UICR.APPROTECT = SwDisabled 358 // UICR.APPROTECT = SwDisabled
358 let res = uicr_write(consts::UICR_APPROTECT, consts::APPROTECT_DISABLED); 359 let res = uicr_write(consts::UICR_APPROTECT, consts::APPROTECT_DISABLED);