mirror of https://github.com/ARMmbed/mbed-os.git
Hardcoded location for FWID is used.
parent
b77d61416f
commit
43fe5a4e44
|
@ -11,17 +11,13 @@
|
|||
*/
|
||||
|
||||
|
||||
|
||||
/* NOTE: Template files (including this one) are application specific and therefore expected to
|
||||
be copied into the application project folder prior to its use! */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "nrf51822.h"
|
||||
#include "system_nrf51822.h"
|
||||
|
||||
|
||||
#define __SYSTEM_CLOCK (16000000UL) /*!< nRF51 devices use a fixed System Clock Frequency of 16MHz */
|
||||
#define __SYSTEM_CLOCK (16000000UL) //!< nRF51 devices use a fixed System Clock Frequency of 16MHz
|
||||
|
||||
static bool is_manual_peripheral_setup_needed(void);
|
||||
static bool is_disabled_in_debug_needed(void);
|
||||
|
@ -43,7 +39,8 @@ void SystemCoreClockUpdate(void)
|
|||
|
||||
void SystemInit(void)
|
||||
{
|
||||
/* Write the necessary UICR values if needed */
|
||||
|
||||
//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){
|
||||
|
@ -53,7 +50,9 @@ void SystemInit(void)
|
|||
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
|
||||
}
|
||||
|
||||
NRF_UICR->FWID = 0xFFFF0049;
|
||||
//write FWID (NRF_UICR->FWID is readonly)
|
||||
*(uint32_t *)0x10001010 = 0xFFFF0049;
|
||||
|
||||
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
|
||||
}
|
||||
|
||||
|
@ -66,19 +65,20 @@ void SystemInit(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* 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
|
||||
that do not need it is that the new peripherals in the second generation devices (LPCOMP for
|
||||
example) will not be available. */
|
||||
// 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
|
||||
// that do not need it is that the new peripherals in the second generation devices (LPCOMP for
|
||||
// example) will not be available.
|
||||
|
||||
if (is_manual_peripheral_setup_needed()){
|
||||
*(uint32_t volatile *)0x40000504 = 0xC007FFDF;
|
||||
*(uint32_t volatile *)0x40006C18 = 0x00008000;
|
||||
}
|
||||
|
||||
/* Disable PROTENSET registers under debug, as indicated by PAN 59 "MPU: Reset value of DISABLEINDEBUG
|
||||
register is incorrect" found at Product Anomaly document four your device found at
|
||||
https://www.nordicsemi.com/. There is no side effect of using these instruction if not needed. */
|
||||
// Disable PROTENSET registers under debug, as indicated by PAN 59 "MPU: Reset value of DISABLEINDEBUG
|
||||
// register is incorrect" found at Product Anomaly document four your device found at
|
||||
// https://www.nordicsemi.com/. There is no side effect of using these instruction if not needed.
|
||||
if (is_disabled_in_debug_needed()){
|
||||
NRF_MPU->DISABLEINDEBUG = MPU_DISABLEINDEBUG_DISABLEINDEBUG_Disabled << MPU_DISABLEINDEBUG_DISABLEINDEBUG_Pos;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue