add pca10100 for 833 as 3rd party

This commit is contained in:
hathach 2024-06-05 18:04:53 +07:00
parent 03bb265434
commit 56cb115ece
No known key found for this signature in database
GPG key ID: 26FAB84F615C3C52
5 changed files with 302 additions and 49 deletions

View file

@ -637,9 +637,9 @@ pca10056.name=Nordic nRF52840 DK
# VID/PID for Bootloader, Arduino & CircuitPython
pca10056.vid.0=0x239A
pca10056.pid.0=0x8029
pca10056.pid.0=0x80DA
pca10056.vid.1=0x239A
pca10056.pid.1=0x0029
pca10056.pid.1=0x00DA
# Upload
pca10056.bootloader.tool=bootburn
@ -662,7 +662,7 @@ pca10056.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
pca10056.build.ldscript=nrf52840_s140_v6.ld
pca10056.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
pca10056.build.vid=0x239A
pca10056.build.pid=0x8029
pca10056.build.pid=0x80DA
pca10056.build.uf2_family=0xADA52840
# Menu: SoftDevice
@ -690,6 +690,66 @@ pca10056.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_
pca10056.menu.debug_output.rtt=Segger RTT
pca10056.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
# -----------------------------------
# Nordic nRF52833 DK
# -----------------------------------
pca10100.name=Nordic nRF52833 DK
# VID/PID for Bootloader, Arduino & CircuitPython
pca10100.vid.0=0x239A
pca10100.pid.0=0x80D8
pca10100.vid.1=0x239A
pca10100.pid.1=0x00D8
# Upload
pca10100.bootloader.tool=bootburn
pca10100.upload.tool=nrfutil
pca10100.upload.protocol=nrfutil
pca10100.upload.use_1200bps_touch=true
pca10100.upload.wait_for_upload_port=true
pca10100.upload.maximum_size=286720
pca10100.upload.maximum_data_size=106496
# Build
pca10100.build.mcu=cortex-m4
pca10100.build.f_cpu=64000000
pca10100.build.board=NRF52833_PCA10100
pca10100.build.core=nRF5
pca10100.build.variant=pca10100
pca10100.build.usb_manufacturer="Nordic"
pca10100.build.usb_product="nRF52833 DK"
pca10100.build.extra_flags=-DNRF52833_XXAA {build.flags.usb}
pca10100.build.ldscript=nrf52833_s140_v7.ld
pca10100.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
pca10100.build.vid=0x239A
pca10100.build.pid=0x80D8
pca10100.build.uf2_family=0x621E937A
# Menu: SoftDevice
pca10100.menu.softdevice.s140v7=S140 7.3.0
pca10100.menu.softdevice.s140v7.build.sd_name=s140
pca10100.menu.softdevice.s140v7.build.sd_version=7.3.0
pca10100.menu.softdevice.s140v7.build.sd_fwid=0x0123
# Menu: Debug Level
pca10100.menu.debug.l0=Level 0 (Release)
pca10100.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
pca10100.menu.debug.l1=Level 1 (Error Message)
pca10100.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
pca10100.menu.debug.l2=Level 2 (Full Debug)
pca10100.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
pca10100.menu.debug.l3=Level 3 (Segger SystemView)
pca10100.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
pca10100.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
# Menu: Debug Port
pca10100.menu.debug_output.serial=Serial
pca10100.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
pca10100.menu.debug_output.serial1=Serial1
pca10100.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG
pca10100.menu.debug_output.rtt=Segger RTT
pca10100.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
# -----------------------------------
# Particle Xenon
# -----------------------------------
@ -697,9 +757,9 @@ particle_xenon.name=Particle Xenon
# VID/PID for Bootloader, Arduino & CircuitPython
particle_xenon.vid.0=0x239A
particle_xenon.pid.0=0x8029
particle_xenon.pid.0=0x80DA
particle_xenon.vid.1=0x239A
particle_xenon.pid.1=0x0029
particle_xenon.pid.1=0x00DA
# Upload
particle_xenon.bootloader.tool=bootburn
@ -722,7 +782,7 @@ particle_xenon.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
particle_xenon.build.ldscript=nrf52840_s140_v6.ld
particle_xenon.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
particle_xenon.build.vid=0x239A
particle_xenon.build.pid=0x8029
particle_xenon.build.pid=0x80DA
particle_xenon.build.uf2_family=0xADA52840
# Menu: SoftDevice

View file

