summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Cross <sean@xobs.io>2020-04-19 15:08:42 +0800
committerSean Cross <sean@xobs.io>2020-04-29 11:40:00 +0800
commit1d0781bf12e7b792842ea63cb986872ce61160f1 (patch)
treebc66fb10a87c0fbdd641ae326398b0b89ee1d910
parent2d7cf4b792afa1b6755b9575b84cae4b65ae7ab9 (diff)
nrf: add simmel board
This adds support for Simmel, an nRF52833-based bluetooth tracking board designed to aid in pandemic tracing. Signed-off-by: Sean Cross <sean@xobs.io>
-rwxr-xr-xports/nrf/Makefile2
-rw-r--r--ports/nrf/boards/simmel/board.c38
-rw-r--r--ports/nrf/boards/simmel/mpconfigboard.h54
-rw-r--r--ports/nrf/boards/simmel/mpconfigboard.mk33
-rw-r--r--ports/nrf/boards/simmel/pins.c27
5 files changed, 153 insertions, 1 deletions
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile
index 876628342..d6aab39fc 100755
--- a/ports/nrf/Makefile
+++ b/ports/nrf/Makefile
@@ -88,7 +88,7 @@ INC += -I../../supervisor/shared/usb
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb3 -Og
else
- CFLAGS += -Os -DNDEBUG
+ CFLAGS += -Os -DNDEBUG -ggdb3
CFLAGS += -flto -flto-partition=none
endif
diff --git a/ports/nrf/boards/simmel/board.c b/ports/nrf/boards/simmel/board.c
new file mode 100644
index 000000000..f891f54a1
--- /dev/null
+++ b/ports/nrf/boards/simmel/board.c
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Scott Shawcroft 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 "boards/board.h"
+
+void board_init(void) {
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+
+}
diff --git a/ports/nrf/boards/simmel/mpconfigboard.h b/ports/nrf/boards/simmel/mpconfigboard.h
new file mode 100644
index 000000000..4c73e86eb
--- /dev/null
+++ b/ports/nrf/boards/simmel/mpconfigboard.h
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Glenn Ruben Bakke
+ * 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/hal/nrf_gpio.h"
+
+#define MICROPY_HW_BOARD_NAME "Simmel"
+#define MICROPY_HW_MCU_NAME "nRF52833"
+
+#define MICROPY_HW_LED_STATUS (&pin_P0_06)
+
+#if SPI_FLASH_FILESYSTEM
+#define SPI_FLASH_MOSI_PIN &pin_P0_09
+#define SPI_FLASH_MISO_PIN &pin_P1_04
+#define SPI_FLASH_SCK_PIN &pin_P0_10
+#define SPI_FLASH_CS_PIN &pin_P1_06
+#endif
+
+#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (84*1024)
+
+#define BOOTLOADER_SIZE (0x4000) // 12 kiB
+#define CIRCUITPY_BLE_CONFIG_SIZE (12*1024)
+
+// Reduce nRF SoftRadio memory usage
+#define BLEIO_VS_UUID_COUNT 10
+#define BLEIO_HVN_TX_QUEUE_SIZE 2
+#define BLEIO_CENTRAL_ROLE_COUNT 2
+#define BLEIO_PERIPH_ROLE_COUNT 2
+#define BLEIO_TOTAL_CONNECTION_COUNT 2
+#define BLEIO_ATTR_TAB_SIZE (BLE_GATTS_ATTR_TAB_SIZE_DEFAULT * 2)
diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk
new file mode 100644
index 000000000..342d1ca39
--- /dev/null
+++ b/ports/nrf/boards/simmel/mpconfigboard.mk
@@ -0,0 +1,33 @@
+USB_VID = 0x1209
+USB_PID = 0xc051
+USB_PRODUCT = "Simmel"
+USB_MANUFACTURER = "Betrusted"
+
+MCU_CHIP = nrf52833
+
+# SPI_FLASH_FILESYSTEM = 1
+# EXTERNAL_FLASH_DEVICE_COUNT = 1
+# EXTERNAL_FLASH_DEVICES = "MX25R1635F"
+
+INTERNAL_FLASH_FILESYSTEM = 1
+
+CIRCUITPY_AUDIOMP3 = 0
+CIRCUITPY_BUSIO = 1
+CIRCUITPY_DISPLAYIO = 0
+CIRCUITPY_FRAMEBUFFERIO = 0
+CIRCUITPY_NEOPIXEL_WRITE = 0
+CIRCUITPY_NVM = 0
+CIRCUITPY_PIXELBUF = 0
+CIRCUITPY_RGBMATRIX = 0
+CIRCUITPY_ROTARYIO = 0
+CIRCUITPY_RTC = 1
+CIRCUITPY_TOUCHIO = 0
+CIRCUITPY_ULAB = 0
+CIRCUITPY_USB_HID = 0
+
+# Enable micropython.native
+#CIRCUITPY_ENABLE_MPY_NATIVE = 1
+
+# These defines must be overridden before mpconfigboard.h is included, which is
+# why they are passed on the command line.
+CFLAGS += -DSPIM3_BUFFER_SIZE=0 -DSOFTDEVICE_RAM_SIZE='(32*1024)'
diff --git a/ports/nrf/boards/simmel/pins.c b/ports/nrf/boards/simmel/pins.c
new file mode 100644
index 000000000..c946493d4
--- /dev/null
+++ b/ports/nrf/boards/simmel/pins.c
@@ -0,0 +1,27 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_SPI_CSN), MP_ROM_PTR(&pin_P0_06) },
+ { MP_ROM_QSTR(MP_QSTR_SPI_MISO), MP_ROM_PTR(&pin_P1_04) },
+ { MP_ROM_QSTR(MP_QSTR_SPI_MOSI), MP_ROM_PTR(&pin_P0_09) },
+ { MP_ROM_QSTR(MP_QSTR_SPI_SCK), MP_ROM_PTR(&pin_P0_10) },
+
+ { MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) },
+ { MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) },
+
+ { MP_ROM_QSTR(MP_QSTR_I2S_LRCK), MP_ROM_PTR(&pin_P0_08) },
+ { MP_ROM_QSTR(MP_QSTR_I2S_SDIN), MP_ROM_PTR(&pin_P1_09) },
+ { MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_P0_12) },
+
+ { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_P0_06) },
+ { MP_ROM_QSTR(MP_QSTR_CHG), MP_ROM_PTR(&pin_P0_04) },
+
+ { MP_ROM_QSTR(MP_QSTR_PWM), MP_ROM_PTR(&pin_P0_02) },
+ { MP_ROM_QSTR(MP_QSTR_PWM_N), MP_ROM_PTR(&pin_P0_19) },
+
+ { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
+ { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
+ { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
+};
+
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);