mbed library sources
Fork of mbed-src by
Diff: targets/cmsis/TARGET_NORDIC/TARGET_NRF51822/system_nrf51822.c
- Revision:
- 104:a6a92e2e5a92
- Parent:
- 85:e1a8e879a6a9
- Child:
- 127:ce7cebc0511f
--- a/targets/cmsis/TARGET_NORDIC/TARGET_NRF51822/system_nrf51822.c Thu Feb 20 23:00:08 2014 +0000 +++ b/targets/cmsis/TARGET_NORDIC/TARGET_NRF51822/system_nrf51822.c Fri Feb 21 12:15:10 2014 +0000 @@ -1,6 +1,6 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2013 Nordic Semiconductor. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,33 +43,19 @@ } void SystemInit(void) -{ +{ + NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos); + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ + } + //write FWID (NRF_UICR->FWID is readonly) + *(uint32_t *)0x10001010 = 0xFFFF0049; - //Write the necessary UICR and FWID values if needed - if (NRF_UICR->CLENR0 == 0xFFFFFFFF){ - NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos); - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ - } - - NRF_UICR->CLENR0 = 0x14000; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ - } - - //write FWID (NRF_UICR->FWID is readonly) - *(uint32_t *)0x10001010 = 0xFFFF0049; - - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ - } - - NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos); - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ - } - - NVIC_SystemReset(); - while (true){ - } + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ } - + + NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos); + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ + } // Prepare the peripherals for use as indicated by the PAN 26 "System: Manual setup is required // to enable the use of peripherals" found at Product Anomaly document for your device found at // https://www.nordicsemi.com/. The side effect of executing these instructions in the devices