@ -25,18 +25,7 @@ mcu_dict = {
}
def get_mcu(name):
if '52832' in name:
return 52832
elif '52833' in name:
return 52833
else:
# most of the board is 52840
return 52840
def build_upload(name):
mcu = get_mcu(name)
def build_upload(mcu, name):
print("# Upload")
print(f"{name}.bootloader.tool=bootburn")
print(f"{name}.upload.tool=nrfutil")
@ -53,7 +42,7 @@ def build_upload(name):
print()
def build_header(name, variant, vendor_name, product_name, boarddefine, vid, pid_list):
def build_header(mcu, name, variant, vendor_name, product_name, boarddefine, vid, pid_list):
prettyname = vendor_name + " " + product_name
print()
print("# -----------------------------------")
@ -68,7 +57,7 @@ def build_header(name, variant, vendor_name, product_name, boarddefine, vid, pid
print(f"{name}.pid.{i}={pid_list[i]}")
print()
build_upload(name)
build_upload(mcu, name)
print("# Build")
print(f"{name}.build.mcu=cortex-m4")
@ -79,7 +68,6 @@ def build_header(name, variant, vendor_name, product_name, boarddefine, vid, pid
print(f'{name}.build.usb_manufacturer="{vendor_name}"')
print(f'{name}.build.usb_product="{product_name}"')
mcu = get_mcu(name)
mcu_info = mcu_dict[mcu]
print(f"{name}.build.extra_flags={mcu_info['extra_flags']}")
print(f"{name}.build.ldscript={mcu_info['ldscript']}")
@ -91,9 +79,8 @@ def build_header(name, variant, vendor_name, product_name, boarddefine, vid, pid
print()
def build_softdevice(name):
def build_softdevice(mcu, name):
print("# Menu: SoftDevice")
mcu = get_mcu(name)
if mcu == 52832:
print(f"{name}.menu.softdevice.s132v6=S132 6.1.1")
print(f"{name}.menu.softdevice.s132v6.build.sd_name=s132")
@ -135,15 +122,16 @@ def build_debug_output(name):
print(f"{name}.menu.debug_output.rtt=Segger RTT")
print(f"{name}.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL")
def build_global_menu():
print("menu.softdevice=SoftDevice")
print("menu.debug=Debug Level")
print("menu.debug_output=Debug Port")
def make_board(name, variant, vendor_name, product_name, boarddefine, vid, pid_list):
build_header(name, variant, vendor_name, product_name, boarddefine, vid, pid_list)
build_softdevice(name)
def make_board(mcu, name, variant, vendor_name, product_name, boarddefine, vid, pid_list):
build_header(mcu, name, variant, vendor_name, product_name, boarddefine, vid, pid_list)
build_softdevice(mcu, name)
build_debug(name)
build_debug_output(name)
@ -158,37 +146,37 @@ build_global_menu()
# ------------------------------
adafruit_boards_list = [
["feather52832", "feather_nrf52832", "Adafruit", "Feather nRF52832", "NRF52832_FEATHER",
[52832, "feather52832", "feather_nrf52832", "Adafruit", "Feather nRF52832", "NRF52832_FEATHER",
"0x239A", []],
["feather52840", "feather_nrf52840_express", "Adafruit", "Feather nRF52840 Express", "NRF52840_FEATHER",
[52840, "feather52840", "feather_nrf52840_express", "Adafruit", "Feather nRF52840 Express", "NRF52840_FEATHER",
"0x239A", ["0x8029", "0x0029", "0x002A", "0x802A"]],
["feather52840sense", "feather_nrf52840_sense", "Adafruit", "Feather nRF52840 Sense", "NRF52840_FEATHER_SENSE",
[52840, "feather52840sense", "feather_nrf52840_sense", "Adafruit", "Feather nRF52840 Sense", "NRF52840_FEATHER_SENSE",
"0x239A", ["0x8087", "0x0087", "0x0088", "0x8088"]],
["feather_nrf52840_sense_tft", "feather_nrf52840_sense_tft", "Adafruit", "Feather nRF52840 Sense TFT", "NRF52840_FEATHER_SENSE_TFT",
[52840, "feather_nrf52840_sense_tft", "feather_nrf52840_sense_tft", "Adafruit", "Feather nRF52840 Sense TFT", "NRF52840_FEATHER_SENSE_TFT",
"0x239A", ["0x8087", "0x0087", "0x0088", "0x8088"]], # TODO shared VID with sense for now
["itsybitsy52840", "itsybitsy_nrf52840_express", "Adafruit", "ItsyBitsy nRF52840 Express", "NRF52840_ITSYBITSY -DARDUINO_NRF52_ITSYBITSY",
[52840, "itsybitsy52840", "itsybitsy_nrf52840_express", "Adafruit", "ItsyBitsy nRF52840 Express", "NRF52840_ITSYBITSY -DARDUINO_NRF52_ITSYBITSY",
"0x239A", ["0x8051", "0x0051", "0x0052", "0x8052"]],
["cplaynrf52840", "circuitplayground_nrf52840", "Adafruit", "Circuit Playground Bluefruit", "NRF52840_CIRCUITPLAY",
[52840, "cplaynrf52840", "circuitplayground_nrf52840", "Adafruit", "Circuit Playground Bluefruit", "NRF52840_CIRCUITPLAY",
"0x239A", ["0x8045", "0x0045", "0x8046"]],
["cluenrf52840", "clue_nrf52840", "Adafruit", "CLUE", "NRF52840_CLUE",
[52840, "cluenrf52840", "clue_nrf52840", "Adafruit", "CLUE", "NRF52840_CLUE",
"0x239A", ["0x8071", "0x0071", "0x8072"]],
["ledglasses_nrf52840", "ledglasses_nrf52840", "Adafruit", "LED Glasses Driver nRF52840", "NRF52840_LED_GLASSES",
[52840, "ledglasses_nrf52840", "ledglasses_nrf52840", "Adafruit", "LED Glasses Driver nRF52840", "NRF52840_LED_GLASSES",
"0x239A", ["0x810D", "0x010D", "0x810E"]],
["mdbt50qrx", "raytac_mdbt50q_rx", "Raytac", "nRF52840 Dongle", "MDBT50Q_RX",
[52840, "mdbt50qrx", "raytac_mdbt50q_rx", "Raytac", "nRF52840 Dongle", "MDBT50Q_RX",
"0x239A", ["0x810B", "0x010B", "0x810C"]],
["metro52840", "metro_nrf52840_express", "Adafruit", "Metro nRF52840 Express", "NRF52840_METRO",
[52840, "metro52840", "metro_nrf52840_express", "Adafruit", "Metro nRF52840 Express", "NRF52840_METRO",
"0x239A", ["0x803F", "0x003F", "0x0040", "0x8040"]],
# ["feather52833", "feather_nrf52833_express", "Adafruit", "Feather nRF52833 Express", "NRF52833_FEATHER",
# [52833, "feather52833", "feather_nrf52833_express", "Adafruit", "Feather nRF52833 Express", "NRF52833_FEATHER",
# "0x239A", ["0x8029", "0x0029", "0x002A", "0x802A"]],
]
@ -207,11 +195,9 @@ print("# and are not officially supported")
print("# -------------------------------------------------------")
thirdparty_boards_list = [
["pca10056", "pca10056", "Nordic", "nRF52840 DK", "NRF52840_PCA10056",
"0x239A", ["0x8029", "0x0029"]],
["particle_xenon", "particle_xenon", "Particle", "Xenon", "PARTICLE_XENON",
"0x239A", ["0x8029", "0x0029"]],
[52840, "pca10056", "pca10056", "Nordic", "nRF52840 DK", "NRF52840_PCA10056", "0x239A", ["0x80DA", "0x00DA"]],
[52833, "pca10100", "pca10100", "Nordic", "nRF52833 DK", "NRF52833_PCA10100", "0x239A", ["0x80D8", "0x00D8"]],
[52840, "particle_xenon", "particle_xenon", "Particle", "Xenon", "PARTICLE_XENON", "0x239A", ["0x80DA", "0x00DA"]],
]
for b in thirdparty_boards_list:

View file

@ -2,12 +2,6 @@ import os
import urllib.request
from multiprocessing import Pool
# Get all variants
all_variant = []
for entry in os.scandir("variants"):
if entry.is_dir():
all_variant.append(entry.name)
all_variant.sort()
# Detect version in platform.txt
version = ''
@ -24,7 +18,7 @@ print(f'version {version}')
def get_sd(name):
if '52832' in name:
return 's132_6.1.1'
elif '52833' in name:
elif '52833' in name or name == 'pca10100':
return 's140_7.3.0'
else:
# most of the board is 52840
@ -58,6 +52,14 @@ def download_variant(variant):
print(f"Downloading {f_uf2}")
urllib.request.urlretrieve(url_prefix + f_uf2, f'bootloader/{variant}/{f_uf2}')
if __name__ == "__main__":
# Get all variants
all_variant = []
for entry in os.scandir("variants"):
if entry.is_dir():
all_variant.append(entry.name)
all_variant.sort()
with Pool() as p:
p.map(download_variant, all_variant)

View file

@ -0,0 +1,55 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "variant.h"
#include "wiring_constants.h"
#include "wiring_digital.h"
#include "nrf.h"
const uint32_t g_ADigitalPinMap[] =
{
// P0
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ,
8 , 9 , 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
// P1
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47
};
void initVariant()
{
// init all 4 onboard LEDs
pinMode(PIN_LED1, OUTPUT);
ledOff(PIN_LED1);
pinMode(PIN_LED2, OUTPUT);
ledOff(PIN_LED2);
pinMode(PIN_LED3, OUTPUT);
ledOff(PIN_LED3);
pinMode(PIN_LED4, OUTPUT);
ledOff(PIN_LED4);
}

150
variants/pca10100/variant.h Normal file
View file

@ -0,0 +1,150 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef VARIANT_PCA10100_
#define VARIANT_PCA10100_
/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
#define USE_LFXO // Board uses 32khz crystal for LF
// define USE_LFRC // Board uses RC for LF
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "WVariant.h"
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
// Number of pins defined in PinDescription array
#define PINS_COUNT (48)
#define NUM_DIGITAL_PINS (48)
#define NUM_ANALOG_INPUTS (6)
#define NUM_ANALOG_OUTPUTS (0)
// LEDs
#define PIN_LED1 (13)
#define PIN_LED2 (14)
#define PIN_LED3 (15)
#define PIN_LED4 (16)
#define LED_BUILTIN PIN_LED1
#define LED_CONN PIN_LED2
#define LED_RED PIN_LED1
#define LED_BLUE PIN_LED2
#define LED_STATE_ON 0 // State when LED is litted
/*
* Buttons
*/
#define PIN_BUTTON1 11
#define PIN_BUTTON2 12
#define PIN_BUTTON3 24
#define PIN_BUTTON4 25
/*
* Analog pins
*/
#define PIN_A0 (3)
#define PIN_A1 (4)
#define PIN_A2 (28)
#define PIN_A3 (29)
#define PIN_A4 (30)
#define PIN_A5 (31)
#define PIN_A6 (0xff)
#define PIN_A7 (0xff)
static const uint8_t A0 = PIN_A0 ;
static const uint8_t A1 = PIN_A1 ;
static const uint8_t A2 = PIN_A2 ;
static const uint8_t A3 = PIN_A3 ;
static const uint8_t A4 = PIN_A4 ;
static const uint8_t A5 = PIN_A5 ;
static const uint8_t A6 = PIN_A6 ;
static const uint8_t A7 = PIN_A7 ;
#define ADC_RESOLUTION 14
// Other pins
#define PIN_AREF (2)
#define PIN_NFC1 (9)
#define PIN_NFC2 (10)
static const uint8_t AREF = PIN_AREF;
/*
* Serial interfaces
*/
// Arduino Header D0, D1
#define PIN_SERIAL1_RX (33) // P1.01
#define PIN_SERIAL1_TX (34) // P1.02
// Connected to Jlink CDC
#define PIN_SERIAL2_RX (8)
#define PIN_SERIAL2_TX (6)
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MISO (46)
#define PIN_SPI_MOSI (45)
#define PIN_SPI_SCK (47)
static const uint8_t SS = 44 ;
static const uint8_t MOSI = PIN_SPI_MOSI ;
static const uint8_t MISO = PIN_SPI_MISO ;
static const uint8_t SCK = PIN_SPI_SCK ;
/*
* Wire Interfaces
*/
#define WIRE_INTERFACES_COUNT 1
#define PIN_WIRE_SDA (26)
#define PIN_WIRE_SCL (27)
// QSPI Pins
#define PIN_QSPI_SCK 19
#define PIN_QSPI_CS 17
#define PIN_QSPI_IO0 20
#define PIN_QSPI_IO1 21
#define PIN_QSPI_IO2 22
#define PIN_QSPI_IO3 23
// On-board QSPI Flash
#define EXTERNAL_FLASH_DEVICES MX25R6435F
#define EXTERNAL_FLASH_USE_QSPI
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif