summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/esp32/boards/UM_NANOS3/board.json25
-rw-r--r--ports/esp32/boards/UM_NANOS3/board.md1
-rw-r--r--ports/esp32/boards/UM_NANOS3/deploy.md52
-rw-r--r--ports/esp32/boards/UM_NANOS3/manifest.py2
-rw-r--r--ports/esp32/boards/UM_NANOS3/modules/nanos3.py46
-rw-r--r--ports/esp32/boards/UM_NANOS3/mpconfigboard.cmake12
-rw-r--r--ports/esp32/boards/UM_NANOS3/mpconfigboard.h12
-rw-r--r--ports/esp32/boards/UM_NANOS3/pins.csv10
-rw-r--r--ports/esp32/boards/UM_NANOS3/sdkconfig.board19
9 files changed, 179 insertions, 0 deletions
diff --git a/ports/esp32/boards/UM_NANOS3/board.json b/ports/esp32/boards/UM_NANOS3/board.json
new file mode 100644
index 000000000..2eb40ac3c
--- /dev/null
+++ b/ports/esp32/boards/UM_NANOS3/board.json
@@ -0,0 +1,25 @@
+{
+ "deploy": [
+ "deploy.md"
+ ],
+ "docs": "",
+ "features": [
+ "Battery Charging",
+ "RGB LED",
+ "SPIRAM",
+ "WiFi",
+ "BLE"
+ ],
+ "features_non_filterable": [
+ "TinyPICO Nano Compatible"
+ ],
+ "id": "nanos3",
+ "images": [
+ "unexpectedmaker_nanos3.jpg"
+ ],
+ "mcu": "esp32s3",
+ "product": "NanoS3",
+ "thumbnail": "",
+ "url": "https://nanos3.io",
+ "vendor": "Unexpected Maker"
+}
diff --git a/ports/esp32/boards/UM_NANOS3/board.md b/ports/esp32/boards/UM_NANOS3/board.md
new file mode 100644
index 000000000..9cb5310f6
--- /dev/null
+++ b/ports/esp32/boards/UM_NANOS3/board.md
@@ -0,0 +1 @@
+The following files are firmware for the NanoS3.
diff --git a/ports/esp32/boards/UM_NANOS3/deploy.md b/ports/esp32/boards/UM_NANOS3/deploy.md
new file mode 100644
index 000000000..725cff494
--- /dev/null
+++ b/ports/esp32/boards/UM_NANOS3/deploy.md
@@ -0,0 +1,52 @@
+Program your board using the latest version of the esptool.py program, found [here](https://github.com/espressif/esptool).
+
+To flash or erase your NanoS3, you have to first put it into download mode.
+To do this, follow these steps:
+
+- Press and hold the [BOOT] button
+- Press and release the [RESET] button
+- Release the [BOOT] button
+
+Now the board is in download mode and the native USB will have enumerated as a serial device.
+
+If you are putting MicroPython on your board for the first time then you should
+first erase the entire flash using:
+
+### Linux
+```bash
+esptool.py --chip esp32s3 --port /dev/ttyACM0 erase_flash
+```
+
+### Mac
+Please do a `ls /dev/cu.usbm*` to determine the port your board has enumerated as.
+```bash
+esptool.py --chip esp32s3 --port /dev/cu.usbmodem01 erase_flash
+```
+
+### Windows
+Change (X) to whatever COM port is being used by the board
+```bash
+esptool --chip esp32s3 --port COM(X) erase_flash
+```
+
+Now download the version of the firmware you would like to install from the options below,
+then use the following command to program the firmware starting at address 0x0,
+remembering to replace `nanos3-micropython-firmware-version.bin` with the name of
+the firmware you just downloaded:
+
+### Linux
+```bash
+esptool.py --chip esp32s3 --port /dev/ttyACM0 write_flash -z 0x0 nanos3-micropython-firmware-version.bin
+```
+
+### Mac
+Please do a `ls /dev/cu.usbm*` to determine the port your board has enumerated as.
+```bash
+esptool.py --chip esp32s3 --port /dev/cu.usbmodem01 write_flash -z 0x0 nanos3-micropython-firmware-version.bin
+```
+
+### Windows
+Change (X) to whatever COM port is being used by the board
+```bash
+esptool --chip esp32s3 --port COM(X) write_flash -z 0x0 nanos3-micropython-firmware-version.bin
+```
diff --git a/ports/esp32/boards/UM_NANOS3/manifest.py b/ports/esp32/boards/UM_NANOS3/manifest.py
new file mode 100644
index 000000000..7ae2ed15d
--- /dev/null
+++ b/ports/esp32/boards/UM_NANOS3/manifest.py
@@ -0,0 +1,2 @@
+include("$(PORT_DIR)/boards/manifest.py")
+freeze("modules")
diff --git a/ports/esp32/boards/UM_NANOS3/modules/nanos3.py b/ports/esp32/boards/UM_NANOS3/modules/nanos3.py
new file mode 100644
index 000000000..b3d57f121
--- /dev/null
+++ b/ports/esp32/boards/UM_NANOS3/modules/nanos3.py
@@ -0,0 +1,46 @@
+# NanoS3 Helper Library
+# MIT license; Copyright (c) 2023 Seon Rozenblum - Unexpected Maker
+#
+# Project home:
+# https://nanos3.io
+
+# Import required libraries
+from micropython import const
+from machine import Pin, ADC
+import time
+
+# TinyS3 Hardware Pin Assignments
+
+# RGB LED Pins
+RGB_DATA = const(41)
+RGB_PWR = const(42)
+
+# SPI
+SPI_MOSI = const(35)
+SPI_MISO = const(37)
+SPI_CLK = const(36)
+
+# I2C
+I2C_SDA = const(8)
+I2C_SCL = const(9)
+
+
+# Helper functions
+def set_pixel_power(state):
+ """Enable or Disable power to the onboard NeoPixel to either show colour, or to reduce power for deep sleep."""
+ Pin(RGB_PWR, Pin.OUT).value(state)
+
+
+# NeoPixel rainbow colour wheel
+def rgb_color_wheel(wheel_pos):
+ """Color wheel to allow for cycling through the rainbow of RGB colors."""
+ wheel_pos = wheel_pos % 255
+
+ if wheel_pos < 85:
+ return 255 - wheel_pos * 3, 0, wheel_pos * 3
+ elif wheel_pos < 170:
+ wheel_pos -= 85
+ return 0, wheel_pos * 3, 255 - wheel_pos * 3
+ else:
+ wheel_pos -= 170
+ return wheel_pos * 3, 255 - wheel_pos * 3, 0
diff --git a/ports/esp32/boards/UM_NANOS3/mpconfigboard.cmake b/ports/esp32/boards/UM_NANOS3/mpconfigboard.cmake
new file mode 100644
index 000000000..6c7f34009
--- /dev/null
+++ b/ports/esp32/boards/UM_NANOS3/mpconfigboard.cmake
@@ -0,0 +1,12 @@
+set(IDF_TARGET esp32s3)
+
+set(SDKCONFIG_DEFAULTS
+ boards/sdkconfig.base
+ boards/sdkconfig.usb
+ boards/sdkconfig.ble
+ boards/sdkconfig.240mhz
+ boards/sdkconfig.spiram_sx
+ boards/UM_TINYS3/sdkconfig.board
+)
+
+set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
diff --git a/ports/esp32/boards/UM_NANOS3/mpconfigboard.h b/ports/esp32/boards/UM_NANOS3/mpconfigboard.h
new file mode 100644
index 000000000..1c2782bfb
--- /dev/null
+++ b/ports/esp32/boards/UM_NANOS3/mpconfigboard.h
@@ -0,0 +1,12 @@
+#define MICROPY_HW_BOARD_NAME "NanoS3"
+#define MICROPY_HW_MCU_NAME "ESP32-S3-FN8"
+#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "NanoS3"
+
+#define MICROPY_PY_MACHINE_DAC (0)
+
+#define MICROPY_HW_I2C0_SCL (9)
+#define MICROPY_HW_I2C0_SDA (8)
+
+#define MICROPY_HW_SPI1_MOSI (35)
+#define MICROPY_HW_SPI1_MISO (37)
+#define MICROPY_HW_SPI1_SCK (36)
diff --git a/ports/esp32/boards/UM_NANOS3/pins.csv b/ports/esp32/boards/UM_NANOS3/pins.csv
new file mode 100644
index 000000000..44880f82b
--- /dev/null
+++ b/ports/esp32/boards/UM_NANOS3/pins.csv
@@ -0,0 +1,10 @@
+I2C_SCL,GPIO8
+I2C_SDA,GPIO9
+SPI_SS,GPIO34
+SPI_MOSI,GPIO35
+SPI_SCK,GPIO36
+SPI_MISO,GPIO37
+RGB_DATA,GPIO41
+RGB_PWR,GPIO42
+UART0_TX,GPIO43
+UART0_RX,GPIO44
diff --git a/ports/esp32/boards/UM_NANOS3/sdkconfig.board b/ports/esp32/boards/UM_NANOS3/sdkconfig.board
new file mode 100644
index 000000000..969bbc5be
--- /dev/null
+++ b/ports/esp32/boards/UM_NANOS3/sdkconfig.board
@@ -0,0 +1,19 @@
+CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
+CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
+CONFIG_ESPTOOLPY_AFTER_NORESET=y
+
+CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
+CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
+CONFIG_ESPTOOLPY_FLASHSIZE_16MB=
+CONFIG_SPIRAM_MEMTEST=
+CONFIG_PARTITION_TABLE_CUSTOM=y
+CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8MiB.csv"
+
+CONFIG_LWIP_LOCAL_HOSTNAME="UMNanoS3"
+
+CONFIG_TINYUSB_DESC_CUSTOM_VID=0x303A
+CONFIG_TINYUSB_DESC_CUSTOM_PID=0x817A
+CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100
+CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Unexpected Maker"
+CONFIG_TINYUSB_DESC_PRODUCT_STRING="NanoS3"
+CONFIG_TINYUSB_DESC_SERIAL_STRING="_ns3_"