Browse Source

esp32/boards/UM_NANOS3: Add new UM NanoS3 board.

Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
pull/12160/head
Seon Rozenblum 1 year ago
committed by Damien George
parent
commit
6bd1404225
  1. 25
      ports/esp32/boards/UM_NANOS3/board.json
  2. 1
      ports/esp32/boards/UM_NANOS3/board.md
  3. 52
      ports/esp32/boards/UM_NANOS3/deploy.md
  4. 2
      ports/esp32/boards/UM_NANOS3/manifest.py
  5. 46
      ports/esp32/boards/UM_NANOS3/modules/nanos3.py
  6. 12
      ports/esp32/boards/UM_NANOS3/mpconfigboard.cmake
  7. 12
      ports/esp32/boards/UM_NANOS3/mpconfigboard.h
  8. 10
      ports/esp32/boards/UM_NANOS3/pins.csv
  9. 19
      ports/esp32/boards/UM_NANOS3/sdkconfig.board

25
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"
}

1
ports/esp32/boards/UM_NANOS3/board.md

@ -0,0 +1 @@
The following files are firmware for the NanoS3.

52
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
```

2
ports/esp32/boards/UM_NANOS3/manifest.py

@ -0,0 +1,2 @@
include("$(PORT_DIR)/boards/manifest.py")
freeze("modules")

46
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

12
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)

12
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)

10
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
1 I2C_SCL GPIO8
2 I2C_SDA GPIO9
3 SPI_SS GPIO34
4 SPI_MOSI GPIO35
5 SPI_SCK GPIO36
6 SPI_MISO GPIO37
7 RGB_DATA GPIO41
8 RGB_PWR GPIO42
9 UART0_TX GPIO43
10 UART0_RX GPIO44

19
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_"
Loading…
Cancel
Save