diff --git a/ports/nrf/README.md b/ports/nrf/README.md index db3e2d44be..d1c292e7d0 100644 --- a/ports/nrf/README.md +++ b/ports/nrf/README.md @@ -28,6 +28,7 @@ This is a port of MicroPython to the Nordic Semiconductor nRF series of chips. * PCA10001 * PCA10028 * PCA10031 (dongle) + * [WT51822-S4AT](http://www.wireless-tag.com/wireless_module/BLE/WT51822-S4AT.html) * nRF52832 * [PCA10040](http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52%2Fdita%2Fnrf52%2Fdevelopment%2Fnrf52_dev_kit.html) * [Adafruit Feather nRF52](https://www.adafruit.com/product/3406) @@ -80,6 +81,7 @@ pca10000 | s110 | Peripheral | [Segge pca10001 | s110 | Peripheral | [Segger](#segger-targets) pca10028 | s110 | Peripheral | [Segger](#segger-targets) pca10031 | s110 | Peripheral | [Segger](#segger-targets) +wt51822_s4at | s110 | Peripheral | Manual, see [datasheet](https://4tronix.co.uk/picobot2/WT51822-S4AT.pdf) for pinout pca10040 | s132 | Peripheral and Central | [Segger](#segger-targets) feather52 | s132 | Peripheral and Central | [UART DFU](#dfu-targets) arduino_primo | s132 | Peripheral and Central | [PyOCD](#pyocdopenocd-targets) diff --git a/ports/nrf/boards/wt51822_s4at/mpconfigboard.h b/ports/nrf/boards/wt51822_s4at/mpconfigboard.h new file mode 100644 index 0000000000..f8b2405885 --- /dev/null +++ b/ports/nrf/boards/wt51822_s4at/mpconfigboard.h @@ -0,0 +1,65 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Ayke van Laethem + * + * 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. + */ + +#define WT51822_S4AT + +// Datasheet for board: +// https://4tronix.co.uk/picobot2/WT51822-S4AT.pdf +#define MICROPY_HW_BOARD_NAME "WT51822-S4AT" +#define MICROPY_HW_MCU_NAME "NRF51822" +#define MICROPY_PY_SYS_PLATFORM "nrf51" + +#define MICROPY_PY_MACHINE_HW_SPI (1) +#define MICROPY_PY_MACHINE_TIMER (1) +#define MICROPY_PY_MACHINE_RTC (1) +#define MICROPY_PY_MACHINE_I2C (1) +#define MICROPY_PY_MACHINE_ADC (1) +#define MICROPY_PY_MACHINE_TEMP (1) + +#define MICROPY_HW_HAS_LED (0) +#define MICROPY_HW_HAS_SWITCH (0) +#define MICROPY_HW_HAS_FLASH (0) +#define MICROPY_HW_HAS_SDCARD (0) +#define MICROPY_HW_HAS_MMA7660 (0) +#define MICROPY_HW_HAS_LIS3DSH (0) +#define MICROPY_HW_HAS_LCD (0) +#define MICROPY_HW_ENABLE_RNG (0) +#define MICROPY_HW_ENABLE_RTC (0) +#define MICROPY_HW_ENABLE_TIMER (0) +#define MICROPY_HW_ENABLE_SERVO (0) +#define MICROPY_HW_ENABLE_DAC (0) +#define MICROPY_HW_ENABLE_CAN (0) + +// UART config +#define MICROPY_HW_UART1_RX (pin_A1) +#define MICROPY_HW_UART1_TX (pin_A2) +#define MICROPY_HW_UART1_HWFC (0) + +// SPI0 config +#define MICROPY_HW_SPI0_NAME "SPI0" +#define MICROPY_HW_SPI0_SCK (pin_A9) +#define MICROPY_HW_SPI0_MOSI (pin_A10) +#define MICROPY_HW_SPI0_MISO (pin_A13) diff --git a/ports/nrf/boards/wt51822_s4at/mpconfigboard.mk b/ports/nrf/boards/wt51822_s4at/mpconfigboard.mk new file mode 100644 index 0000000000..12087d6828 --- /dev/null +++ b/ports/nrf/boards/wt51822_s4at/mpconfigboard.mk @@ -0,0 +1,4 @@ +MCU_SERIES = m0 +MCU_VARIANT = nrf51 +MCU_SUB_VARIANT = nrf51822 +LD_FILE = boards/nrf51x22_256k_16k.ld diff --git a/ports/nrf/boards/wt51822_s4at/mpconfigboard_s110.mk b/ports/nrf/boards/wt51822_s4at/mpconfigboard_s110.mk new file mode 100644 index 0000000000..8f5433b47c --- /dev/null +++ b/ports/nrf/boards/wt51822_s4at/mpconfigboard_s110.mk @@ -0,0 +1,7 @@ +MCU_SERIES = m0 +MCU_VARIANT = nrf51 +MCU_SUB_VARIANT = nrf51822 +SOFTDEV_VERSION = 8.0.0 +LD_FILE = boards/nrf51x22_256k_16k_s110_$(SOFTDEV_VERSION).ld + +CFLAGS += -DBLUETOOTH_LFCLK_RC diff --git a/ports/nrf/boards/wt51822_s4at/nrf51_hal_conf.h b/ports/nrf/boards/wt51822_s4at/nrf51_hal_conf.h new file mode 100644 index 0000000000..79af193468 --- /dev/null +++ b/ports/nrf/boards/wt51822_s4at/nrf51_hal_conf.h @@ -0,0 +1,14 @@ +#ifndef NRF51_HAL_CONF_H__ +#define NRF51_HAL_CONF_H__ + +#define HAL_UART_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_TIME_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_TIMER_MODULE_ENABLED +#define HAL_TWI_MODULE_ENABLED +#define HAL_ADC_MODULE_ENABLED +#define HAL_TEMP_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED + +#endif // NRF51_HAL_CONF_H__ diff --git a/ports/nrf/boards/wt51822_s4at/pins.csv b/ports/nrf/boards/wt51822_s4at/pins.csv new file mode 100644 index 0000000000..01f5e8fcef --- /dev/null +++ b/ports/nrf/boards/wt51822_s4at/pins.csv @@ -0,0 +1,7 @@ +PA1,PA1 +PA2,PA2 +PA3,PA3 +PA4,PA4 +PA9,PA9 +PA10,PA10 +PA13,PA13