nrf: add support for nrf52833
This adds preliminary support for the nRF52833, which is a variant of the nRF52840 with half the RAM, half the flash, and fewer peripherals. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
4ad1cbeea3
commit
3ed5b87b8f
|
@ -182,6 +182,11 @@ SRC_C += \
|
|||
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c
|
||||
endif
|
||||
|
||||
ifeq ($(MCU_SUB_VARIANT),nrf52833)
|
||||
SRC_C += \
|
||||
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c
|
||||
endif
|
||||
|
||||
ifeq ($(CIRCUITPY_NETWORK),1)
|
||||
CFLAGS += -DMICROPY_PY_NETWORK=1
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x100000 /* entire flash, 1 MiB */
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = ${FLASH_SIZE} /* entire flash */
|
||||
/* nRF SoftDevice */
|
||||
FLASH_MBR (rx) : ORIGIN = ${MBR_START_ADDR}, LENGTH = ${MBR_SIZE}
|
||||
FLASH_SD (rx) : ORIGIN = ${SD_FLASH_START_ADDR}, LENGTH = ${SD_FLASH_SIZE}
|
||||
|
@ -23,7 +23,7 @@ MEMORY
|
|||
/* To measure the minimum required amount of memory for given configuration, set this number
|
||||
high enough to work and then check the mutation of the value done by sd_ble_enable. */
|
||||
SPIM3_RAM (rw) : ORIGIN = 0x20000000 + ${SOFTDEVICE_RAM_SIZE}, LENGTH = ${SPIM3_BUFFER_SIZE}
|
||||
RAM (xrw) : ORIGIN = 0x20000000 + ${SOFTDEVICE_RAM_SIZE} + ${SPIM3_BUFFER_SIZE}, LENGTH = 256K - ${SOFTDEVICE_RAM_SIZE} -${SPIM3_BUFFER_SIZE}
|
||||
RAM (xrw) : ORIGIN = 0x20000000 + ${SOFTDEVICE_RAM_SIZE} + ${SPIM3_BUFFER_SIZE}, LENGTH = ${RAM_SIZE} - ${SOFTDEVICE_RAM_SIZE} -${SPIM3_BUFFER_SIZE}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -168,5 +168,17 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_P1_14), MP_ROM_PTR(&pin_P1_14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_P1_15), MP_ROM_PTR(&pin_P1_15) },
|
||||
#endif
|
||||
#ifdef NRF52833
|
||||
{ MP_ROM_QSTR(MP_QSTR_P1_00), MP_ROM_PTR(&pin_P1_00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_P1_01), MP_ROM_PTR(&pin_P1_01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_P1_02), MP_ROM_PTR(&pin_P1_02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_P1_03), MP_ROM_PTR(&pin_P1_03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_P1_04), MP_ROM_PTR(&pin_P1_04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_P1_05), MP_ROM_PTR(&pin_P1_05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_P1_06), MP_ROM_PTR(&pin_P1_06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_P1_07), MP_ROM_PTR(&pin_P1_07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_P1_08), MP_ROM_PTR(&pin_P1_08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_P1_09), MP_ROM_PTR(&pin_P1_09) },
|
||||
#endif
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_globals_table);
|
||||
|
|
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern uint32_t _estack;
|
||||
extern uint32_t _sidata;
|
||||
extern uint32_t _sdata;
|
||||
extern uint32_t _edata;
|
||||
extern uint32_t _sbss;
|
||||
extern uint32_t _ebss;
|
||||
|
||||
typedef void (*func)(void);
|
||||
|
||||
#define _start main
|
||||
|
||||
extern void _start(void) __attribute__((noreturn));
|
||||
extern void SystemInit(void);
|
||||
|
||||
void Default_Handler(void) {
|
||||
while (1);
|
||||
}
|
||||
|
||||
void Reset_Handler(void) {
|
||||
uint32_t * p_src = &_sidata;
|
||||
uint32_t * p_dest = &_sdata;
|
||||
|
||||
while (p_dest < &_edata) {
|
||||
*p_dest++ = *p_src++;
|
||||
}
|
||||
|
||||
uint32_t * p_bss = &_sbss;
|
||||
uint32_t * p_bss_end = &_ebss;
|
||||
while (p_bss < p_bss_end) {
|
||||
*p_bss++ = 0ul;
|
||||
}
|
||||
|
||||
SystemInit();
|
||||
_start();
|
||||
}
|
||||
|
||||
void NMI_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void HardFault_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void MemoryManagement_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void BusFault_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void UsageFault_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SVC_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void DebugMon_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void PendSV_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SysTick_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
|
||||
void POWER_CLOCK_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void RADIO_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void UARTE0_UART0_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void NFCT_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void GPIOTE_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SAADC_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void TIMER0_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void TIMER1_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void TIMER2_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void RTC0_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void TEMP_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void RNG_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void ECB_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void CCM_AAR_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void WDT_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void RTC1_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void QDEC_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void COMP_LPCOMP_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SWI0_EGU0_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SWI1_EGU1_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SWI2_EGU2_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SWI3_EGU3_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SWI4_EGU4_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SWI5_EGU5_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void TIMER3_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void TIMER4_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void PWM0_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void PDM_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void MWU_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void PWM1_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void PWM2_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SPIM2_SPIS2_SPI2_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void RTC2_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void I2S_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void FPU_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void USBD_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void UARTE1_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void PWM3_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SPIM3_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
|
||||
const func __Vectors[] __attribute__ ((used, section(".isr_vector"))) = {
|
||||
(func)&_estack,
|
||||
Reset_Handler,
|
||||
NMI_Handler,
|
||||
HardFault_Handler,
|
||||
MemoryManagement_Handler,
|
||||
BusFault_Handler,
|
||||
UsageFault_Handler,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
SVC_Handler,
|
||||
DebugMon_Handler,
|
||||
0,
|
||||
PendSV_Handler,
|
||||
SysTick_Handler,
|
||||
|
||||
/* External Interrupts */
|
||||
POWER_CLOCK_IRQHandler,
|
||||
RADIO_IRQHandler,
|
||||
UARTE0_UART0_IRQHandler,
|
||||
SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler,
|
||||
SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler,
|
||||
NFCT_IRQHandler,
|
||||
GPIOTE_IRQHandler,
|
||||
SAADC_IRQHandler,
|
||||
TIMER0_IRQHandler,
|
||||
TIMER1_IRQHandler,
|
||||
TIMER2_IRQHandler,
|
||||
RTC0_IRQHandler,
|
||||
TEMP_IRQHandler,
|
||||
RNG_IRQHandler,
|
||||
ECB_IRQHandler,
|
||||
CCM_AAR_IRQHandler,
|
||||
WDT_IRQHandler,
|
||||
RTC1_IRQHandler,
|
||||
QDEC_IRQHandler,
|
||||
COMP_LPCOMP_IRQHandler,
|
||||
SWI0_EGU0_IRQHandler,
|
||||
SWI1_EGU1_IRQHandler,
|
||||
SWI2_EGU2_IRQHandler,
|
||||
SWI3_EGU3_IRQHandler,
|
||||
SWI4_EGU4_IRQHandler,
|
||||
SWI5_EGU5_IRQHandler,
|
||||
TIMER3_IRQHandler,
|
||||
TIMER4_IRQHandler,
|
||||
PWM0_IRQHandler,
|
||||
PDM_IRQHandler,
|
||||
0,
|
||||
0,
|
||||
MWU_IRQHandler,
|
||||
PWM1_IRQHandler,
|
||||
PWM2_IRQHandler,
|
||||
SPIM2_SPIS2_SPI2_IRQHandler,
|
||||
RTC2_IRQHandler,
|
||||
I2S_IRQHandler,
|
||||
FPU_IRQHandler,
|
||||
USBD_IRQHandler,
|
||||
UARTE1_IRQHandler,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
PWM3_IRQHandler,
|
||||
0,
|
||||
SPIM3_IRQHandler,
|
||||
};
|
|
@ -9,6 +9,9 @@
|
|||
// The next line is a marker to start looking for definitions. Lines above the next line are ignored.
|
||||
// START_LD_DEFINES
|
||||
|
||||
/*FLASH_SIZE=*/ FLASH_SIZE;
|
||||
/*RAM_SIZE=*/ RAM_SIZE;
|
||||
|
||||
/*MBR_START_ADDR=*/ MBR_START_ADDR;
|
||||
/*MBR_SIZE=*/ MBR_SIZE;
|
||||
|
||||
|
|
|
@ -41,6 +41,16 @@
|
|||
#ifdef NRF52840
|
||||
#define MICROPY_PY_SYS_PLATFORM "nRF52840"
|
||||
#define FLASH_SIZE (0x100000) // 1MiB
|
||||
#define RAM_SIZE (0x40000) // 256 KiB
|
||||
// Special RAM area for SPIM3 transmit buffer, to work around hardware bug.
|
||||
// See common.template.ld.
|
||||
#define SPIM3_BUFFER_SIZE (8192)
|
||||
#endif
|
||||
|
||||
#ifdef NRF52833
|
||||
#define MICROPY_PY_SYS_PLATFORM "nRF52833"
|
||||
#define FLASH_SIZE (0x80000) // 512 KiB
|
||||
#define RAM_SIZE (0x20000) // 128 KiB
|
||||
// Special RAM area for SPIM3 transmit buffer, to work around hardware bug.
|
||||
// See common.template.ld.
|
||||
#define SPIM3_BUFFER_SIZE (8192)
|
||||
|
@ -112,14 +122,15 @@
|
|||
// Define these regions starting down from the bootloader:
|
||||
|
||||
// Bootloader values from https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/src/linker/s140_v6.ld
|
||||
#define BOOTLOADER_START_ADDR (0x000F4000)
|
||||
#define BOOTLOADER_START_ADDR (FLASH_SIZE - BOOTLOADER_SIZE - BOOTLOADER_SETTINGS_SIZE - BOOTLOADER_MBR_SIZE)
|
||||
#define BOOTLOADER_MBR_SIZE (0x1000) // 4kib
|
||||
#define BOOTLOADER_SIZE (0xA000) // 40kiB
|
||||
#define BOOTLOADER_SETTINGS_START_ADDR (0x000FF000)
|
||||
#define BOOTLOADER_SETTINGS_START_ADDR (FLASH_SIZE - BOOTLOADER_SETTINGS_SIZE)
|
||||
#define BOOTLOADER_SETTINGS_SIZE (0x1000) // 4kiB
|
||||
|
||||
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR (BOOTLOADER_START_ADDR - CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE)
|
||||
|
||||
#if CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE > 0 && CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR != (BOOTLOADER_START_ADDR - 256*1024)
|
||||
#if CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE > 0 && CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR != (BOOTLOADER_START_ADDR - CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE)
|
||||
#warning Internal flash filesystem location has moved!
|
||||
#endif
|
||||
|
||||
|
|
|
@ -73,4 +73,18 @@ NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
|
|||
CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
|
||||
|
||||
CIRCUITPY_ULAB = 1
|
||||
|
||||
else
|
||||
ifeq ($(MCU_CHIP),nrf52833)
|
||||
MCU_SERIES = m4
|
||||
MCU_VARIANT = nrf52
|
||||
MCU_SUB_VARIANT = nrf52833
|
||||
|
||||
SD ?= s140
|
||||
SOFTDEV_VERSION ?= 6.1.0
|
||||
|
||||
BOOT_SETTING_ADDR = 0x7F000
|
||||
NRF_DEFINES += -DNRF52833_XXAA -DNRF52833
|
||||
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#define NRFX_SPIM1_ENABLED 1
|
||||
#endif
|
||||
#define NRFX_SPIM2_ENABLED 1
|
||||
#ifdef NRF52840_XXAA
|
||||
#if defined(NRF52840_XXAA) || defined(NRF52833_XXAA)
|
||||
#define NRFX_SPIM_EXTENDED_ENABLED 1
|
||||
#define NRFX_SPIM3_ENABLED 1
|
||||
#elif CIRCUITPY_NRF_NUM_I2C == 2
|
||||
|
@ -53,7 +53,9 @@
|
|||
#define NRFX_SPIM_MISO_PULL_CFG 1
|
||||
|
||||
// QSPI
|
||||
#if defined(NRF52840_XXAA)
|
||||
#define NRFX_QSPI_ENABLED 1
|
||||
#endif
|
||||
|
||||
// TWI aka. I2C; always enable TWIM0 (no conflict with SPIM1 and SPIM2)
|
||||
#if CIRCUITPY_NRF_NUM_I2C == 1 || CIRCUITPY_NRF_NUM_I2C == 2
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "py/obj.h"
|
||||
#include "py/mphal.h"
|
||||
#include "nrf/pins.h"
|
||||
|
||||
const mcu_pin_obj_t pin_P0_00 = PIN(P0_00, 0, 0, 0);
|
||||
const mcu_pin_obj_t pin_P0_01 = PIN(P0_01, 0, 1, 0);
|
||||
const mcu_pin_obj_t pin_P0_02 = PIN(P0_02, 0, 2, SAADC_CH_PSELP_PSELP_AnalogInput0);
|
||||
const mcu_pin_obj_t pin_P0_03 = PIN(P0_03, 0, 3, SAADC_CH_PSELP_PSELP_AnalogInput1);
|
||||
const mcu_pin_obj_t pin_P0_04 = PIN(P0_04, 0, 4, SAADC_CH_PSELP_PSELP_AnalogInput2);
|
||||
const mcu_pin_obj_t pin_P0_05 = PIN(P0_05, 0, 5, SAADC_CH_PSELP_PSELP_AnalogInput3);
|
||||
const mcu_pin_obj_t pin_P0_06 = PIN(P0_06, 0, 6, 0);
|
||||
const mcu_pin_obj_t pin_P0_07 = PIN(P0_07, 0, 7, 0);
|
||||
const mcu_pin_obj_t pin_P0_08 = PIN(P0_08, 0, 8, 0);
|
||||
const mcu_pin_obj_t pin_P0_09 = PIN(P0_09, 0, 9, 0);
|
||||
const mcu_pin_obj_t pin_P0_10 = PIN(P0_10, 0, 10, 0);
|
||||
const mcu_pin_obj_t pin_P0_11 = PIN(P0_11, 0, 11, 0);
|
||||
const mcu_pin_obj_t pin_P0_12 = PIN(P0_12, 0, 12, 0);
|
||||
const mcu_pin_obj_t pin_P0_13 = PIN(P0_13, 0, 13, 0);
|
||||
const mcu_pin_obj_t pin_P0_14 = PIN(P0_14, 0, 14, 0);
|
||||
const mcu_pin_obj_t pin_P0_15 = PIN(P0_15, 0, 15, 0);
|
||||
const mcu_pin_obj_t pin_P0_16 = PIN(P0_16, 0, 16, 0);
|
||||
const mcu_pin_obj_t pin_P0_17 = PIN(P0_17, 0, 17, 0);
|
||||
const mcu_pin_obj_t pin_P0_18 = PIN(P0_18, 0, 18, 0);
|
||||
const mcu_pin_obj_t pin_P0_19 = PIN(P0_19, 0, 19, 0);
|
||||
const mcu_pin_obj_t pin_P0_20 = PIN(P0_20, 0, 20, 0);
|
||||
const mcu_pin_obj_t pin_P0_21 = PIN(P0_21, 0, 21, 0);
|
||||
const mcu_pin_obj_t pin_P0_22 = PIN(P0_22, 0, 22, 0);
|
||||
const mcu_pin_obj_t pin_P0_23 = PIN(P0_23, 0, 23, 0);
|
||||
const mcu_pin_obj_t pin_P0_24 = PIN(P0_24, 0, 24, 0);
|
||||
const mcu_pin_obj_t pin_P0_25 = PIN(P0_25, 0, 25, 0);
|
||||
const mcu_pin_obj_t pin_P0_26 = PIN(P0_26, 0, 26, 0);
|
||||
const mcu_pin_obj_t pin_P0_27 = PIN(P0_27, 0, 27, 0);
|
||||
const mcu_pin_obj_t pin_P0_28 = PIN(P0_28, 0, 28, SAADC_CH_PSELP_PSELP_AnalogInput4);
|
||||
const mcu_pin_obj_t pin_P0_29 = PIN(P0_29, 0, 29, SAADC_CH_PSELP_PSELP_AnalogInput5);
|
||||
const mcu_pin_obj_t pin_P0_30 = PIN(P0_30, 0, 30, SAADC_CH_PSELP_PSELP_AnalogInput6);
|
||||
const mcu_pin_obj_t pin_P0_31 = PIN(P0_31, 0, 31, SAADC_CH_PSELP_PSELP_AnalogInput7);
|
||||
const mcu_pin_obj_t pin_P1_00 = PIN(P1_00, 1, 0, 0);
|
||||
const mcu_pin_obj_t pin_P1_01 = PIN(P1_01, 1, 1, 0);
|
||||
const mcu_pin_obj_t pin_P1_02 = PIN(P1_02, 1, 2, 0);
|
||||
const mcu_pin_obj_t pin_P1_03 = PIN(P1_03, 1, 3, 0);
|
||||
const mcu_pin_obj_t pin_P1_04 = PIN(P1_04, 1, 4, 0);
|
||||
const mcu_pin_obj_t pin_P1_05 = PIN(P1_05, 1, 5, 0);
|
||||
const mcu_pin_obj_t pin_P1_06 = PIN(P1_06, 1, 6, 0);
|
||||
const mcu_pin_obj_t pin_P1_07 = PIN(P1_07, 1, 7, 0);
|
||||
const mcu_pin_obj_t pin_P1_08 = PIN(P1_08, 1, 8, 0);
|
||||
const mcu_pin_obj_t pin_P1_09 = PIN(P1_09, 1, 9, 0);
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 by Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_NRF_PERIPHERALS_NRF52833_PINS_H
|
||||
#define MICROPY_INCLUDED_NRF_PERIPHERALS_NRF52833_PINS_H
|
||||
|
||||
extern const mcu_pin_obj_t pin_P0_00;
|
||||
extern const mcu_pin_obj_t pin_P0_01;
|
||||
extern const mcu_pin_obj_t pin_P0_02;
|
||||
extern const mcu_pin_obj_t pin_P0_03;
|
||||
extern const mcu_pin_obj_t pin_P0_04;
|
||||
extern const mcu_pin_obj_t pin_P0_05;
|
||||
extern const mcu_pin_obj_t pin_P0_06;
|
||||
extern const mcu_pin_obj_t pin_P0_07;
|
||||
extern const mcu_pin_obj_t pin_P0_08;
|
||||
extern const mcu_pin_obj_t pin_P0_09;
|
||||
extern const mcu_pin_obj_t pin_P0_10;
|
||||
extern const mcu_pin_obj_t pin_P0_11;
|
||||
extern const mcu_pin_obj_t pin_P0_12;
|
||||
extern const mcu_pin_obj_t pin_P0_13;
|
||||
extern const mcu_pin_obj_t pin_P0_14;
|
||||
extern const mcu_pin_obj_t pin_P0_15;
|
||||
extern const mcu_pin_obj_t pin_P0_16;
|
||||
extern const mcu_pin_obj_t pin_P0_17;
|
||||
extern const mcu_pin_obj_t pin_P0_18;
|
||||
extern const mcu_pin_obj_t pin_P0_19;
|
||||
extern const mcu_pin_obj_t pin_P0_20;
|
||||
extern const mcu_pin_obj_t pin_P0_21;
|
||||
extern const mcu_pin_obj_t pin_P0_22;
|
||||
extern const mcu_pin_obj_t pin_P0_23;
|
||||
extern const mcu_pin_obj_t pin_P0_24;
|
||||
extern const mcu_pin_obj_t pin_P0_25;
|
||||
extern const mcu_pin_obj_t pin_P0_26;
|
||||
extern const mcu_pin_obj_t pin_P0_27;
|
||||
extern const mcu_pin_obj_t pin_P0_28;
|
||||
extern const mcu_pin_obj_t pin_P0_29;
|
||||
extern const mcu_pin_obj_t pin_P0_30;
|
||||
extern const mcu_pin_obj_t pin_P0_31;
|
||||
extern const mcu_pin_obj_t pin_P1_00;
|
||||
extern const mcu_pin_obj_t pin_P1_01;
|
||||
extern const mcu_pin_obj_t pin_P1_02;
|
||||
extern const mcu_pin_obj_t pin_P1_03;
|
||||
extern const mcu_pin_obj_t pin_P1_04;
|
||||
extern const mcu_pin_obj_t pin_P1_05;
|
||||
extern const mcu_pin_obj_t pin_P1_06;
|
||||
extern const mcu_pin_obj_t pin_P1_07;
|
||||
extern const mcu_pin_obj_t pin_P1_08;
|
||||
extern const mcu_pin_obj_t pin_P1_09;
|
||||
|
||||
#endif // MICROPY_INCLUDED_NRF_PERIPHERALS_NRF52833_PINS_H
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "nrfx.h"
|
||||
#include "hal/nrf_nvmc.h"
|
||||
|
||||
void nrf_peripherals_power_init(void) {
|
||||
// Set GPIO reference voltage to 3.3V if it isn't already. REGOUT0 will get reset to 0xfffffff
|
||||
// if flash is erased, which sets the default to 1.8V
|
||||
// This matters only when "high voltage mode" is enabled, which is true on the PCA10059,
|
||||
// and might be true on other boards.
|
||||
if (NRF_UICR->REGOUT0 == 0xffffffff && NRF_POWER->MAINREGSTATUS & 1) {
|
||||
// Expand what nrf_nvmc_word_write() did.
|
||||
// It's missing from nrfx V2.0.0, and nrfx_nvmc_word_write() does bounds
|
||||
// checking which prevents writes to UICR.
|
||||
// Reported: https://devzone.nordicsemi.com/f/nordic-q-a/57243/nrfx_nvmc-h-api-cannot-write-to-uicr
|
||||
NRF_NVMC->CONFIG = NRF_NVMC_MODE_WRITE;
|
||||
while (!(NRF_NVMC->READY & NVMC_READY_READY_Msk)) {}
|
||||
NRF_UICR->REGOUT0 = UICR_REGOUT0_VOUT_3V3 << UICR_REGOUT0_VOUT_Pos;
|
||||
__DMB();
|
||||
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
|
||||
NRF_NVMC->CONFIG = NRF_NVMC_MODE_READONLY;
|
||||
|
||||
// Must reset to enable change.
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
}
|
|
@ -61,4 +61,9 @@ extern const mp_obj_type_t mcu_pin_type;
|
|||
#include "nrf52840/pins.h"
|
||||
#endif
|
||||
|
||||
// Choose based on chip, but not specifically revision (e.g., not NRF52840_XXAA)
|
||||
#ifdef NRF52833
|
||||
#include "nrf52833/pins.h"
|
||||
#endif
|
||||
|
||||
#endif // __MICROPY_INCLUDED_NRF_PERIPHERALS_PINS_H__
|
||||
|
|
Loading…
Reference in New Issue