Added support for the PCTEL WSC-1450 board

This commit is contained in:
Henric Linden 2023-11-24 21:52:32 +01:00
parent 3aac226d53
commit 0427e2b9d1
5 changed files with 213 additions and 0 deletions

View File

@ -0,0 +1,51 @@
# PCTEL WSC-1450
The PCTEL Wireless Sensor Core (WSC) is a versatile Industrial IoT product line
that offers multiple radio connectivity options including cellular, LoRa,
Bluetooth 5, NFC as well as 802.15.4 support.
In addition to several radios, the PCTEL WSC includes several sensors to
monitor a variety of physical conditions. These sensors can detect gas, air
quality, temperature, relative humidity, acceleration, angular rate of change,
magnetic field, range, and sound. For solution optimization, the PCTEL WSC can
be ordered with a subset of radios and sensors.
For more details about this board, and its varaiants, navigate to
https://pctel.com
# Build instructions
Configure your build enviroment according to the Adafruit instructions. To
build circuitpython for WSC-1450 do:
cd ports/nrf make BOARD=pctel_wsc_1450
This will create a number of firmware files in the `build-pctel_wsc_1450`
directory.
# Installing
The WSC-1450 do not feature an Adafruit-provided bootloader (supporting
niceties like UF2 flashing). Instead, WSC-1450 uses DAPLink. DAPLink handles
everything from debugging to programming the device, as well as the boot
sequence.
1. Connect the WSC-1450 dev kit unsing a USB cable to the `DHD USB` port. This
will power up the board and open a file browser showing the contents of the
target. (DAPlink magic)
2. Copy the newly built firmware to the WSC-1450 target using drag-n-drop or
other method. The file to upload is
`circuitpython/ports/nrf/build-pctel_wsc_1450/firmware.combined.hex`
3. Wait for the file to upload.
4. Install is complete. Reset the board.
# Running
Connect an additional USB cable to the `Target USB` port on the development
board and open a terminal like `screen` on Mac or `TeraTerm` on Windows. Serial
settings are 115200,n,8,1.
Don't forget to install/update the supporting python libraries.
Happy hacking.

View File

