From 6d4ffc69fdfe19366b15861694f97cbf77452937 Mon Sep 17 00:00:00 2001 From: TG-Techie Date: Fri, 28 Feb 2020 02:52:46 -0500 Subject: [PATCH 01/12] add TG-Watch02A --- ports/nrf/boards/TG-Watch02A/README.md | 201 ++++++++++++++++++ ports/nrf/boards/TG-Watch02A/board.c | 38 ++++ ports/nrf/boards/TG-Watch02A/mpconfigboard.h | 72 +++++++ ports/nrf/boards/TG-Watch02A/mpconfigboard.mk | 26 +++ ports/nrf/boards/TG-Watch02A/pins.c | 53 +++++ ports/nrf/boards/pca10056/mpconfigboard.h | 1 + 6 files changed, 391 insertions(+) create mode 100644 ports/nrf/boards/TG-Watch02A/README.md create mode 100644 ports/nrf/boards/TG-Watch02A/board.c create mode 100644 ports/nrf/boards/TG-Watch02A/mpconfigboard.h create mode 100644 ports/nrf/boards/TG-Watch02A/mpconfigboard.mk create mode 100644 ports/nrf/boards/TG-Watch02A/pins.c diff --git a/ports/nrf/boards/TG-Watch02A/README.md b/ports/nrf/boards/TG-Watch02A/README.md new file mode 100644 index 0000000000..8d515010f9 --- /dev/null +++ b/ports/nrf/boards/TG-Watch02A/README.md @@ -0,0 +1,201 @@ +# Setup + +The `feather52840` board is currently based on the `PCA10056` development +board from Nordic Semiconductors, since commercial modules are not yet +available for the nRF52840. + +The difference between the `pca10056` and `feather52840` board support +packages is that no bootloader is present on the `pca10056` (a HW debugger +like a Segger J-Link is required to flash firmware images), whereas the +`feather52840` package uses a serial bootloader, with a slightly different +flash layout to account for the bootloader's presence. + +Both targets run on the same hardware and assume the same pinouts. + +The `feather52840` board support package will be updated at a later date +to reflect any pin changes in the final Feather form-factor HW. + +## Installing CircuitPython submodules + +Before you can build, you will need to run the following commands once, which +will install the submodules that are part of the CircuitPython ecosystem, and +build the `mpy-cross` tool: + +``` +$ cd circuitpython +$ git submodule update --init +$ make -C mpy-cross +``` + +You then need to download the SD and Nordic SDK files via: + +> This script relies on `wget`, which must be available from the command line. + +``` +$ cd ports/nrf +$ ./bluetooth/download_ble_stack.sh +``` + +## Installing the Serial Bootloader + +The Adafruit nRF52840 Feather uses a serial bootloader that allows you to +update the core CircuitPython firmware and internal file system contents +using only a serial connection. + +On empty devices, the serial bootloader will need to be flashed once using a +HW debugger such as a Segger J-Link before the serial updater (`adafruit-nrfutil`) can +be used. + +### Install `nrfjprog` + +Before you can install the bootloader, you will first need to install the +`nrfjprog` tool from Nordic Semiconductors for your operating system. The +binary files can be downloaded via the following links: + +- [nRF5x toolset tar for Linux 32-bit v9.7.2](http://www.nordicsemi.com/eng/nordic/Products/nRF52832/nRF5x-Command-Line-Tools-Linux32/52619) +- [nRF5x toolset tar for Linux 64-bit v9.7.2](http://www.nordicsemi.com/eng/nordic/Products/nRF52832/nRF5x-Command-Line-Tools-Linux64/51388) +- [nRF5x toolset tar for OSX v9.7.2](http://www.nordicsemi.com/eng/nordic/Products/nRF52832/nRF5x-Command-Line-Tools-OSX/53406) +- [nRF5x toolset installer for Windows v9.7.2](http://www.nordicsemi.com/eng/nordic/Products/nRF52832/nRF5x-Command-Line-Tools-Win32/48768) + +You will then need to add the `nrfjprog` folder to your system `PATH` variable +so that it is available from the command line. The exact process for this is +OS specific, but on a POSIX type system like OS X or Linux, you can +temporarily add the location to your `PATH` environment variables as follows: + +``` +$ export PATH=$PATH:YOURPATHHERE/nRF5x-Command-Line-Tools_9_7_2_OSX/nrfjprog/ +``` + +You can test this by running the following command: + +``` +$ nrfjprog --version +nrfjprog version: 9.7.2 +JLinkARM.dll version: 6.20f +``` + +### Flash the USB CDC Bootloader with 'nrfjprog' + +> This operation only needs to be done once, and only on boards that don't + already have the serial bootloader installed. + +Firstly clone the [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader.git) and enter its directory + +``` +$ git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader.git +$ cd Adafruit_nRF52_Bootloader +``` + +Once `nrfjprog` is installed and available in `PATH` you can flash your +board with the serial bootloader via the following command: + +``` +make BOARD=feather_nrf52840_express VERSION=latest flash +``` + +This should give you the following (or very similar) output, and you will see +a DFU blinky pattern on one of the board LEDs: + +``` +$ make BOARD=pca10056 VERSION=latest flash +Flashing: bin/pca10056/6.0.0r0/pca10056_bootloader_s140_6.0.0r0.hex +nrfjprog --program bin/pca10056/6.0.0r0/pca10056_bootloader_s140_6.0.0r0.hex --chiperase -f nrf52 --reset +Parsing hex file. +Erasing user available code and UICR flash areas. +Applying system reset. +Checking that the area to write is not protected. +Programing device. +Applying system reset. +Run. +``` + +From this point onward, you can now use a simple serial port for firmware +updates. + +Note: You can specify other version that are available in the directory `Adafruit_nRF52_Bootloader/bin/feather_nrf52840_express/` . The `VERSION=latest` will use the latest bootloader available. + +### IMPORTANT: Disable Mass Storage on PCA10056 J-Link + +The J-Link firmware on the PCA10056 implement USB Mass Storage, but this +causes a known conflict with reliable USB CDC serial port communication. In +order to use the serial bootloader, **you must disable MSD support on the +Segger J-Link**! + +To disable mass storage support, run the `JLinkExe` (or equivalent) command, +and send `MSDDisable`. (You can re-enable MSD support via `MSDEnable`): + +``` +$ JLinkExe +SEGGER J-Link Commander V6.20f (Compiled Oct 13 2017 17:20:01) +DLL version V6.20f, compiled Oct 13 2017 17:19:52 + +Connecting to J-Link via USB...O.K. +Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 24 2017 17:30:12 +Hardware version: V1.00 +S/N: 683947110 +VTref = 3.300V + + +Type "connect" to establish a target connection, '?' for help +J-Link>MSDDisable +Probe configured successfully. +J-Link>exit +``` + +## Building and Flashing CircuitPython + +### Installing `adafruit-nrfutil` + +run follow command to install [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil) from PyPi + +``` +$ pip3 install adafruit-nrfutil --user +``` + +### Flashing CircuitPython with USB CDC + +With the serial bootloader present on your board, you first need to force your +board into DFU mode by holding down BUTTON1 and RESETTING the board (with +BUTTON1 still pressed as you come out of reset). + +This will give you a **fast blinky DFU pattern** to indicate you are in DFU +mode. + +You can **build and flash** a CircuitPython binary via the following command: + +``` +$ make V=1 SD=s140 SERIAL=/dev/tty.usbmodem1411 BOARD=feather52840 all dfu-gen dfu-flash +``` + +This should give you the following results: + +``` +$make V=1 BOARD=feather52840 SD=s140 SERIAL=/dev/tty.usbmodem1411 dfu-gen dfu-flash +nrfutil dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application build-feather52840-s140/firmware.hex build-feather52840-s140/dfu-package.zip +Zip created at build-feather52840-s140/dfu-package.zip +nrfutil --verbose dfu serial --package build-feather52840-s140/dfu-package.zip -p /dev/ttyACM1 -b 115200 --singlebank +Upgrading target on /dev/ttyACM1 with DFU package /home/hathach/Dropbox/adafruit/circuitpython/ada_cp/ports/nrf/build-feather52840-s140/dfu-package.zip. Flow control is disabled, Single bank mode +Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 199840 +Sending DFU start packet +Sending DFU init packet +Sending firmware file +######################################################################################################################################################################################################################################################################################################################################################################################################### +Activating new firmware + +DFU upgrade took 8.50606513023s +Device programmed. +``` + +### Flashing CircuitPython with MSC UF2 + +uf2 file is generated last by `all` target + +``` +$ make V=1 SD=s140 SERIAL=/dev/tty.usbmodem1411 BOARD=feather52840 all +Create firmware.uf2 +../../tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "build-feather52840-s140/firmware.uf2" "build-feather52840-s140/firmware.hex" +Converting to uf2, output size: 392192, start address: 0x26000 +Wrote 392192 bytes to build-feather52840-s140/firmware.uf2. +``` + +Simply drag and drop firmware.uf2 to the MSC, the nrf52840 will blink fast and reset after done. diff --git a/ports/nrf/boards/TG-Watch02A/board.c b/ports/nrf/boards/TG-Watch02A/board.c new file mode 100644 index 0000000000..4421970eef --- /dev/null +++ b/ports/nrf/boards/TG-Watch02A/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 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/TG-Watch02A/mpconfigboard.h b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h new file mode 100644 index 0000000000..27bebec643 --- /dev/null +++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h @@ -0,0 +1,72 @@ +/* + * 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 "TG-Watch02A-rev00" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define FLASH_SIZE (0x100000) +#define FLASH_PAGE_SIZE (4096) + +#define MICROPY_HW_NEOPIXEL (&pin_P0_16) + +#define MICROPY_HW_LED_STATUS (&pin_P1_15) + +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17) +#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22) +#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23) +#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21) +#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19) +#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20) +#endif + +#if SPI_FLASH_FILESYSTEM +#define SPI_FLASH_MOSI_PIN &pin_P0_17 +#define SPI_FLASH_MISO_PIN &pin_P0_22 +#define SPI_FLASH_SCK_PIN &pin_P0_19 +#define SPI_FLASH_CS_PIN &pin_P0_20 +#endif + +#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 + +#define CIRCUITPY_INTERNAL_NVM_SIZE (4096) + +#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) + +#define BOARD_HAS_CRYSTAL 0 + +#define DEFAULT_I2C_BUS_SCL (&pin_P0_11) +#define DEFAULT_I2C_BUS_SDA (&pin_P0_12) + +#define DEFAULT_SPI_BUS_SCK (&pin_P0_14) +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13) +#define DEFAULT_SPI_BUS_MISO (&pin_P0_15) + +#define DEFAULT_UART_BUS_RX (&pin_P0_24) +#define DEFAULT_UART_BUS_TX (&pin_P0_25) diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk new file mode 100644 index 0000000000..718a7862dc --- /dev/null +++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk @@ -0,0 +1,26 @@ +USB_VID = 0x239A +USB_PID = 0x802A +USB_PRODUCT = "TG-Watch02" +USB_MANUFACTURER = "TG-Tech + +MCU_SERIES = m4 +MCU_VARIANT = nrf52 +MCU_SUB_VARIANT = nrf52840 +MCU_CHIP = nrf52840 +SD ?= s140 +SOFTDEV_VERSION ?= 6.1.0 + +BOOT_SETTING_ADDR = 0xFF000 + +ifeq ($(SD),) + LD_FILE = boards/nrf52840_1M_256k.ld +else + LD_FILE = boards/adafruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_v$(firstword $(subst ., ,$(SOFTDEV_VERSION))).ld + CIRCUITPY_BLEIO = 1 +endif + +NRF_DEFINES += -DNRF52840_XXAA -DNRF52840 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = "GD25Q16C" diff --git a/ports/nrf/boards/TG-Watch02A/pins.c b/ports/nrf/boards/TG-Watch02A/pins.c new file mode 100644 index 0000000000..ec2689ab45 --- /dev/null +++ b/ports/nrf/boards/TG-Watch02A/pins.c @@ -0,0 +1,53 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_03) }, + + { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_29) }, + + { MP_ROM_QSTR(MP_QSTR_SWITCH), MP_ROM_PTR(&pin_P1_02) }, + + { 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_D2), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P1_09) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_16) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_24) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) }, + + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P1_15) }, + { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P1_15) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P1_15) }, + + { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P1_10) }, + + { 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); diff --git a/ports/nrf/boards/pca10056/mpconfigboard.h b/ports/nrf/boards/pca10056/mpconfigboard.h index 5b30c7fe83..8cc3ad8c21 100644 --- a/ports/nrf/boards/pca10056/mpconfigboard.h +++ b/ports/nrf/boards/pca10056/mpconfigboard.h @@ -5,6 +5,7 @@ * * Copyright (c) 2016 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 From 527eb2444c7d0f82e7a6192f04a93af22f24dee9 Mon Sep 17 00:00:00 2001 From: TG-Techie Date: Fri, 28 Feb 2020 04:11:54 -0500 Subject: [PATCH 02/12] added TG-Watch02A pins --- ports/nrf/boards/TG-Watch02A/README.md | 201 ++++++++++++++++++ ports/nrf/boards/TG-Watch02A/board.c | 38 ++++ ports/nrf/boards/TG-Watch02A/mpconfigboard.h | 63 ++++++ ports/nrf/boards/TG-Watch02A/mpconfigboard.mk | 10 + ports/nrf/boards/TG-Watch02A/pins.c | 86 ++++++++ 5 files changed, 398 insertions(+) create mode 100644 ports/nrf/boards/TG-Watch02A/README.md create mode 100644 ports/nrf/boards/TG-Watch02A/board.c create mode 100644 ports/nrf/boards/TG-Watch02A/mpconfigboard.h create mode 100644 ports/nrf/boards/TG-Watch02A/mpconfigboard.mk create mode 100644 ports/nrf/boards/TG-Watch02A/pins.c diff --git a/ports/nrf/boards/TG-Watch02A/README.md b/ports/nrf/boards/TG-Watch02A/README.md new file mode 100644 index 0000000000..8d515010f9 --- /dev/null +++ b/ports/nrf/boards/TG-Watch02A/README.md @@ -0,0 +1,201 @@ +# Setup + +The `feather52840` board is currently based on the `PCA10056` development +board from Nordic Semiconductors, since commercial modules are not yet +available for the nRF52840. + +The difference between the `pca10056` and `feather52840` board support +packages is that no bootloader is present on the `pca10056` (a HW debugger +like a Segger J-Link is required to flash firmware images), whereas the +`feather52840` package uses a serial bootloader, with a slightly different +flash layout to account for the bootloader's presence. + +Both targets run on the same hardware and assume the same pinouts. + +The `feather52840` board support package will be updated at a later date +to reflect any pin changes in the final Feather form-factor HW. + +## Installing CircuitPython submodules + +Before you can build, you will need to run the following commands once, which +will install the submodules that are part of the CircuitPython ecosystem, and +build the `mpy-cross` tool: + +``` +$ cd circuitpython +$ git submodule update --init +$ make -C mpy-cross +``` + +You then need to download the SD and Nordic SDK files via: + +> This script relies on `wget`, which must be available from the command line. + +``` +$ cd ports/nrf +$ ./bluetooth/download_ble_stack.sh +``` + +## Installing the Serial Bootloader + +The Adafruit nRF52840 Feather uses a serial bootloader that allows you to +update the core CircuitPython firmware and internal file system contents +using only a serial connection. + +On empty devices, the serial bootloader will need to be flashed once using a +HW debugger such as a Segger J-Link before the serial updater (`adafruit-nrfutil`) can +be used. + +### Install `nrfjprog` + +Before you can install the bootloader, you will first need to install the +`nrfjprog` tool from Nordic Semiconductors for your operating system. The +binary files can be downloaded via the following links: + +- [nRF5x toolset tar for Linux 32-bit v9.7.2](http://www.nordicsemi.com/eng/nordic/Products/nRF52832/nRF5x-Command-Line-Tools-Linux32/52619) +- [nRF5x toolset tar for Linux 64-bit v9.7.2](http://www.nordicsemi.com/eng/nordic/Products/nRF52832/nRF5x-Command-Line-Tools-Linux64/51388) +- [nRF5x toolset tar for OSX v9.7.2](http://www.nordicsemi.com/eng/nordic/Products/nRF52832/nRF5x-Command-Line-Tools-OSX/53406) +- [nRF5x toolset installer for Windows v9.7.2](http://www.nordicsemi.com/eng/nordic/Products/nRF52832/nRF5x-Command-Line-Tools-Win32/48768) + +You will then need to add the `nrfjprog` folder to your system `PATH` variable +so that it is available from the command line. The exact process for this is +OS specific, but on a POSIX type system like OS X or Linux, you can +temporarily add the location to your `PATH` environment variables as follows: + +``` +$ export PATH=$PATH:YOURPATHHERE/nRF5x-Command-Line-Tools_9_7_2_OSX/nrfjprog/ +``` + +You can test this by running the following command: + +``` +$ nrfjprog --version +nrfjprog version: 9.7.2 +JLinkARM.dll version: 6.20f +``` + +### Flash the USB CDC Bootloader with 'nrfjprog' + +> This operation only needs to be done once, and only on boards that don't + already have the serial bootloader installed. + +Firstly clone the [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader.git) and enter its directory + +``` +$ git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader.git +$ cd Adafruit_nRF52_Bootloader +``` + +Once `nrfjprog` is installed and available in `PATH` you can flash your +board with the serial bootloader via the following command: + +``` +make BOARD=feather_nrf52840_express VERSION=latest flash +``` + +This should give you the following (or very similar) output, and you will see +a DFU blinky pattern on one of the board LEDs: + +``` +$ make BOARD=pca10056 VERSION=latest flash +Flashing: bin/pca10056/6.0.0r0/pca10056_bootloader_s140_6.0.0r0.hex +nrfjprog --program bin/pca10056/6.0.0r0/pca10056_bootloader_s140_6.0.0r0.hex --chiperase -f nrf52 --reset +Parsing hex file. +Erasing user available code and UICR flash areas. +Applying system reset. +Checking that the area to write is not protected. +Programing device. +Applying system reset. +Run. +``` + +From this point onward, you can now use a simple serial port for firmware +updates. + +Note: You can specify other version that are available in the directory `Adafruit_nRF52_Bootloader/bin/feather_nrf52840_express/` . The `VERSION=latest` will use the latest bootloader available. + +### IMPORTANT: Disable Mass Storage on PCA10056 J-Link + +The J-Link firmware on the PCA10056 implement USB Mass Storage, but this +causes a known conflict with reliable USB CDC serial port communication. In +order to use the serial bootloader, **you must disable MSD support on the +Segger J-Link**! + +To disable mass storage support, run the `JLinkExe` (or equivalent) command, +and send `MSDDisable`. (You can re-enable MSD support via `MSDEnable`): + +``` +$ JLinkExe +SEGGER J-Link Commander V6.20f (Compiled Oct 13 2017 17:20:01) +DLL version V6.20f, compiled Oct 13 2017 17:19:52 + +Connecting to J-Link via USB...O.K. +Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 24 2017 17:30:12 +Hardware version: V1.00 +S/N: 683947110 +VTref = 3.300V + + +Type "connect" to establish a target connection, '?' for help +J-Link>MSDDisable +Probe configured successfully. +J-Link>exit +``` + +## Building and Flashing CircuitPython + +### Installing `adafruit-nrfutil` + +run follow command to install [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil) from PyPi + +``` +$ pip3 install adafruit-nrfutil --user +``` + +### Flashing CircuitPython with USB CDC + +With the serial bootloader present on your board, you first need to force your +board into DFU mode by holding down BUTTON1 and RESETTING the board (with +BUTTON1 still pressed as you come out of reset). + +This will give you a **fast blinky DFU pattern** to indicate you are in DFU +mode. + +You can **build and flash** a CircuitPython binary via the following command: + +``` +$ make V=1 SD=s140 SERIAL=/dev/tty.usbmodem1411 BOARD=feather52840 all dfu-gen dfu-flash +``` + +This should give you the following results: + +``` +$make V=1 BOARD=feather52840 SD=s140 SERIAL=/dev/tty.usbmodem1411 dfu-gen dfu-flash +nrfutil dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application build-feather52840-s140/firmware.hex build-feather52840-s140/dfu-package.zip +Zip created at build-feather52840-s140/dfu-package.zip +nrfutil --verbose dfu serial --package build-feather52840-s140/dfu-package.zip -p /dev/ttyACM1 -b 115200 --singlebank +Upgrading target on /dev/ttyACM1 with DFU package /home/hathach/Dropbox/adafruit/circuitpython/ada_cp/ports/nrf/build-feather52840-s140/dfu-package.zip. Flow control is disabled, Single bank mode +Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 199840 +Sending DFU start packet +Sending DFU init packet +Sending firmware file +######################################################################################################################################################################################################################################################################################################################################################################################################### +Activating new firmware + +DFU upgrade took 8.50606513023s +Device programmed. +``` + +### Flashing CircuitPython with MSC UF2 + +uf2 file is generated last by `all` target + +``` +$ make V=1 SD=s140 SERIAL=/dev/tty.usbmodem1411 BOARD=feather52840 all +Create firmware.uf2 +../../tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "build-feather52840-s140/firmware.uf2" "build-feather52840-s140/firmware.hex" +Converting to uf2, output size: 392192, start address: 0x26000 +Wrote 392192 bytes to build-feather52840-s140/firmware.uf2. +``` + +Simply drag and drop firmware.uf2 to the MSC, the nrf52840 will blink fast and reset after done. diff --git a/ports/nrf/boards/TG-Watch02A/board.c b/ports/nrf/boards/TG-Watch02A/board.c new file mode 100644 index 0000000000..4421970eef --- /dev/null +++ b/ports/nrf/boards/TG-Watch02A/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 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/TG-Watch02A/mpconfigboard.h b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h new file mode 100644 index 0000000000..acb84cba79 --- /dev/null +++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h @@ -0,0 +1,63 @@ +/* + * 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 "TG-Techie's TG-Watch02A" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define MICROPY_HW_NEOPIXEL (&pin_P0_16) + +#define MICROPY_HW_LED_STATUS (&pin_P1_15) + +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17) +#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22) +#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23) +#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21) +#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19) +#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20) +#endif + +#if SPI_FLASH_FILESYSTEM +#define SPI_FLASH_MOSI_PIN &pin_P0_17 +#define SPI_FLASH_MISO_PIN &pin_P0_22 +#define SPI_FLASH_SCK_PIN &pin_P0_19 +#define SPI_FLASH_CS_PIN &pin_P0_20 +#endif + +#define BOARD_HAS_CRYSTAL 0 + +#define DEFAULT_I2C_BUS_SCL (&pin_P0_11) +#define DEFAULT_I2C_BUS_SDA (&pin_P0_12) + +#define DEFAULT_SPI_BUS_SCK (&pin_P0_14) +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13) +#define DEFAULT_SPI_BUS_MISO (&pin_P0_15) + +#define DEFAULT_UART_BUS_RX (&pin_P0_24) +#define DEFAULT_UART_BUS_TX (&pin_P0_25) diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk new file mode 100644 index 0000000000..2c1385cf0c --- /dev/null +++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x239A +USB_PID = 0x802A +USB_PRODUCT = "TG-Watch02A" +USB_MANUFACTURER = "TG-Tech" + +MCU_CHIP = nrf52840 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 2 +EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q128JV_SQ" diff --git a/ports/nrf/boards/TG-Watch02A/pins.c b/ports/nrf/boards/TG-Watch02A/pins.c new file mode 100644 index 0000000000..cbd20d8687 --- /dev/null +++ b/ports/nrf/boards/TG-Watch02A/pins.c @@ -0,0 +1,86 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_03) }, + + { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_29) }, + + { MP_ROM_QSTR(MP_QSTR_SWITCH), MP_ROM_PTR(&pin_P1_02) }, + + { 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_D2), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P1_09) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_16) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_24) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) }, + + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P1_15) }, + { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P1_15) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P1_15) }, + + { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P1_10) }, + + { 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) }, + + /*TG-Watch02A specific pins*/ + + //tft / display pins + { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_DISP_PWR), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_P1_14) }, + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_P1_12) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_P1_01) }, + + //cap touch screen + { MP_ROM_QSTR(MP_QSTR_CTP_RESET), MP_ROM_PTR(&pin_P1_03) }, + { MP_ROM_QSTR(MP_QSTR_CTP_INT), MP_ROM_PTR(&pin_P1_05) }, + + //power / battery + { MP_ROM_QSTR(MP_QSTR_CHRG_STAT), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_BAT_VDIV), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_VBUS_PRESENT), MP_ROM_PTR(&pin_P1_04) }, + + //sensors / outputs + { MP_ROM_QSTR(MP_QSTR_RTC_RESET), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_RTC_INT), MP_ROM_PTR(&pin_P0_27) }, + + { MP_ROM_QSTR(MP_QSTR_ACCEL_INT1), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_ACCEL_INT2), MP_ROM_PTR(&pin_P1_10) }, + + { MP_ROM_QSTR(MP_QSTR_HAPTIC_INT), MP_ROM_PTR(&pin_P1_07) }, + { MP_ROM_QSTR(MP_QSTR_HAPTIC_ENABLE), MP_ROM_PTR(&pin_P1_06) }, + + //smc pins + { MP_ROM_QSTR(MP_QSTR_SMC_RESET), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON0), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_P1_09) }, +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 50b451ae0c9f6c35961d18c4c0b7ec85153228b5 Mon Sep 17 00:00:00 2001 From: TG-Techie Date: Tue, 10 Mar 2020 22:40:55 -0400 Subject: [PATCH 03/12] add TG-Watch02A board def --- ports/nrf/boards/TG-Watch02A/mpconfigboard.h | 20 +++------ ports/nrf/boards/TG-Watch02A/mpconfigboard.mk | 44 +++++++++---------- ports/nrf/boards/TG-Watch02A/pins.c | 6 +-- 3 files changed, 30 insertions(+), 40 deletions(-) diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.h b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h index 788454fc3a..d499f58e53 100644 --- a/ports/nrf/boards/TG-Watch02A/mpconfigboard.h +++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h @@ -27,21 +27,16 @@ #include "nrfx/hal/nrf_gpio.h" -<<<<<<< HEAD -#define MICROPY_HW_BOARD_NAME "TG-Techie's TG-Watch02A" + +#define MICROPY_HW_BOARD_NAME "TG-Techie's TG-Watch02A Rev:00" #define MICROPY_HW_MCU_NAME "nRF52840" -======= -#define MICROPY_HW_BOARD_NAME "TG-Watch02A-rev00" -#define MICROPY_HW_MCU_NAME "nRF52840" +//#define FLASH_SIZE (0x100000) +//#define FLASH_PAGE_SIZE (4096) -#define FLASH_SIZE (0x100000) -#define FLASH_PAGE_SIZE (4096) - ->>>>>>> 7198056bc31ebae22337af119c07c7dca03e85d5 #define MICROPY_HW_NEOPIXEL (&pin_P0_16) -#define MICROPY_HW_LED_STATUS (&pin_P1_15) +#define MICROPY_HW_LED_STATUS (&pin_P0_07) #if QSPI_FLASH_FILESYSTEM #define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17) @@ -59,15 +54,14 @@ #define SPI_FLASH_CS_PIN &pin_P0_20 #endif -<<<<<<< HEAD -======= +/* #define CIRCUITPY_AUTORELOAD_DELAY_MS 500 #define CIRCUITPY_INTERNAL_NVM_SIZE (4096) #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) +*/ ->>>>>>> 7198056bc31ebae22337af119c07c7dca03e85d5 #define BOARD_HAS_CRYSTAL 0 #define DEFAULT_I2C_BUS_SCL (&pin_P0_11) diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk index 62010930a9..2629643071 100644 --- a/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk +++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x239A USB_PID = 0x802A -<<<<<<< HEAD + USB_PRODUCT = "TG-Watch02A" USB_MANUFACTURER = "TG-Tech" @@ -9,29 +9,29 @@ MCU_CHIP = nrf52840 QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q128JV_SQ" -======= -USB_PRODUCT = "TG-Watch02" -USB_MANUFACTURER = "TG-Tech -MCU_SERIES = m4 -MCU_VARIANT = nrf52 -MCU_SUB_VARIANT = nrf52840 -MCU_CHIP = nrf52840 -SD ?= s140 -SOFTDEV_VERSION ?= 6.1.0 -BOOT_SETTING_ADDR = 0xFF000 +#USB_PRODUCT = "TG-Watch02" +#USB_MANUFACTURER = "TG-Tech -ifeq ($(SD),) - LD_FILE = boards/nrf52840_1M_256k.ld -else - LD_FILE = boards/adafruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_v$(firstword $(subst ., ,$(SOFTDEV_VERSION))).ld - CIRCUITPY_BLEIO = 1 -endif +#MCU_SERIES = m4 +#MCU_VARIANT = nrf52 +#MCU_SUB_VARIANT = nrf52840 +#MCU_CHIP = nrf52840 +#SD ?= s140 +#SOFTDEV_VERSION ?= 6.1.0 -NRF_DEFINES += -DNRF52840_XXAA -DNRF52840 +#BOOT_SETTING_ADDR = 0xFF000 -QSPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICE_COUNT = 1 -EXTERNAL_FLASH_DEVICES = "GD25Q16C" ->>>>>>> 7198056bc31ebae22337af119c07c7dca03e85d5 +#ifeq ($(SD),) +# LD_FILE = boards/nrf52840_1M_256k.ld +#else +# LD_FILE = boards/adafruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_v$(firstword $(subst ., ,$(SOFTDEV_VERSION))).ld +# CIRCUITPY_BLEIO = 1 +#endif + +#NRF_DEFINES += -DNRF52840_XXAA -DNRF52840 + +#QSPI_FLASH_FILESYSTEM = 1 +#EXTERNAL_FLASH_DEVICE_COUNT = 1 +#EXTERNAL_FLASH_DEVICES = "GD25Q16C" diff --git a/ports/nrf/boards/TG-Watch02A/pins.c b/ports/nrf/boards/TG-Watch02A/pins.c index b93df80ae9..a856b18eee 100644 --- a/ports/nrf/boards/TG-Watch02A/pins.c +++ b/ports/nrf/boards/TG-Watch02A/pins.c @@ -48,8 +48,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { 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) }, -<<<<<<< HEAD - /*TG-Watch02A specific pins*/ //tft / display pins @@ -74,7 +72,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_ACCEL_INT1), MP_ROM_PTR(&pin_P1_11) }, { MP_ROM_QSTR(MP_QSTR_ACCEL_INT2), MP_ROM_PTR(&pin_P1_10) }, - + { MP_ROM_QSTR(MP_QSTR_HAPTIC_INT), MP_ROM_PTR(&pin_P1_07) }, { MP_ROM_QSTR(MP_QSTR_HAPTIC_ENABLE), MP_ROM_PTR(&pin_P1_06) }, @@ -82,8 +80,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SMC_RESET), MP_ROM_PTR(&pin_P0_08) }, { MP_ROM_QSTR(MP_QSTR_BUTTON0), MP_ROM_PTR(&pin_P1_08) }, { MP_ROM_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_P1_09) }, -======= ->>>>>>> 7198056bc31ebae22337af119c07c7dca03e85d5 }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From b967a2071fb81bf5dd737e47cf6d41e4d8828c26 Mon Sep 17 00:00:00 2001 From: TG-Techie Date: Tue, 10 Mar 2020 23:07:25 -0400 Subject: [PATCH 04/12] changed TG-Watch02A HW_BOARD_NAME --- ports/nrf/boards/TG-Watch02A/mpconfigboard.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.h b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h index d499f58e53..7811bc893a 100644 --- a/ports/nrf/boards/TG-Watch02A/mpconfigboard.h +++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h @@ -28,13 +28,13 @@ #include "nrfx/hal/nrf_gpio.h" -#define MICROPY_HW_BOARD_NAME "TG-Techie's TG-Watch02A Rev:00" +#define MICROPY_HW_BOARD_NAME "TG-Techie's TG-Watch02A" #define MICROPY_HW_MCU_NAME "nRF52840" //#define FLASH_SIZE (0x100000) //#define FLASH_PAGE_SIZE (4096) -#define MICROPY_HW_NEOPIXEL (&pin_P0_16) +//#define MICROPY_HW_NEOPIXEL (&pin_P0_16) #define MICROPY_HW_LED_STATUS (&pin_P0_07) From 2b161d37dffa4662ca5193c2f45c75f93a1cf896 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 10 Mar 2020 17:16:31 -0400 Subject: [PATCH 05/12] stm32: add PulseIn module --- ports/stm32f4/common-hal/pulseio/PulseIn.c | 263 ++++++++++++++++++++- ports/stm32f4/common-hal/pulseio/PulseIn.h | 3 +- ports/stm32f4/supervisor/port.c | 2 + 3 files changed, 260 insertions(+), 8 deletions(-) diff --git a/ports/stm32f4/common-hal/pulseio/PulseIn.c b/ports/stm32f4/common-hal/pulseio/PulseIn.c index 068936bdd0..d361a1e9a7 100644 --- a/ports/stm32f4/common-hal/pulseio/PulseIn.c +++ b/ports/stm32f4/common-hal/pulseio/PulseIn.c @@ -34,46 +34,295 @@ #include "shared-bindings/pulseio/PulseIn.h" #include "tick.h" +#include "stm32f4xx_hal.h" + +#define STM32_GPIO_PORT_SIZE 16 + +static pulseio_pulsein_obj_t* _objs[STM32_GPIO_PORT_SIZE]; + +static void assign_EXTI_Interrupt(pulseio_pulsein_obj_t* self, uint8_t num); + +static void pulsein_handler(uint8_t num) { + // Grab the current time first. + uint32_t current_us; + uint64_t current_ms; + current_tick(¤t_ms, ¤t_us); + + // current_tick gives us the remaining us until the next tick but we want the number since the last ms. + current_us = 1000 - current_us; + + pulseio_pulsein_obj_t* self = _objs[num]; + if ( !self ) return; + + if (self->first_edge) { + // first pulse is opposite state from idle + bool state = HAL_GPIO_ReadPin(pin_port(self->pin->port), pin_mask(self->pin->number)); + if ( self->idle_state != state ) { + self->first_edge = false; + } + } else { + uint32_t ms_diff = current_ms - self->last_ms; + uint16_t us_diff = current_us - self->last_us; + uint32_t total_diff = us_diff; + + if (self->last_us > current_us) { + total_diff = 1000 + current_us - self->last_us; + if (ms_diff > 1) { + total_diff += (ms_diff - 1) * 1000; + } + } else { + total_diff += ms_diff * 1000; + } + uint16_t duration = 0xffff; + if (total_diff < duration) { + duration = total_diff; + } + + uint16_t i = (self->start + self->len) % self->maxlen; + self->buffer[i] = duration; + if (self->len < self->maxlen) { + self->len++; + } else { + self->start++; + } + } + + self->last_ms = current_ms; + self->last_us = current_us; +} + void pulsein_reset(void) { + // Disable all active interrupts and clear array + for (uint i = 0; i < STM32_GPIO_PORT_SIZE; i++) { + if (_objs[i] != NULL) { + HAL_NVIC_DisableIRQ(_objs[i]->irq); + } + } + memset(_objs, 0, sizeof(_objs)); } void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu_pin_obj_t* pin, uint16_t maxlen, bool idle_state) { - mp_raise_NotImplementedError(translate("PulseIn not yet supported")); + // STM32 has one shared EXTI for each pin number, 0-15 + uint8_t p_num = pin->number; + if(_objs[p_num]) { + mp_raise_ValueError(translate("Pin number already reserved by EXTI")); + } + _objs[p_num] = self; + + // Allocate pulse buffer + self->buffer = (uint16_t *) m_malloc(maxlen * sizeof(uint16_t), false); + if (self->buffer == NULL) { + mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), + maxlen * sizeof(uint16_t)); + } + + // Set internal variables + self->pin = pin; + self->maxlen = maxlen; + self->idle_state = idle_state; + self->start = 0; + self->len = 0; + self->first_edge = true; + self->paused = false; + self->last_us = 0; + self->last_ms = 0; + + // EXTI pins can also be read as an input + GPIO_InitTypeDef GPIO_InitStruct = {0}; + GPIO_InitStruct.Pin = pin_mask(pin->number); + GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING; + GPIO_InitStruct.Pull = GPIO_NOPULL; + HAL_GPIO_Init(pin_port(pin->port), &GPIO_InitStruct); + + // Interrupt starts immediately + assign_EXTI_Interrupt(self, pin->number); + HAL_NVIC_EnableIRQ(self->irq); + claim_pin(pin); } bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) { - return true; + return (self->pin == NULL); } void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) { + if (common_hal_pulseio_pulsein_deinited(self)) { + return; + } + HAL_NVIC_DisableIRQ(self->irq); + _objs[self->pin->number] = NULL; + reset_pin_number(self->pin->port, self->pin->number); + self->pin = NULL; } void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t* self) { + HAL_NVIC_DisableIRQ(self->irq); + self->paused = true; } void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self, uint16_t trigger_duration) { + // Make sure we're paused. + if ( !self->paused ) { + common_hal_pulseio_pulsein_pause(self); + } + + // Send the trigger pulse. + if (trigger_duration > 0) { + GPIO_InitTypeDef GPIO_InitStruct = {0}; + GPIO_InitStruct.Pin = pin_mask(self->pin->number); + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(pin_port(self->pin->port), &GPIO_InitStruct); + + HAL_GPIO_WritePin(pin_port(self->pin->port), pin_mask(self->pin->number), !self->idle_state); + common_hal_mcu_delay_us((uint32_t)trigger_duration); + HAL_GPIO_WritePin(pin_port(self->pin->port), pin_mask(self->pin->number), self->idle_state); + + GPIO_InitStruct.Pin = pin_mask(self->pin->number); + GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING; + GPIO_InitStruct.Pull = GPIO_NOPULL; + HAL_GPIO_Init(pin_port(self->pin->port), &GPIO_InitStruct); + } + + self->first_edge = true; + self->paused = false; + self->last_ms = 0; + self->last_us = 0; + + HAL_NVIC_EnableIRQ(self->irq); } void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t* self) { + HAL_NVIC_DisableIRQ(self->irq); + self->start = 0; + self->len = 0; + HAL_NVIC_EnableIRQ(self->irq); } uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self, int16_t index) { - return 0; + HAL_NVIC_DisableIRQ(self->irq); + if (index < 0) { + index += self->len; + } + if (index < 0 || index >= self->len) { + HAL_NVIC_EnableIRQ(self->irq); + mp_raise_IndexError(translate("index out of range")); + } + uint16_t value = self->buffer[(self->start + index) % self->maxlen]; + HAL_NVIC_EnableIRQ(self->irq); + return value; } uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) { - return 0; + if (self->len == 0) { + mp_raise_IndexError(translate("pop from an empty PulseIn")); + } + HAL_NVIC_DisableIRQ(self->irq); + uint16_t value = self->buffer[self->start]; + self->start = (self->start + 1) % self->maxlen; + self->len--; + HAL_NVIC_EnableIRQ(self->irq); + + return value; } uint16_t common_hal_pulseio_pulsein_get_maxlen(pulseio_pulsein_obj_t* self) { - return 0; + return self->maxlen; } bool common_hal_pulseio_pulsein_get_paused(pulseio_pulsein_obj_t* self) { - return 0; + return self->paused; } uint16_t common_hal_pulseio_pulsein_get_len(pulseio_pulsein_obj_t* self) { - return 0; + return self->len; +} + +static void assign_EXTI_Interrupt(pulseio_pulsein_obj_t* self, uint8_t num) { + if (num == 0) { + self->irq = EXTI0_IRQn; + } else if (num == 1) { + self->irq = EXTI1_IRQn; + } else if (num == 2) { + self->irq = EXTI2_IRQn; + } else if (num == 3) { + self->irq = EXTI3_IRQn; + } else if (num == 4) { + self->irq = EXTI4_IRQn; + } else if (num >= 5 && num <= 9 ) { + self->irq = EXTI9_5_IRQn; + } else if (num >= 10 && num <= 15) { + self->irq = EXTI15_10_IRQn; + } +} + +void EXTI0_IRQHandler(void) +{ + EXTI->PR = 1 << 0; + pulsein_handler(0); +} +void EXTI1_IRQHandler(void) +{ + EXTI->PR = 1 << 1; + pulsein_handler(1); +} +void EXTI2_IRQHandler(void) +{ + EXTI->PR = 1 << 2; + pulsein_handler(2); +} +void EXTI3_IRQHandler(void) +{ + EXTI->PR = 1 << 3; + pulsein_handler(3); +} +void EXTI4_IRQHandler(void) +{ + EXTI->PR = 1 << 4; + pulsein_handler(4); +} +void EXTI9_5_IRQHandler(void) +{ + uint32_t pending = EXTI->PR; + if(pending & (1 << 5)) { + EXTI->PR = 1 << 5; + pulsein_handler(5); + } else if (pending & (1 << 6)) { + EXTI->PR = 1 << 6; + pulsein_handler(6); + } else if (pending & (1 << 7)) { + EXTI->PR = 1 << 7; + pulsein_handler(7); + } else if (pending & (1 << 8)) { + EXTI->PR = 1 << 8; + pulsein_handler(8); + } else if (pending & (1 << 9)) { + EXTI->PR = 1 << 9; + pulsein_handler(9); + } +} + +void EXTI15_10_IRQHandler(void) +{ + uint32_t pending = EXTI->PR; + if(pending & (1 << 10)) { + EXTI->PR = 1 << 10; + pulsein_handler(10); + } else if (pending & (1 << 11)) { + EXTI->PR = 1 << 11; + pulsein_handler(11); + } else if (pending & (1 << 12)) { + EXTI->PR = 1 << 12; + pulsein_handler(12); + } else if (pending & (1 << 13)) { + EXTI->PR = 1 << 13; + pulsein_handler(13); + } else if (pending & (1 << 14)) { + EXTI->PR = 1 << 14; + pulsein_handler(14); + } else if (pending & (1 << 15)) { + EXTI->PR = 1 << 15; + pulsein_handler(15); + } } diff --git a/ports/stm32f4/common-hal/pulseio/PulseIn.h b/ports/stm32f4/common-hal/pulseio/PulseIn.h index 2538b07ab5..5456613c6a 100644 --- a/ports/stm32f4/common-hal/pulseio/PulseIn.h +++ b/ports/stm32f4/common-hal/pulseio/PulseIn.h @@ -34,7 +34,8 @@ typedef struct { mp_obj_base_t base; - uint8_t pin; + const mcu_pin_obj_t* pin; + IRQn_Type irq; bool idle_state; bool paused; volatile bool first_edge; diff --git a/ports/stm32f4/supervisor/port.c b/ports/stm32f4/supervisor/port.c index ecb4d3d15c..948e9f2e4a 100644 --- a/ports/stm32f4/supervisor/port.c +++ b/ports/stm32f4/supervisor/port.c @@ -36,6 +36,7 @@ #include "common-hal/busio/UART.h" #include "common-hal/pulseio/PWMOut.h" #include "common-hal/pulseio/PulseOut.h" +#include "common-hal/pulseio/PulseIn.h" #include "stm32f4/clocks.h" #include "stm32f4/gpio.h" @@ -62,6 +63,7 @@ void reset_port(void) { uart_reset(); pwmout_reset(); pulseout_reset(); + pulsein_reset(); } void reset_to_bootloader(void) { From 2a082baa63ea401fea40c3d643efb9c037c208c3 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Wed, 11 Mar 2020 16:39:57 -0400 Subject: [PATCH 06/12] Add up to date translations --- locale/ID.po | 16 ++++++++++------ locale/circuitpython.pot | 16 ++++++++++------ locale/de_DE.po | 16 ++++++++++------ locale/en_US.po | 16 ++++++++++------ locale/en_x_pirate.po | 16 ++++++++++------ locale/es.po | 16 ++++++++++------ locale/fil.po | 16 ++++++++++------ locale/fr.po | 16 ++++++++++------ locale/it_IT.po | 16 ++++++++++------ locale/ko.po | 16 ++++++++++------ locale/pl.po | 16 ++++++++++------ locale/pt_BR.po | 16 ++++++++++------ locale/zh_Latn_pinyin.po | 19 +++++++++++++------ 13 files changed, 133 insertions(+), 78 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index dff59c1ce5..03111a7a8f 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -709,6 +709,7 @@ msgstr "Gagal untuk mengalokasikan buffer RX" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "Gagal untuk megalokasikan buffer RX dari %d byte" @@ -1165,6 +1166,10 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "Pin tidak mempunya kemampuan untuk ADC (Analog Digital Converter)" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Tambahkan module apapun pada filesystem\n" @@ -1187,10 +1192,6 @@ msgstr "" msgid "Pull not used when direction is output." msgstr "" -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2231,7 +2232,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "index keluar dari jangkauan" @@ -2718,6 +2720,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "Muncul dari PulseIn yang kosong" @@ -2949,6 +2952,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "tx dan rx keduanya tidak boleh kosong" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index e9afe41c2f..7b56d28dc2 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -698,6 +698,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "" @@ -1153,6 +1154,10 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1173,10 +1178,6 @@ msgstr "" msgid "Pull not used when direction is output." msgstr "" -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2207,7 +2208,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2693,6 +2695,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -2923,6 +2926,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index b1ddf050ea..78cecce642 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: Pascal Deneaux\n" "Language-Team: Sebastian Plamauer, Pascal Deneaux\n" @@ -702,6 +702,7 @@ msgstr "Konnte keinen RX Buffer allozieren" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "Konnte keine RX Buffer mit %d allozieren" @@ -1168,6 +1169,10 @@ msgstr "Zugang verweigert" msgid "Pin does not have ADC capabilities" msgstr "Pin hat keine ADC Funktionalität" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "und alle Module im Dateisystem \n" @@ -1190,10 +1195,6 @@ msgstr "" msgid "Pull not used when direction is output." msgstr "Pull wird nicht verwendet, wenn die Richtung output ist." -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2237,7 +2238,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "index außerhalb der Reichweite" @@ -2731,6 +2733,7 @@ msgstr "pixel_shader muss displayio.Palette oder displayio.ColorConverter sein" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop von einem leeren PulseIn" @@ -2964,6 +2967,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "tx und rx können nicht beide None sein" diff --git a/locale/en_US.po b/locale/en_US.po index b41734976b..f452fdaad3 100644 --- a/locale/en_US.po +++ b/locale/en_US.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: \n" @@ -698,6 +698,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "" @@ -1153,6 +1154,10 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1173,10 +1178,6 @@ msgstr "" msgid "Pull not used when direction is output." msgstr "" -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2207,7 +2208,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2693,6 +2695,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -2923,6 +2926,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "" diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po index b079dcd092..709571f31b 100644 --- a/locale/en_x_pirate.po +++ b/locale/en_x_pirate.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: @sommersoft, @MrCertainly\n" @@ -702,6 +702,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "" @@ -1157,6 +1158,10 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "Belay that! Th' Pin be not ADC capable" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1177,10 +1182,6 @@ msgstr "" msgid "Pull not used when direction is output." msgstr "" -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2211,7 +2212,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2697,6 +2699,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -2927,6 +2930,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "" diff --git a/locale/es.po b/locale/es.po index 772c38f695..9c7f3e3cb4 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: 2018-08-24 22:56-0500\n" "Last-Translator: \n" "Language-Team: \n" @@ -704,6 +704,7 @@ msgstr "Ha fallado la asignación del buffer RX" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "Falló la asignación del buffer RX de %d bytes" @@ -1167,6 +1168,10 @@ msgstr "Permiso denegado" msgid "Pin does not have ADC capabilities" msgstr "Pin no tiene capacidad ADC" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c #, fuzzy msgid "Plus any modules on the filesystem\n" @@ -1189,10 +1194,6 @@ msgstr "" msgid "Pull not used when direction is output." msgstr "Pull no se usa cuando la dirección es output." -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2238,7 +2239,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "index fuera de rango" @@ -2731,6 +2733,7 @@ msgstr "pixel_shader debe ser displayio.Palette o displayio.ColorConverter" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop de un PulseIn vacío" @@ -2964,6 +2967,7 @@ msgstr "tuple/lista se require en RHS" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "Ambos tx y rx no pueden ser None" diff --git a/locale/fil.po b/locale/fil.po index 450ed5f0e2..ed31a176b7 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -712,6 +712,7 @@ msgstr "Nabigong ilaan ang RX buffer" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "Nabigong ilaan ang RX buffer ng %d bytes" @@ -1173,6 +1174,10 @@ msgstr "Walang pahintulot" msgid "Pin does not have ADC capabilities" msgstr "Ang pin ay walang kakayahan sa ADC" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Kasama ang kung ano pang modules na sa filesystem\n" @@ -1195,10 +1200,6 @@ msgstr "" msgid "Pull not used when direction is output." msgstr "Pull hindi ginagamit kapag ang direksyon ay output." -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2253,7 +2254,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "index wala sa sakop" @@ -2745,6 +2747,7 @@ msgstr "pixel_shader ay dapat displayio.Palette o displayio.ColorConverter" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop mula sa walang laman na PulseIn" @@ -2979,6 +2982,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "tx at rx hindi pwedeng parehas na None" diff --git a/locale/fr.po b/locale/fr.po index 708176c6bc..9345787c55 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: 2019-04-14 20:05+0100\n" "Last-Translator: Pierrick Couturier \n" "Language-Team: fr\n" @@ -715,6 +715,7 @@ msgstr "Echec de l'allocation du tampon RX" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "Echec de l'allocation de %d octets du tampon RX" @@ -1187,6 +1188,10 @@ msgstr "Permission refusée" msgid "Pin does not have ADC capabilities" msgstr "La broche ne peut être utilisée pour l'ADC" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c #, fuzzy msgid "Plus any modules on the filesystem\n" @@ -1208,10 +1213,6 @@ msgstr "Appuyez sur une touche pour entrer sur REPL ou CTRL-D pour recharger." msgid "Pull not used when direction is output." msgstr "Le tirage 'pull' n'est pas utilisé quand la direction est 'output'." -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2277,7 +2278,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "index hors gamme" @@ -2777,6 +2779,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "'pop' d'une entrée PulseIn vide" @@ -3012,6 +3015,7 @@ msgstr "tuple ou liste requis en partie droite" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "tx et rx ne peuvent être 'None' tous les deux" diff --git a/locale/it_IT.po b/locale/it_IT.po index f4eeea46fd..68cd7dd41d 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -712,6 +712,7 @@ msgstr "Impossibile allocare buffer RX" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "Fallita allocazione del buffer RX di %d byte" @@ -1182,6 +1183,10 @@ msgstr "Permesso negato" msgid "Pin does not have ADC capabilities" msgstr "Il pin non ha capacità di ADC" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c #, fuzzy msgid "Plus any modules on the filesystem\n" @@ -1204,10 +1209,6 @@ msgstr "" msgid "Pull not used when direction is output." msgstr "" -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2254,7 +2255,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "indice fuori intervallo" @@ -2752,6 +2754,7 @@ msgstr "pixel_shader deve essere displayio.Palette o displayio.ColorConverter" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop sun un PulseIn vuoto" @@ -2986,6 +2989,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "tx e rx non possono essere entrambi None" diff --git a/locale/ko.po b/locale/ko.po index 96bb26d091..656adf2cb2 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: 2019-05-06 14:22-0700\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" @@ -702,6 +702,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "" @@ -1157,6 +1158,10 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1177,10 +1182,6 @@ msgstr "" msgid "Pull not used when direction is output." msgstr "" -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2212,7 +2213,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2698,6 +2700,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -2928,6 +2931,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "" diff --git a/locale/pl.po b/locale/pl.po index 581dac8d0d..6eb37254b5 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" @@ -701,6 +701,7 @@ msgstr "Nie udała się alokacja bufora RX" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "Nie udała się alokacja %d bajtów na bufor RX" @@ -1158,6 +1159,10 @@ msgstr "Odmowa dostępu" msgid "Pin does not have ADC capabilities" msgstr "Nóżka nie obsługuje ADC" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Oraz moduły w systemie plików\n" @@ -1178,10 +1183,6 @@ msgstr "Dowolny klawisz aby uruchomić konsolę. CTRL-D aby przeładować." msgid "Pull not used when direction is output." msgstr "Podciągnięcie nieużywane w trybie wyjścia." -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2216,7 +2217,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "indeks poza zakresem" @@ -2703,6 +2705,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop z pustego PulseIn" @@ -2934,6 +2937,7 @@ msgstr "wymagana krotka/lista po prawej stronie" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "tx i rx nie mogą być oba None" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 3dce592e3b..a0f2024ebc 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: 2018-10-02 21:14-0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -707,6 +707,7 @@ msgstr "Falha ao alocar buffer RX" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "Falha ao alocar buffer RX de %d bytes" @@ -1168,6 +1169,10 @@ msgstr "Permissão negada" msgid "Pin does not have ADC capabilities" msgstr "O pino não tem recursos de ADC" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c #, fuzzy msgid "Plus any modules on the filesystem\n" @@ -1189,10 +1194,6 @@ msgstr "" msgid "Pull not used when direction is output." msgstr "" -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2229,7 +2230,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "Índice fora do intervalo" @@ -2715,6 +2717,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -2947,6 +2950,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "TX e RX não podem ser ambos" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index cc23d7fc80..e93bcb1d26 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-09 08:19-0500\n" +"POT-Creation-Date: 2020-03-11 17:52-0400\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -709,6 +709,7 @@ msgstr "Fēnpèi RX huǎnchōng shībài" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c #, c-format msgid "Failed to allocate RX buffer of %d bytes" msgstr "Fēnpèi RX huǎnchōng qū%d zì jié shībài" @@ -1172,6 +1173,10 @@ msgstr "Quánxiàn bèi jùjué" msgid "Pin does not have ADC capabilities" msgstr "Pin méiyǒu ADC nénglì" +#: ports/stm32f4/common-hal/pulseio/PulseIn.c +msgid "Pin number already reserved by EXTI" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Zài wénjiàn xìtǒng shàng tiānjiā rènhé mókuài\n" @@ -1192,10 +1197,6 @@ msgstr "Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzà msgid "Pull not used when direction is output." msgstr "Fāngxiàng shūchū shí Pull méiyǒu shǐyòng." -#: ports/stm32f4/common-hal/pulseio/PulseIn.c -msgid "PulseIn not yet supported" -msgstr "Shàng bù zhīchí PulseIn" - #: ports/stm32f4/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" msgstr "" @@ -2244,7 +2245,8 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "suǒyǐn chāochū fànwéi" @@ -2732,6 +2734,7 @@ msgstr "pixel_shader bìxū shì displayio.Palette huò displayio.ColorConverter #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/stm32f4/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "cóng kōng de PulseIn dànchū dànchū" @@ -2964,6 +2967,7 @@ msgstr "RHS yāoqiú de yuán zǔ/lièbiǎo" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: shared-bindings/busio/UART.c msgid "tx and rx cannot both be None" msgstr "tx hé rx bùnéng dōu shì wú" @@ -3325,6 +3329,9 @@ msgstr "líng bù" #~ msgid "Pixel beyond bounds of buffer" #~ msgstr "Xiàngsù chāochū huǎnchōng qū biānjiè" +#~ msgid "PulseIn not yet supported" +#~ msgstr "Shàng bù zhīchí PulseIn" + #~ msgid "PulseOut not yet supported" #~ msgstr "Shàng bù zhīchí PulseOut" From 197dc344aff695e1f122652b2337b727cb11460a Mon Sep 17 00:00:00 2001 From: TG-Techie Date: Thu, 12 Mar 2020 02:31:13 -0400 Subject: [PATCH 07/12] fix requested changes --- ports/nrf/boards/TG-Watch02A/README.md | 201 ------------------ ports/nrf/boards/TG-Watch02A/mpconfigboard.h | 14 -- ports/nrf/boards/TG-Watch02A/mpconfigboard.mk | 26 --- ports/nrf/boards/TG-Watch02A/pins.c | 38 +--- 4 files changed, 2 insertions(+), 277 deletions(-) delete mode 100644 ports/nrf/boards/TG-Watch02A/README.md diff --git a/ports/nrf/boards/TG-Watch02A/README.md b/ports/nrf/boards/TG-Watch02A/README.md deleted file mode 100644 index 8d515010f9..0000000000 --- a/ports/nrf/boards/TG-Watch02A/README.md +++ /dev/null @@ -1,201 +0,0 @@ -# Setup - -The `feather52840` board is currently based on the `PCA10056` development -board from Nordic Semiconductors, since commercial modules are not yet -available for the nRF52840. - -The difference between the `pca10056` and `feather52840` board support -packages is that no bootloader is present on the `pca10056` (a HW debugger -like a Segger J-Link is required to flash firmware images), whereas the -`feather52840` package uses a serial bootloader, with a slightly different -flash layout to account for the bootloader's presence. - -Both targets run on the same hardware and assume the same pinouts. - -The `feather52840` board support package will be updated at a later date -to reflect any pin changes in the final Feather form-factor HW. - -## Installing CircuitPython submodules - -Before you can build, you will need to run the following commands once, which -will install the submodules that are part of the CircuitPython ecosystem, and -build the `mpy-cross` tool: - -``` -$ cd circuitpython -$ git submodule update --init -$ make -C mpy-cross -``` - -You then need to download the SD and Nordic SDK files via: - -> This script relies on `wget`, which must be available from the command line. - -``` -$ cd ports/nrf -$ ./bluetooth/download_ble_stack.sh -``` - -## Installing the Serial Bootloader - -The Adafruit nRF52840 Feather uses a serial bootloader that allows you to -update the core CircuitPython firmware and internal file system contents -using only a serial connection. - -On empty devices, the serial bootloader will need to be flashed once using a -HW debugger such as a Segger J-Link before the serial updater (`adafruit-nrfutil`) can -be used. - -### Install `nrfjprog` - -Before you can install the bootloader, you will first need to install the -`nrfjprog` tool from Nordic Semiconductors for your operating system. The -binary files can be downloaded via the following links: - -- [nRF5x toolset tar for Linux 32-bit v9.7.2](http://www.nordicsemi.com/eng/nordic/Products/nRF52832/nRF5x-Command-Line-Tools-Linux32/52619) -- [nRF5x toolset tar for Linux 64-bit v9.7.2](http://www.nordicsemi.com/eng/nordic/Products/nRF52832/nRF5x-Command-Line-Tools-Linux64/51388) -- [nRF5x toolset tar for OSX v9.7.2](http://www.nordicsemi.com/eng/nordic/Products/nRF52832/nRF5x-Command-Line-Tools-OSX/53406) -- [nRF5x toolset installer for Windows v9.7.2](http://www.nordicsemi.com/eng/nordic/Products/nRF52832/nRF5x-Command-Line-Tools-Win32/48768) - -You will then need to add the `nrfjprog` folder to your system `PATH` variable -so that it is available from the command line. The exact process for this is -OS specific, but on a POSIX type system like OS X or Linux, you can -temporarily add the location to your `PATH` environment variables as follows: - -``` -$ export PATH=$PATH:YOURPATHHERE/nRF5x-Command-Line-Tools_9_7_2_OSX/nrfjprog/ -``` - -You can test this by running the following command: - -``` -$ nrfjprog --version -nrfjprog version: 9.7.2 -JLinkARM.dll version: 6.20f -``` - -### Flash the USB CDC Bootloader with 'nrfjprog' - -> This operation only needs to be done once, and only on boards that don't - already have the serial bootloader installed. - -Firstly clone the [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader.git) and enter its directory - -``` -$ git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader.git -$ cd Adafruit_nRF52_Bootloader -``` - -Once `nrfjprog` is installed and available in `PATH` you can flash your -board with the serial bootloader via the following command: - -``` -make BOARD=feather_nrf52840_express VERSION=latest flash -``` - -This should give you the following (or very similar) output, and you will see -a DFU blinky pattern on one of the board LEDs: - -``` -$ make BOARD=pca10056 VERSION=latest flash -Flashing: bin/pca10056/6.0.0r0/pca10056_bootloader_s140_6.0.0r0.hex -nrfjprog --program bin/pca10056/6.0.0r0/pca10056_bootloader_s140_6.0.0r0.hex --chiperase -f nrf52 --reset -Parsing hex file. -Erasing user available code and UICR flash areas. -Applying system reset. -Checking that the area to write is not protected. -Programing device. -Applying system reset. -Run. -``` - -From this point onward, you can now use a simple serial port for firmware -updates. - -Note: You can specify other version that are available in the directory `Adafruit_nRF52_Bootloader/bin/feather_nrf52840_express/` . The `VERSION=latest` will use the latest bootloader available. - -### IMPORTANT: Disable Mass Storage on PCA10056 J-Link - -The J-Link firmware on the PCA10056 implement USB Mass Storage, but this -causes a known conflict with reliable USB CDC serial port communication. In -order to use the serial bootloader, **you must disable MSD support on the -Segger J-Link**! - -To disable mass storage support, run the `JLinkExe` (or equivalent) command, -and send `MSDDisable`. (You can re-enable MSD support via `MSDEnable`): - -``` -$ JLinkExe -SEGGER J-Link Commander V6.20f (Compiled Oct 13 2017 17:20:01) -DLL version V6.20f, compiled Oct 13 2017 17:19:52 - -Connecting to J-Link via USB...O.K. -Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 24 2017 17:30:12 -Hardware version: V1.00 -S/N: 683947110 -VTref = 3.300V - - -Type "connect" to establish a target connection, '?' for help -J-Link>MSDDisable -Probe configured successfully. -J-Link>exit -``` - -## Building and Flashing CircuitPython - -### Installing `adafruit-nrfutil` - -run follow command to install [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil) from PyPi - -``` -$ pip3 install adafruit-nrfutil --user -``` - -### Flashing CircuitPython with USB CDC - -With the serial bootloader present on your board, you first need to force your -board into DFU mode by holding down BUTTON1 and RESETTING the board (with -BUTTON1 still pressed as you come out of reset). - -This will give you a **fast blinky DFU pattern** to indicate you are in DFU -mode. - -You can **build and flash** a CircuitPython binary via the following command: - -``` -$ make V=1 SD=s140 SERIAL=/dev/tty.usbmodem1411 BOARD=feather52840 all dfu-gen dfu-flash -``` - -This should give you the following results: - -``` -$make V=1 BOARD=feather52840 SD=s140 SERIAL=/dev/tty.usbmodem1411 dfu-gen dfu-flash -nrfutil dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application build-feather52840-s140/firmware.hex build-feather52840-s140/dfu-package.zip -Zip created at build-feather52840-s140/dfu-package.zip -nrfutil --verbose dfu serial --package build-feather52840-s140/dfu-package.zip -p /dev/ttyACM1 -b 115200 --singlebank -Upgrading target on /dev/ttyACM1 with DFU package /home/hathach/Dropbox/adafruit/circuitpython/ada_cp/ports/nrf/build-feather52840-s140/dfu-package.zip. Flow control is disabled, Single bank mode -Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 199840 -Sending DFU start packet -Sending DFU init packet -Sending firmware file -######################################################################################################################################################################################################################################################################################################################################################################################################### -Activating new firmware - -DFU upgrade took 8.50606513023s -Device programmed. -``` - -### Flashing CircuitPython with MSC UF2 - -uf2 file is generated last by `all` target - -``` -$ make V=1 SD=s140 SERIAL=/dev/tty.usbmodem1411 BOARD=feather52840 all -Create firmware.uf2 -../../tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "build-feather52840-s140/firmware.uf2" "build-feather52840-s140/firmware.hex" -Converting to uf2, output size: 392192, start address: 0x26000 -Wrote 392192 bytes to build-feather52840-s140/firmware.uf2. -``` - -Simply drag and drop firmware.uf2 to the MSC, the nrf52840 will blink fast and reset after done. diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.h b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h index 7811bc893a..9b8a31858d 100644 --- a/ports/nrf/boards/TG-Watch02A/mpconfigboard.h +++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h @@ -27,15 +27,9 @@ #include "nrfx/hal/nrf_gpio.h" - #define MICROPY_HW_BOARD_NAME "TG-Techie's TG-Watch02A" #define MICROPY_HW_MCU_NAME "nRF52840" -//#define FLASH_SIZE (0x100000) -//#define FLASH_PAGE_SIZE (4096) - -//#define MICROPY_HW_NEOPIXEL (&pin_P0_16) - #define MICROPY_HW_LED_STATUS (&pin_P0_07) #if QSPI_FLASH_FILESYSTEM @@ -54,14 +48,6 @@ #define SPI_FLASH_CS_PIN &pin_P0_20 #endif -/* -#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 - -#define CIRCUITPY_INTERNAL_NVM_SIZE (4096) - -#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) -*/ - #define BOARD_HAS_CRYSTAL 0 #define DEFAULT_I2C_BUS_SCL (&pin_P0_11) diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk index 2629643071..c75c6dd394 100644 --- a/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk +++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk @@ -9,29 +9,3 @@ MCU_CHIP = nrf52840 QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q128JV_SQ" - - -#USB_PRODUCT = "TG-Watch02" -#USB_MANUFACTURER = "TG-Tech - -#MCU_SERIES = m4 -#MCU_VARIANT = nrf52 -#MCU_SUB_VARIANT = nrf52840 -#MCU_CHIP = nrf52840 -#SD ?= s140 -#SOFTDEV_VERSION ?= 6.1.0 - -#BOOT_SETTING_ADDR = 0xFF000 - -#ifeq ($(SD),) -# LD_FILE = boards/nrf52840_1M_256k.ld -#else -# LD_FILE = boards/adafruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_v$(firstword $(subst ., ,$(SOFTDEV_VERSION))).ld -# CIRCUITPY_BLEIO = 1 -#endif - -#NRF_DEFINES += -DNRF52840_XXAA -DNRF52840 - -#QSPI_FLASH_FILESYSTEM = 1 -#EXTERNAL_FLASH_DEVICE_COUNT = 1 -#EXTERNAL_FLASH_DEVICES = "GD25Q16C" diff --git a/ports/nrf/boards/TG-Watch02A/pins.c b/ports/nrf/boards/TG-Watch02A/pins.c index a856b18eee..582d954ecc 100644 --- a/ports/nrf/boards/TG-Watch02A/pins.c +++ b/ports/nrf/boards/TG-Watch02A/pins.c @@ -1,53 +1,19 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_04) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_05) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_30) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_28) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_02) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_03) }, - - { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_31) }, - - { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_29) }, - { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_29) }, - - { MP_ROM_QSTR(MP_QSTR_SWITCH), MP_ROM_PTR(&pin_P1_02) }, - - { 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_D2), MP_ROM_PTR(&pin_P0_10) }, - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_08) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_07) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_26) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_27) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_06) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_08) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P1_09) }, - - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_16) }, + /*Port and bus pins*/ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) }, { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) }, { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_25) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_24) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) }, - { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P1_15) }, - { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P1_15) }, - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P1_15) }, - - { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P1_10) }, - { 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) }, + /*TG-Watch02A specific pins*/ //tft / display pins From ead32ea6e63eac21285bc59fc51973a5f1d4a351 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 12 Mar 2020 11:21:32 -0400 Subject: [PATCH 08/12] Comment change for CI --- ports/stm32f4/common-hal/pulseio/PulseIn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/stm32f4/common-hal/pulseio/PulseIn.c b/ports/stm32f4/common-hal/pulseio/PulseIn.c index d361a1e9a7..cf484daf9d 100644 --- a/ports/stm32f4/common-hal/pulseio/PulseIn.c +++ b/ports/stm32f4/common-hal/pulseio/PulseIn.c @@ -149,6 +149,7 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) { if (common_hal_pulseio_pulsein_deinited(self)) { return; } + //Remove pulsein slot from shared array HAL_NVIC_DisableIRQ(self->irq); _objs[self->pin->number] = NULL; reset_pin_number(self->pin->port, self->pin->number); From 0155fab356d5e41681e9d7a18355a70910d5200a Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 12 Mar 2020 15:03:21 -0400 Subject: [PATCH 09/12] Revise style on interrupt handler functions --- ports/stm32f4/common-hal/pulseio/PulseIn.c | 50 ++++++---------------- 1 file changed, 12 insertions(+), 38 deletions(-) diff --git a/ports/stm32f4/common-hal/pulseio/PulseIn.c b/ports/stm32f4/common-hal/pulseio/PulseIn.c index cf484daf9d..8428a22789 100644 --- a/ports/stm32f4/common-hal/pulseio/PulseIn.c +++ b/ports/stm32f4/common-hal/pulseio/PulseIn.c @@ -43,6 +43,9 @@ static pulseio_pulsein_obj_t* _objs[STM32_GPIO_PORT_SIZE]; static void assign_EXTI_Interrupt(pulseio_pulsein_obj_t* self, uint8_t num); static void pulsein_handler(uint8_t num) { + // Interrupt register must be cleared manually + EXTI->PR = 1 << num; + // Grab the current time first. uint32_t current_us; uint64_t current_ms; @@ -260,70 +263,41 @@ static void assign_EXTI_Interrupt(pulseio_pulsein_obj_t* self, uint8_t num) { void EXTI0_IRQHandler(void) { - EXTI->PR = 1 << 0; pulsein_handler(0); } void EXTI1_IRQHandler(void) { - EXTI->PR = 1 << 1; pulsein_handler(1); } void EXTI2_IRQHandler(void) { - EXTI->PR = 1 << 2; pulsein_handler(2); } void EXTI3_IRQHandler(void) { - EXTI->PR = 1 << 3; pulsein_handler(3); } void EXTI4_IRQHandler(void) { - EXTI->PR = 1 << 4; pulsein_handler(4); } + void EXTI9_5_IRQHandler(void) { uint32_t pending = EXTI->PR; - if(pending & (1 << 5)) { - EXTI->PR = 1 << 5; - pulsein_handler(5); - } else if (pending & (1 << 6)) { - EXTI->PR = 1 << 6; - pulsein_handler(6); - } else if (pending & (1 << 7)) { - EXTI->PR = 1 << 7; - pulsein_handler(7); - } else if (pending & (1 << 8)) { - EXTI->PR = 1 << 8; - pulsein_handler(8); - } else if (pending & (1 << 9)) { - EXTI->PR = 1 << 9; - pulsein_handler(9); + for (uint i = 5; i <= 9; i++) { + if(pending & (1 << i)) { + pulsein_handler(i); + } } } void EXTI15_10_IRQHandler(void) { uint32_t pending = EXTI->PR; - if(pending & (1 << 10)) { - EXTI->PR = 1 << 10; - pulsein_handler(10); - } else if (pending & (1 << 11)) { - EXTI->PR = 1 << 11; - pulsein_handler(11); - } else if (pending & (1 << 12)) { - EXTI->PR = 1 << 12; - pulsein_handler(12); - } else if (pending & (1 << 13)) { - EXTI->PR = 1 << 13; - pulsein_handler(13); - } else if (pending & (1 << 14)) { - EXTI->PR = 1 << 14; - pulsein_handler(14); - } else if (pending & (1 << 15)) { - EXTI->PR = 1 << 15; - pulsein_handler(15); + for (uint i = 10; i <= 15; i++) { + if(pending & (1 << i)) { + pulsein_handler(i); + } } } From ef7370d0238fe174d7ebab0a3b110a63ab191eaa Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 12 Mar 2020 17:01:14 -0400 Subject: [PATCH 10/12] Change ST drivers submodule to match TinyUSB --- .gitmodules | 12 +++---- conf.py | 2 +- ports/stm/Makefile | 87 ++++++++++++++++++++++----------------------- ports/stm/st_driver | 1 + ports/stm/stm32f4 | 1 - 5 files changed, 49 insertions(+), 54 deletions(-) create mode 160000 ports/stm/st_driver delete mode 160000 ports/stm/stm32f4 diff --git a/.gitmodules b/.gitmodules index 6300339d16..5c3387077c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -29,10 +29,6 @@ [submodule "tools/python-semver"] path = tools/python-semver url = https://github.com/k-bx/python-semver.git -[submodule "lib/stm32lib"] - path = lib/stm32lib - url = https://github.com/micropython/stm32lib - branch = work-F4-1.13.1+F7-1.5.0+L4-1.3.0 [submodule "atmel-samd/asf4"] path = ports/atmel-samd/asf4 url = https://github.com/adafruit/asf4.git @@ -96,9 +92,6 @@ [submodule "frozen/circuitpython-stage"] path = frozen/circuitpython-stage url = https://github.com/python-ugame/circuitpython-stage.git -[submodule "ports/stm/stm32f4"] - path = ports/stm/stm32f4 - url = https://github.com/adafruit/stm32f4.git [submodule "ports/cxd56/spresense-exported-sdk"] path = ports/cxd56/spresense-exported-sdk url = https://github.com/sonydevworld/spresense-exported-sdk.git @@ -122,4 +115,7 @@ url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI [submodule "frozen/Adafruit_CircuitPython_Requests"] path = frozen/Adafruit_CircuitPython_Requests - url = https://github.com/adafruit/Adafruit_CircuitPython_Requests \ No newline at end of file + url = https://github.com/adafruit/Adafruit_CircuitPython_Requests +[submodule "ports/stm/st_driver"] + path = ports/stm/st_driver + url = https://github.com/hathach/st_driver.git diff --git a/conf.py b/conf.py index 1f9f85b0bc..2ea0e8dc0f 100644 --- a/conf.py +++ b/conf.py @@ -132,7 +132,7 @@ exclude_patterns = ["**/build*", "ports/nrf/nrfx", "ports/nrf/peripherals", "ports/nrf/usb", - "ports/stm/stm32f4", + "ports/stm/st_driver", "ports/stm/peripherals", "ports/stm/ref", "ports/unix", diff --git a/ports/stm/Makefile b/ports/stm/Makefile index 3a6191c851..f8c05fd802 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -66,10 +66,10 @@ INC += -I. INC += -I../.. INC += -I$(BUILD) INC += -I$(BUILD)/genhdr -INC += -I./stm32f4/STM32F4xx_HAL_Driver/Inc -INC += -I./stm32f4/STM32F4xx_HAL_Driver/Inc/Legacy -INC += -I./stm32f4/CMSIS/Device/ST/STM32F4xx/Include -INC += -I./stm32f4/CMSIS/Include +INC += -I./st_driver/STM32F4xx_HAL_Driver/Inc +INC += -I./st_driver/STM32F4xx_HAL_Driver/Inc/Legacy +INC += -I./st_driver/CMSIS/Device/ST/STM32F4xx/Include +INC += -I./st_driver/CMSIS/Include INC += -I./boards INC += -I./boards/$(BOARD) INC += -I./peripherals @@ -147,46 +147,45 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_STM32F4 -DCFG_TUD_CDC_RX_BUFSIZE=1024 -DCFG_TUD ###################################### SRC_STM32 = \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_qspi.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_adc.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_i2c.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usart.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_rcc.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_utils.c \ - stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_exti.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_qspi.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_adc.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_i2c.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usart.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_rcc.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_utils.c \ + st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_exti.c \ system_stm32f4xx.c diff --git a/ports/stm/st_driver b/ports/stm/st_driver new file mode 160000 index 0000000000..3fc2e0f3db --- /dev/null +++ b/ports/stm/st_driver @@ -0,0 +1 @@ +Subproject commit 3fc2e0f3db155b33177bb0705e0dd65cadb58412 diff --git a/ports/stm/stm32f4 b/ports/stm/stm32f4 deleted file mode 160000 index 89a356f0b4..0000000000 --- a/ports/stm/stm32f4 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 89a356f0b44883d55c45a5d22940777a44a2b881 From 7907ef597927d730b5d8ba5d8df3dbfcc38cb5c2 Mon Sep 17 00:00:00 2001 From: TG-Techie Date: Thu, 12 Mar 2020 20:30:45 -0400 Subject: [PATCH 11/12] add TG-Watch02A to build workflow --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 32c949a3a8..6da2ac0959 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -228,6 +228,7 @@ jobs: - "stringcar_m0_express" - "teensy40" - "teknikio_bluebird" + - "TG-Watch02A" - "trellis_m4_express" - "trinket_m0" - "trinket_m0_haxpress" From 137d5c34fa5263ff7e52e8e471b37d2422e6e96b Mon Sep 17 00:00:00 2001 From: TG-Techie Date: Thu, 12 Mar 2020 20:39:42 -0400 Subject: [PATCH 12/12] fix board sorting (due to T being before a anf t) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6da2ac0959..7ff20dc7a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -122,6 +122,7 @@ jobs: fail-fast: false matrix: board: + - "TG-Watch02A" - "aramcon_badge_2019" - "arduino_mkr1300" - "arduino_mkrzero" @@ -228,7 +229,6 @@ jobs: - "stringcar_m0_express" - "teensy40" - "teknikio_bluebird" - - "TG-Watch02A" - "trellis_m4_express" - "trinket_m0" - "trinket_m0_haxpress"