1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/nrf52/include/cpu_conf.h

148 lines
4.0 KiB
C
Raw Normal View History

2016-02-04 15:30:06 +01:00
/*
* Copyright (C) 2016 Freie Universität Berlin
2020-05-03 15:54:32 +02:00
* 2020 Philipp-Alexander Blum <philipp-blum@jakiku.de>
2016-02-04 15:30:06 +01:00
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
2018-06-01 12:25:00 +02:00
* @defgroup cpu_nrf52 Nordic nRF52 MCU
* @ingroup cpu
* @brief Nordic nRF52 family of CPUs
2016-02-04 15:30:06 +01:00
* @{
*
* @file
* @brief nRF52 specific CPU configuration
*
2017-01-19 21:45:23 +01:00
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
2020-05-03 15:54:32 +02:00
* @author Philipp-Alexander Blum <philipp-blum@jakiku.de>
2016-02-04 15:30:06 +01:00
*
*/
#ifndef CPU_CONF_H
#define CPU_CONF_H
#include "cpu_conf_common.h"
#ifdef CPU_MODEL_NRF52832XXAA
#include "vendor/nrf52.h"
#include "vendor/nrf52_bitfields.h"
#include "vendor/nrf52832_peripherals.h"
#elif defined(CPU_MODEL_NRF52805XXAA)
#include "vendor/nrf52805.h"
#include "vendor/nrf52805_bitfields.h"
#include "vendor/nrf52805_peripherals.h"
#elif defined(CPU_MODEL_NRF52810XXAA)
#include "vendor/nrf52810.h"
#include "vendor/nrf52810_bitfields.h"
#include "vendor/nrf52810_peripherals.h"
2020-05-12 14:49:26 +02:00
#elif defined(CPU_MODEL_NRF52811XXAA)
#include "vendor/nrf52811.h"
#include "vendor/nrf52811_bitfields.h"
#include "vendor/nrf52811_peripherals.h"
#elif defined(CPU_MODEL_NRF52820XXAA)
#include "vendor/nrf52820.h"
#include "vendor/nrf52820_bitfields.h"
#include "vendor/nrf52820_peripherals.h"
#elif defined(CPU_MODEL_NRF52833XXAA)
#include "vendor/nrf52833.h"
#include "vendor/nrf52833_bitfields.h"
#include "vendor/nrf52833_peripherals.h"
2020-05-12 14:49:26 +02:00
#elif defined(CPU_MODEL_NRF52840XXAA)
#include "vendor/nrf52840.h"
#include "vendor/nrf52840_bitfields.h"
#include "vendor/nrf52840_peripherals.h"
#else
#error "The CPU_MODEL of your board is currently not supported"
#endif
2016-02-04 15:30:06 +01:00
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name ARM Cortex-M specific CPU configuration
2016-02-04 15:30:06 +01:00
* @{
*/
#define CPU_DEFAULT_IRQ_PRIO (2U)
2016-02-04 15:30:06 +01:00
#define CPU_FLASH_BASE (0x00000000)
2020-05-03 15:54:32 +02:00
#if defined(CPU_MODEL_NRF52805XXAA)
#define CPU_IRQ_NUMOF (26U)
#elif defined(CPU_MODEL_NRF52810XXAA)
#define CPU_IRQ_NUMOF (30U)
#elif defined(CPU_MODEL_NRF52811XXAA)
#define CPU_IRQ_NUMOF (30U)
#elif defined(CPU_MODEL_NRF52820XXAA)
#define CPU_IRQ_NUMOF (40U)
2020-05-03 15:54:32 +02:00
#elif defined(CPU_MODEL_NRF52832XXAA)
#define CPU_IRQ_NUMOF (39U)
#elif defined(CPU_MODEL_NRF52833XXAA)
#define CPU_IRQ_NUMOF (48U)
2020-05-03 15:54:32 +02:00
#elif defined(CPU_MODEL_NRF52840XXAA)
#define CPU_IRQ_NUMOF (48U)
#endif
2016-02-04 15:30:06 +01:00
/** @} */
/**
* @brief Flash page configuration
* @{
*/
#ifdef BPROT_PRESENT
#define FLASHPAGE_SIZE BPROT_REGIONS_SIZE
#define FLASHPAGE_NUMOF BPROT_REGIONS_NUM
#elif defined(CPU_MODEL_NRF52820XXAA)
#define FLASHPAGE_SIZE (4096U)
#define FLASHPAGE_NUMOF (64U)
#elif defined(CPU_MODEL_NRF52833XXAA)
#define FLASHPAGE_SIZE (4096U)
#define FLASHPAGE_NUMOF (128U)
#elif defined(CPU_MODEL_NRF52840XXAA)
#define FLASHPAGE_SIZE (4096U)
#define FLASHPAGE_NUMOF (256U)
#endif
/* The minimum block size which can be written is 4B. However, the erase
* block is always FLASHPAGE_SIZE.
*/
#define FLASHPAGE_WRITE_BLOCK_SIZE (4U)
/* Writing should be always 4 bytes aligned */
#define FLASHPAGE_WRITE_BLOCK_ALIGNMENT (4U)
/** @} */
#ifdef CPU_MODEL_NRF52840XXAA
/**
* @name OpenWSN timing constants
*
* @{
*/
/* Taken from OpenWSN @32.768Hz */
#define PORT_maxTxDataPrepare (400/PORT_US_PER_TICK)
#define PORT_maxRxAckPrepare (400/PORT_US_PER_TICK)
#define PORT_maxRxDataPrepare (400/PORT_US_PER_TICK)
#define PORT_maxTxAckPrepare (400/PORT_US_PER_TICK)
2020-10-09 10:29:09 +02:00
/* Measured 220us */
#define PORT_delayTx (300/PORT_US_PER_TICK)
#define PORT_delayRx (150/PORT_US_PER_TICK)
/** @} */
#endif
/**
* @brief Put the CPU in the low-power 'wait for event' state
*/
static inline void nrf52_sleep(void)
{
__SEV();
__WFE();
__asm("nop");
}
2016-02-04 15:30:06 +01:00
#ifdef __cplusplus
}
#endif
#endif /* CPU_CONF_H */
/** @} */