@ -0,0 +1,29 @@
/*
* 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 "supervisor/board.h"
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.

View File

@ -0,0 +1,64 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* 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
* 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 PCTELWSC1450
#define MICROPY_HW_BOARD_NAME "WSC-1450"
#define MICROPY_HW_MCU_NAME "nRF52840"
#define MICROPY_HW_LED_STATUS (&pin_P0_05)
#define DEFAULT_I2C_BUS_SCL (&pin_P0_27)
#define DEFAULT_I2C_BUS_SDA (&pin_P0_26)
#define DEFAULT_SPI_BUS_SCK (&pin_P1_15)
#define DEFAULT_SPI_BUS_MOSI (&pin_P1_13)
#define DEFAULT_SPI_BUS_MISO (&pin_P1_14)
#define DEFAULT_UART_BUS_RX (&pin_P0_16)
#define DEFAULT_UART_BUS_TX (&pin_P0_13)
// Flash operation mode is determined by MICROPY_QSPI_DATAn pin configuration.
// A pin config is valid if it is defined and its value is not 0xFF.
// Quad mode: If all DATA0 --> DATA3 are valid
// Dual mode: If DATA0 and DATA1 are valid while either DATA2 and/or DATA3 are invalid
// Single mode: If only DATA0 is valid
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 20)
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 21)
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 22)
#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 23)
#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19)
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 17)
// #if SPI_FLASH_FILESYSTEM
// #define SPI_FLASH_MOSI_PIN &pin_P0_20
// #define SPI_FLASH_MISO_PIN &pin_P0_21
// #define SPI_FLASH_SCK_PIN &pin_P0_19
// #define SPI_FLASH_CS_PIN &pin_P0_17
// #endif

View File

@ -0,0 +1,12 @@
USB_VID = 0x239A # TODO: change to PCTEL vendor id
USB_PID = 0x80FF # TODO: change to a PCTEL product id
USB_PRODUCT = "WSC-1450"
USB_MANUFACTURER = "PCTEL"
MCU_CHIP = nrf52840
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
# External flash is Winbond W25Q32JV_IQ
EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ"

View File

@ -0,0 +1,57 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
{ MP_ROM_QSTR(MP_QSTR_32KHZ_XTAL1 ), MP_ROM_PTR(&pin_P0_00) },
{ MP_ROM_QSTR(MP_QSTR_32KHZ_XTAL2 ), MP_ROM_PTR(&pin_P0_01) },
{ MP_ROM_QSTR(MP_QSTR_BATTERY ), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_BOARD_ID ), MP_ROM_PTR(&pin_P0_03) },
{ MP_ROM_QSTR(MP_QSTR_INT_LIGHT_TOF ), MP_ROM_PTR(&pin_P0_04) },
{ MP_ROM_QSTR(MP_QSTR_LED_RED ), MP_ROM_PTR(&pin_P0_05) },
{ MP_ROM_QSTR(MP_QSTR_I2S_SCK ), MP_ROM_PTR(&pin_P0_06) },
{ MP_ROM_QSTR(MP_QSTR_LORA_SCLK ), MP_ROM_PTR(&pin_P0_07) },
{ MP_ROM_QSTR(MP_QSTR_I2S_WS ), MP_ROM_PTR(&pin_P0_08) },
{ 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_LORA_MOSI ), MP_ROM_PTR(&pin_P0_11) },
{ MP_ROM_QSTR(MP_QSTR_LORA_MISO ), MP_ROM_PTR(&pin_P0_12) },
{ MP_ROM_QSTR(MP_QSTR_DEBUG_TX ), MP_ROM_PTR(&pin_P0_13) },
{ MP_ROM_QSTR(MP_QSTR_CELL_RTS ), MP_ROM_PTR(&pin_P0_14) },
{ MP_ROM_QSTR(MP_QSTR_CELL_DCD ), MP_ROM_PTR(&pin_P0_15) },
{ MP_ROM_QSTR(MP_QSTR_DEBUG_RX ), MP_ROM_PTR(&pin_P0_16) },
{ MP_ROM_QSTR(MP_QSTR_QSPI_CSN ), MP_ROM_PTR(&pin_P0_17) },
{ MP_ROM_QSTR(MP_QSTR_BT840_RESETN ), MP_ROM_PTR(&pin_P0_18) },
{ MP_ROM_QSTR(MP_QSTR_QSPI_CLK ), MP_ROM_PTR(&pin_P0_19) },
{ MP_ROM_QSTR(MP_QSTR_QSPI_IO0 ), MP_ROM_PTR(&pin_P0_20) },
{ MP_ROM_QSTR(MP_QSTR_QSPI_IO1 ), MP_ROM_PTR(&pin_P0_21) },
{ MP_ROM_QSTR(MP_QSTR_QSPI_IO2 ), MP_ROM_PTR(&pin_P0_22) },
{ MP_ROM_QSTR(MP_QSTR_QSPI_IO3 ), MP_ROM_PTR(&pin_P0_23) },
{ MP_ROM_QSTR(MP_QSTR_CELL_HW_SHUTDOWN ), MP_ROM_PTR(&pin_P0_24) },
{ MP_ROM_QSTR(MP_QSTR_I2S_SD ), MP_ROM_PTR(&pin_P0_25) },
{ MP_ROM_QSTR(MP_QSTR_SDA ), MP_ROM_PTR(&pin_P0_26) },
{ MP_ROM_QSTR(MP_QSTR_SCL ), MP_ROM_PTR(&pin_P0_27) },
{ MP_ROM_QSTR(MP_QSTR_CELL_POWER_ENABLE ), MP_ROM_PTR(&pin_P0_28) },
{ MP_ROM_QSTR(MP_QSTR_PUSH_BUTTON ), MP_ROM_PTR(&pin_P0_29) },
{ MP_ROM_QSTR(MP_QSTR_CELL_ON_OFF ), MP_ROM_PTR(&pin_P0_30) },
{ MP_ROM_QSTR(MP_QSTR_SENSOR_POWER_ENABLE ), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_BT840_SWO ), MP_ROM_PTR(&pin_P1_00) },
{ MP_ROM_QSTR(MP_QSTR_CELL_RX ), MP_ROM_PTR(&pin_P1_01) },
{ MP_ROM_QSTR(MP_QSTR_CELL_TX ), MP_ROM_PTR(&pin_P1_02) },
{ MP_ROM_QSTR(MP_QSTR_CELL_DSR ), MP_ROM_PTR(&pin_P1_03) },
{ MP_ROM_QSTR(MP_QSTR_CELL_DTR ), MP_ROM_PTR(&pin_P1_04) },
{ MP_ROM_QSTR(MP_QSTR_INT_ACCEL ), MP_ROM_PTR(&pin_P1_05) },
{ MP_ROM_QSTR(MP_QSTR_BOARD_ID_DISABLE ), MP_ROM_PTR(&pin_P1_06) },
{ MP_ROM_QSTR(MP_QSTR_LORA_DIO0 ), MP_ROM_PTR(&pin_P1_07) },
{ MP_ROM_QSTR(MP_QSTR_CELL_CTS ), MP_ROM_PTR(&pin_P1_08) },
{ MP_ROM_QSTR(MP_QSTR_LORA_SSN ), MP_ROM_PTR(&pin_P1_09) },
{ MP_ROM_QSTR(MP_QSTR_LORA_RESETN ), MP_ROM_PTR(&pin_P1_10) },
{ MP_ROM_QSTR(MP_QSTR_BATTERY_MONITOR_ENABLE ), MP_ROM_PTR(&pin_P1_11) },
{ MP_ROM_QSTR(MP_QSTR_LORA_DIO1 ), MP_ROM_PTR(&pin_P1_12) },
{ MP_ROM_QSTR(MP_QSTR_LORA_DIO2 ), MP_ROM_PTR(&pin_P1_13) },
{ MP_ROM_QSTR(MP_QSTR_LORA_DIO3 ), MP_ROM_PTR(&pin_P1_14) },
{ MP_ROM_QSTR(MP_QSTR_CELL_PWRMON ), MP_ROM_PTR(&pin_P1_15) },
{ MP_ROM_QSTR(MP_QSTR_LORA_DIO4 ), MP_ROM_PTR(&pin_P1_15) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);