diff --git a/Makefile b/Makefile index c91b499eda..0d2e3c9797 100644 --- a/Makefile +++ b/Makefile @@ -256,6 +256,12 @@ smoketest: @$(MD5SUM) test.hex $(TINYGO) build -size short -o test.hex -target=pyportal examples/blinky1 @$(MD5SUM) test.hex + $(TINYGO) build -size short -o test.hex -target=particle-argon examples/blinky1 + @$(MD5SUM) test.hex + $(TINYGO) build -size short -o test.hex -target=particle-boron examples/blinky1 + @$(MD5SUM) test.hex + $(TINYGO) build -size short -o test.hex -target=particle-xenon examples/blinky1 + @$(MD5SUM) test.hex $(TINYGO) build -size short -o test.hex -target=nucleo-f103rb examples/blinky1 @$(MD5SUM) test.hex $(TINYGO) build -size short -o test.hex -target=pinetime-devkit0 examples/blinky1 diff --git a/README.md b/README.md index c5f998dccf..b1c55822d0 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,9 @@ The following 28 microcontroller boards are currently supported: * [Nordic Semiconductor PCA10031](https://www.nordicsemi.com/eng/Products/nRF51-Dongle) * [Nordic Semiconductor PCA10040](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF52-DK) * [Nordic Semiconductor PCA10056](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) +* [Particle Argon](https://docs.particle.io/datasheets/wi-fi/argon-datasheet/) +* [Particle Boron](https://docs.particle.io/datasheets/cellular/boron-datasheet/) +* [Particle Xenon](https://docs.particle.io/datasheets/discontinued/xenon-datasheet/) * [Phytec reel board](https://www.phytec.eu/product-eu/internet-of-things/reelboard/) * [PineTime DevKit](https://www.pine64.org/pinetime/) * [SiFIve HiFive1](https://www.sifive.com/boards/hifive1) diff --git a/src/machine/board_particle_argon.go b/src/machine/board_particle_argon.go new file mode 100644 index 0000000000..e0bee8c7b2 --- /dev/null +++ b/src/machine/board_particle_argon.go @@ -0,0 +1,96 @@ +// +build particle_argon + +package machine + +const HasLowFrequencyCrystal = true + +// More info: https://docs.particle.io/datasheets/wi-fi/argon-datasheet/ +// Board diagram: https://docs.particle.io/assets/images/argon/argon-block-diagram.png + +// LEDs +const ( + LED Pin = 44 + LED_GREEN Pin = 14 + LED_RED Pin = 13 + LED_BLUE Pin = 15 +) + +// GPIOs +const ( + A0 Pin = 3 + A1 Pin = 4 + A2 Pin = 28 + A3 Pin = 29 + A4 Pin = 30 + A5 Pin = 31 + D0 Pin = 26 // Also SDA + D1 Pin = 27 // Also SCL + D2 Pin = 33 + D3 Pin = 34 + D4 Pin = 40 + D5 Pin = 42 + D6 Pin = 43 + D7 Pin = 44 // Also LED + D8 Pin = 35 + D9 Pin = 6 // Also TX + D10 Pin = 8 // Also RX + D11 Pin = 46 // Also MISO + D12 Pin = 45 // Also MOSI + D13 Pin = 47 // Also SCK +) + +// UART +var ( + Serial = USB + UART0 = NRF_UART0 +) + +const ( + UART_TX_PIN Pin = 6 + UART_RX_PIN Pin = 8 +) + +// I2C pins +const ( + SDA_PIN Pin = 26 + SCL_PIN Pin = 27 +) + +// SPI pins +const ( + SPI0_SCK_PIN Pin = 47 + SPI0_MOSI_PIN Pin = 45 + SPI0_MISO_PIN Pin = 46 +) + +// Internal 4MB SPI Flash +const ( + SPI1_SCK_PIN Pin = 19 + SPI1_MOSI_PIN Pin = 20 + SPI1_MISO_PIN Pin = 21 + SPI1_CS_PIN Pin = 17 + SPI1_WP_PIN Pin = 22 + SPI1_HOLD_PIN Pin = 23 +) + +// ESP32 coprocessor +const ( + ESP32_TXD_PIN Pin = 36 + ESP32_RXD_PIN Pin = 37 + ESP32_CTS_PIN Pin = 39 + ESP32_RTS_PIN Pin = 38 + ESP32_BOOT_MODE_PIN Pin = 16 + ESP32_WIFI_EN_PIN Pin = 24 + ESP32_HOST_WK_PIN Pin = 7 +) + +// Other peripherals +const ( + MODE_BUTTON_PIN Pin = 11 + CHARGE_STATUS_PIN Pin = 41 + LIPO_VOLTAGE_PIN Pin = 5 + PCB_ANTENNA_PIN Pin = 2 + EXTERNAL_UFL_PIN Pin = 25 + NFC1_PIN Pin = 9 + NFC2_PIN Pin = 10 +) diff --git a/src/machine/board_particle_boron.go b/src/machine/board_particle_boron.go new file mode 100644 index 0000000000..9705829407 --- /dev/null +++ b/src/machine/board_particle_boron.go @@ -0,0 +1,99 @@ +// +build particle_boron + +package machine + +const HasLowFrequencyCrystal = true + +// More info: https://docs.particle.io/datasheets/cellular/boron-datasheet/ +// Board diagram: https://docs.particle.io/assets/images/boron/boron-block-diagram.png + +// LEDs +const ( + LED Pin = 44 + LED_GREEN Pin = 14 + LED_RED Pin = 13 + LED_BLUE Pin = 15 +) + +// GPIOs +const ( + A0 Pin = 3 + A1 Pin = 4 + A2 Pin = 28 + A3 Pin = 29 + A4 Pin = 30 + A5 Pin = 31 + D0 Pin = 26 // Also SDA + D1 Pin = 27 // Also SCL + D2 Pin = 33 + D3 Pin = 34 + D4 Pin = 40 + D5 Pin = 42 + D6 Pin = 43 + D7 Pin = 44 // Also LED + D8 Pin = 35 + D9 Pin = 6 // Also TX + D10 Pin = 8 // Also RX + D11 Pin = 46 // Also MISO + D12 Pin = 45 // Also MOSI + D13 Pin = 47 // Also SCK +) + +// UART +var ( + Serial = USB + UART0 = NRF_UART0 +) + +const ( + UART_TX_PIN Pin = 6 + UART_RX_PIN Pin = 8 +) + +// I2C pins +const ( + SDA_PIN Pin = 26 + SCL_PIN Pin = 27 + + // Internal I2C with MAX17043 (Fuel gauge) and BQ24195 (Power management) chips on it + SDA1_PIN Pin = 24 + SCL1_PIN Pin = 41 + INT1_PIN Pin = 5 +) + +// SPI pins +const ( + SPI0_SCK_PIN Pin = 47 + SPI0_MOSI_PIN Pin = 45 + SPI0_MISO_PIN Pin = 46 +) + +// Internal 4MB SPI Flash +const ( + SPI1_SCK_PIN Pin = 19 + SPI1_MOSI_PIN Pin = 20 + SPI1_MISO_PIN Pin = 21 + SPI1_CS_PIN Pin = 17 + SPI1_WP_PIN Pin = 22 + SPI1_HOLD_PIN Pin = 23 +) + +// u-blox SARA coprocessor +const ( + SARA_TXD_PIN Pin = 37 + SARA_RXD_PIN Pin = 36 + SARA_CTS_PIN Pin = 38 + SARA_RTS_PIN Pin = 39 + SARA_RESET_PIN Pin = 12 + SARA_POWER_ON_PIN Pin = 16 + SARA_BUFF_EN_PIN Pin = 25 + SARA_VINT_PIN Pin = 2 +) + +// Other peripherals +const ( + MODE_BUTTON_PIN Pin = 11 + ANTENNA_SEL_PIN Pin = 7 // Low: chip antenna, High: External uFL + NFC1_PIN Pin = 9 + NFC2_PIN Pin = 10 +) diff --git a/src/machine/board_particle_xenon.go b/src/machine/board_particle_xenon.go new file mode 100644 index 0000000000..ffdc663244 --- /dev/null +++ b/src/machine/board_particle_xenon.go @@ -0,0 +1,85 @@ +// +build particle_xenon + +package machine + +const HasLowFrequencyCrystal = true + +// More info: https://docs.particle.io/datasheets/discontinued/xenon-datasheet/ +// Board diagram: https://docs.particle.io/assets/images/xenon/xenon-block-diagram.png + +// LEDs +const ( + LED Pin = 44 + LED_GREEN Pin = 14 + LED_RED Pin = 13 + LED_BLUE Pin = 15 +) + +// GPIOs +const ( + A0 Pin = 3 + A1 Pin = 4 + A2 Pin = 28 + A3 Pin = 29 + A4 Pin = 30 + A5 Pin = 31 + D0 Pin = 26 // Also SDA + D1 Pin = 27 // Also SCL + D2 Pin = 33 + D3 Pin = 34 + D4 Pin = 40 + D5 Pin = 42 + D6 Pin = 43 + D7 Pin = 44 // Also LED + D8 Pin = 35 + D9 Pin = 6 // Also TX + D10 Pin = 8 // Also RX + D11 Pin = 46 // Also MISO + D12 Pin = 45 // Also MOSI + D13 Pin = 47 // Also SCK +) + +// UART +var ( + Serial = USB + UART0 = NRF_UART0 +) + +const ( + UART_TX_PIN Pin = 6 + UART_RX_PIN Pin = 8 +) + +// I2C pins +const ( + SDA_PIN Pin = 26 + SCL_PIN Pin = 27 +) + +// SPI pins +const ( + SPI0_SCK_PIN Pin = 47 + SPI0_MOSI_PIN Pin = 45 + SPI0_MISO_PIN Pin = 46 +) + +// Internal 4MB SPI Flash +const ( + SPI1_SCK_PIN Pin = 19 + SPI1_MOSI_PIN Pin = 20 + SPI1_MISO_PIN Pin = 21 + SPI1_CS_PIN Pin = 17 + SPI1_WP_PIN Pin = 22 + SPI1_HOLD_PIN Pin = 23 +) + +// Other peripherals +const ( + MODE_BUTTON_PIN Pin = 11 + CHARGE_STATUS_PIN Pin = 41 + LIPO_VOLTAGE_PIN Pin = 5 + PCB_ANTENNA_PIN Pin = 24 + EXTERNAL_UFL_PIN Pin = 25 + NFC1_PIN Pin = 9 + NFC2_PIN Pin = 10 +) diff --git a/src/machine/machine_nrf.go b/src/machine/machine_nrf.go index a5ecb0e98a..663bf02405 100644 --- a/src/machine/machine_nrf.go +++ b/src/machine/machine_nrf.go @@ -79,8 +79,13 @@ func (uart UART) Configure(config UARTConfig) { uart.SetBaudRate(config.BaudRate) - // Set TX and RX pins from board. - uart.setPins(UART_TX_PIN, UART_RX_PIN) + // Set TX and RX pins + if config.TX == 0 && config.RX == 0 { + // Use default pins + uart.setPins(UART_TX_PIN, UART_RX_PIN) + } else { + uart.setPins(config.TX, config.RX) + } nrf.UART0.ENABLE.Set(nrf.UART_ENABLE_ENABLE_Enabled) nrf.UART0.TASKS_STARTTX.Set(1) diff --git a/targets/particle-3rd-gen.json b/targets/particle-3rd-gen.json new file mode 100644 index 0000000000..2229319e79 --- /dev/null +++ b/targets/particle-3rd-gen.json @@ -0,0 +1,6 @@ +{ + "inherits": ["nrf52840"], + "build-tags": ["particle_3rd_gen"], + "flash-method": "openocd", + "openocd-interface": "cmsis-dap" +} diff --git a/targets/particle-argon.json b/targets/particle-argon.json new file mode 100644 index 0000000000..a23233bb23 --- /dev/null +++ b/targets/particle-argon.json @@ -0,0 +1,4 @@ +{ + "inherits": ["particle-3rd-gen"], + "build-tags": ["particle_argon"] +} diff --git a/targets/particle-boron.json b/targets/particle-boron.json new file mode 100644 index 0000000000..2b737393e0 --- /dev/null +++ b/targets/particle-boron.json @@ -0,0 +1,4 @@ +{ + "inherits": ["particle-3rd-gen"], + "build-tags": ["particle_boron"] +} diff --git a/targets/particle-xenon.json b/targets/particle-xenon.json new file mode 100644 index 0000000000..d93425d778 --- /dev/null +++ b/targets/particle-xenon.json @@ -0,0 +1,4 @@ +{ + "inherits": ["particle-3rd-gen"], + "build-tags": ["particle_xenon"] +}