Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add senseBox MCU-S2 with ESP32S2 #8891

Merged
merged 9 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28335,3 +28335,174 @@ atd147_s3.menu.EraseFlash.all=Enabled
atd147_s3.menu.EraseFlash.all.upload.erase_cmd=-e

##############################################################
# senseBox MCU ESP32-S2

sensebox_mcu_esp32s2.name=senseBox MCU-S2 ESP32-S2
sensebox_mcu_esp32s2.vid.0=0x303A
sensebox_mcu_esp32s2.pid.0=0x81B8
sensebox_mcu_esp32s2.vid.1=0x303A
sensebox_mcu_esp32s2.pid.1=0x81B9
sensebox_mcu_esp32s2.vid.2=0x303A
sensebox_mcu_esp32s2.pid.2=0x81BA

sensebox_mcu_esp32s2.bootloader.tool=esptool_py
sensebox_mcu_esp32s2.bootloader.tool.default=esptool_py

sensebox_mcu_esp32s2.upload.tool=esptool_py
sensebox_mcu_esp32s2.upload.tool.default=esptool_py
sensebox_mcu_esp32s2.upload.tool.network=esp_ota

sensebox_mcu_esp32s2.upload.maximum_size=1310720
sensebox_mcu_esp32s2.upload.maximum_data_size=327680
sensebox_mcu_esp32s2.upload.flags=
sensebox_mcu_esp32s2.upload.extra_flags=
sensebox_mcu_esp32s2.upload.use_1200bps_touch=true
sensebox_mcu_esp32s2.upload.wait_for_upload_port=true

sensebox_mcu_esp32s2.serial.disableDTR=false
sensebox_mcu_esp32s2.serial.disableRTS=false

sensebox_mcu_esp32s2.build.tarch=xtensa
sensebox_mcu_esp32s2.build.bootloader_addr=0x1000
sensebox_mcu_esp32s2.build.target=esp32s2
sensebox_mcu_esp32s2.build.mcu=esp32s2
sensebox_mcu_esp32s2.build.core=esp32
sensebox_mcu_esp32s2.build.variant=sensebox_mcu_esp32s2
sensebox_mcu_esp32s2.build.board=SENSEBOX_MCU_ESP32S2

sensebox_mcu_esp32s2.build.cdc_on_boot=1
sensebox_mcu_esp32s2.build.msc_on_boot=1
sensebox_mcu_esp32s2.build.dfu_on_boot=0
sensebox_mcu_esp32s2.build.f_cpu=240000000L
sensebox_mcu_esp32s2.build.flash_size=4MB
sensebox_mcu_esp32s2.build.flash_freq=80m
sensebox_mcu_esp32s2.build.flash_mode=dio
sensebox_mcu_esp32s2.build.boot=qio
sensebox_mcu_esp32s2.build.partitions=default
sensebox_mcu_esp32s2.build.defines=

sensebox_mcu_esp32s2.menu.CDCOnBoot.cdc=Enabled
sensebox_mcu_esp32s2.menu.CDCOnBoot.cdc.build.cdc_on_boot=1
sensebox_mcu_esp32s2.menu.CDCOnBoot.default=Disabled
sensebox_mcu_esp32s2.menu.CDCOnBoot.default.build.cdc_on_boot=0

sensebox_mcu_esp32s2.menu.MSCOnBoot.msc=Enabled
sensebox_mcu_esp32s2.menu.MSCOnBoot.msc.build.msc_on_boot=1
sensebox_mcu_esp32s2.menu.MSCOnBoot.default=Disabled
sensebox_mcu_esp32s2.menu.MSCOnBoot.default.build.msc_on_boot=0

sensebox_mcu_esp32s2.menu.DFUOnBoot.default=Disabled
sensebox_mcu_esp32s2.menu.DFUOnBoot.default.build.dfu_on_boot=0
sensebox_mcu_esp32s2.menu.DFUOnBoot.dfu=Enabled
sensebox_mcu_esp32s2.menu.DFUOnBoot.dfu.build.dfu_on_boot=1

sensebox_mcu_esp32s2.menu.UploadMode.cdc=Internal USB
sensebox_mcu_esp32s2.menu.UploadMode.cdc.upload.use_1200bps_touch=true
sensebox_mcu_esp32s2.menu.UploadMode.cdc.upload.wait_for_upload_port=true
sensebox_mcu_esp32s2.menu.UploadMode.default=UART0
sensebox_mcu_esp32s2.menu.UploadMode.default.upload.use_1200bps_touch=false
sensebox_mcu_esp32s2.menu.UploadMode.default.upload.wait_for_upload_port=false

sensebox_mcu_esp32s2.menu.PSRAM.enabled=Enabled
sensebox_mcu_esp32s2.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM
sensebox_mcu_esp32s2.menu.PSRAM.disabled=Disabled
sensebox_mcu_esp32s2.menu.PSRAM.disabled.build.defines=

sensebox_mcu_esp32s2.menu.PartitionScheme.tinyuf2=TinyUF2 4MB (1.3MB APP/960KB FATFS)
sensebox_mcu_esp32s2.menu.PartitionScheme.tinyuf2.build.custom_bootloader=bootloader-tinyuf2
sensebox_mcu_esp32s2.menu.PartitionScheme.tinyuf2.build.custom_partitions=partitions-4MB-tinyuf2
sensebox_mcu_esp32s2.menu.PartitionScheme.tinyuf2.upload.maximum_size=1441792
sensebox_mcu_esp32s2.menu.PartitionScheme.tinyuf2.upload.extra_flags=0x2d0000 "{runtime.platform.path}/variants/{build.variant}/tinyuf2.bin"
sensebox_mcu_esp32s2.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
sensebox_mcu_esp32s2.menu.PartitionScheme.default.build.partitions=default
sensebox_mcu_esp32s2.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
sensebox_mcu_esp32s2.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
sensebox_mcu_esp32s2.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
sensebox_mcu_esp32s2.menu.PartitionScheme.minimal.build.partitions=minimal
sensebox_mcu_esp32s2.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
sensebox_mcu_esp32s2.menu.PartitionScheme.no_ota.build.partitions=no_ota
sensebox_mcu_esp32s2.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
sensebox_mcu_esp32s2.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
sensebox_mcu_esp32s2.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
sensebox_mcu_esp32s2.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
sensebox_mcu_esp32s2.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
sensebox_mcu_esp32s2.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
sensebox_mcu_esp32s2.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
sensebox_mcu_esp32s2.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
sensebox_mcu_esp32s2.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
sensebox_mcu_esp32s2.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
sensebox_mcu_esp32s2.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
sensebox_mcu_esp32s2.menu.PartitionScheme.huge_app.build.partitions=huge_app
sensebox_mcu_esp32s2.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
sensebox_mcu_esp32s2.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
sensebox_mcu_esp32s2.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
sensebox_mcu_esp32s2.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080

sensebox_mcu_esp32s2.menu.CPUFreq.240=240MHz (WiFi)
sensebox_mcu_esp32s2.menu.CPUFreq.240.build.f_cpu=240000000L
sensebox_mcu_esp32s2.menu.CPUFreq.160=160MHz (WiFi)
sensebox_mcu_esp32s2.menu.CPUFreq.160.build.f_cpu=160000000L
sensebox_mcu_esp32s2.menu.CPUFreq.80=80MHz (WiFi)
sensebox_mcu_esp32s2.menu.CPUFreq.80.build.f_cpu=80000000L
sensebox_mcu_esp32s2.menu.CPUFreq.40=40MHz
sensebox_mcu_esp32s2.menu.CPUFreq.40.build.f_cpu=40000000L
sensebox_mcu_esp32s2.menu.CPUFreq.20=20MHz
sensebox_mcu_esp32s2.menu.CPUFreq.20.build.f_cpu=20000000L
sensebox_mcu_esp32s2.menu.CPUFreq.10=10MHz
sensebox_mcu_esp32s2.menu.CPUFreq.10.build.f_cpu=10000000L

sensebox_mcu_esp32s2.menu.FlashMode.qio=QIO
sensebox_mcu_esp32s2.menu.FlashMode.qio.build.flash_mode=dio
sensebox_mcu_esp32s2.menu.FlashMode.qio.build.boot=qio
sensebox_mcu_esp32s2.menu.FlashMode.dio=DIO
sensebox_mcu_esp32s2.menu.FlashMode.dio.build.flash_mode=dio
sensebox_mcu_esp32s2.menu.FlashMode.dio.build.boot=dio
sensebox_mcu_esp32s2.menu.FlashMode.qout=QOUT
sensebox_mcu_esp32s2.menu.FlashMode.qout.build.flash_mode=dout
sensebox_mcu_esp32s2.menu.FlashMode.qout.build.boot=qout
sensebox_mcu_esp32s2.menu.FlashMode.dout=DOUT
sensebox_mcu_esp32s2.menu.FlashMode.dout.build.flash_mode=dout
sensebox_mcu_esp32s2.menu.FlashMode.dout.build.boot=dout

sensebox_mcu_esp32s2.menu.FlashFreq.80=80MHz
sensebox_mcu_esp32s2.menu.FlashFreq.80.build.flash_freq=80m
sensebox_mcu_esp32s2.menu.FlashFreq.40=40MHz
sensebox_mcu_esp32s2.menu.FlashFreq.40.build.flash_freq=40m

sensebox_mcu_esp32s2.menu.FlashSize.4M=4MB (32Mb)
sensebox_mcu_esp32s2.menu.FlashSize.4M.build.flash_size=4MB

sensebox_mcu_esp32s2.menu.UploadSpeed.921600=921600
sensebox_mcu_esp32s2.menu.UploadSpeed.921600.upload.speed=921600
sensebox_mcu_esp32s2.menu.UploadSpeed.115200=115200
sensebox_mcu_esp32s2.menu.UploadSpeed.115200.upload.speed=115200
sensebox_mcu_esp32s2.menu.UploadSpeed.256000.windows=256000
sensebox_mcu_esp32s2.menu.UploadSpeed.256000.upload.speed=256000
sensebox_mcu_esp32s2.menu.UploadSpeed.230400.windows.upload.speed=256000
sensebox_mcu_esp32s2.menu.UploadSpeed.230400=230400
sensebox_mcu_esp32s2.menu.UploadSpeed.230400.upload.speed=230400
sensebox_mcu_esp32s2.menu.UploadSpeed.460800.linux=460800
sensebox_mcu_esp32s2.menu.UploadSpeed.460800.macosx=460800
sensebox_mcu_esp32s2.menu.UploadSpeed.460800.upload.speed=460800
sensebox_mcu_esp32s2.menu.UploadSpeed.512000.windows=512000
sensebox_mcu_esp32s2.menu.UploadSpeed.512000.upload.speed=512000

sensebox_mcu_esp32s2.menu.DebugLevel.none=None
sensebox_mcu_esp32s2.menu.DebugLevel.none.build.code_debug=0
sensebox_mcu_esp32s2.menu.DebugLevel.error=Error
sensebox_mcu_esp32s2.menu.DebugLevel.error.build.code_debug=1
sensebox_mcu_esp32s2.menu.DebugLevel.warn=Warn
sensebox_mcu_esp32s2.menu.DebugLevel.warn.build.code_debug=2
sensebox_mcu_esp32s2.menu.DebugLevel.info=Info
sensebox_mcu_esp32s2.menu.DebugLevel.info.build.code_debug=3
sensebox_mcu_esp32s2.menu.DebugLevel.debug=Debug
sensebox_mcu_esp32s2.menu.DebugLevel.debug.build.code_debug=4
sensebox_mcu_esp32s2.menu.DebugLevel.verbose=Verbose
sensebox_mcu_esp32s2.menu.DebugLevel.verbose.build.code_debug=5

sensebox_mcu_esp32s2.menu.EraseFlash.none=Disabled
sensebox_mcu_esp32s2.menu.EraseFlash.none.upload.erase_cmd=
sensebox_mcu_esp32s2.menu.EraseFlash.all=Enabled
sensebox_mcu_esp32s2.menu.EraseFlash.all.upload.erase_cmd=-e

##############################################################
mariopesch marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
12 changes: 12 additions & 0 deletions variants/sensebox_mcu_esp32s2/partitions-4MB-tinyuf2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
# bootloader.bin,, 0x1000, 32K
# partition table, 0x8000, 4K

nvs, data, nvs, 0x9000, 20K,
otadata, data, ota, 0xe000, 8K,
ota_0, 0, ota_0, 0x10000, 1408K,
ota_1, 0, ota_1, 0x170000, 1408K,
uf2, app, factory,0x2d0000, 256K,
ffat, data, fat, 0x310000, 960K,

135 changes: 135 additions & 0 deletions variants/sensebox_mcu_esp32s2/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>

#define USB_VID 0x303A
#define USB_PID 0x81B8
#define USB_MANUFACTURER "senseBox"
#define USB_PRODUCT "MCU-S2 ESP32S2"
#define USB_SERIAL "" // Empty string for MAC adddress

// Default USB FirmwareMSC Settings
#define USB_FW_MSC_VENDOR_ID "senseBox" // max 8 chars
#define USB_FW_MSC_PRODUCT_ID "MCU-S2 ESP32S2" // max 16 chars
#define USB_FW_MSC_PRODUCT_REVISION "1.00" // max 4 chars
#define USB_FW_MSC_VOLUME_NAME "senseBox" // max 11 chars
#define USB_FW_MSC_SERIAL_NUMBER 0x00000000

#define PIN_NEOPIXEL 1 // NeoPixel LED
#define NEOPIXEL_PIN 1 // NeoPixel LED
#define NEOPIXEL_NUM 1 // number of neopixels

// Default I2C QWIIC-Ports
static const uint8_t SDA = 39;
static const uint8_t SCL = 40;
#define PIN_QWIIC_SDA 39
#define PIN_QWIIC_SCL 40

// Secondary I2C MPU6050
#define WIRE1_PIN_DEFINED 1 // See Wire.cpp at bool TwoWire::initPins(int sdaPin, int sclPin)
static const uint8_t SCL1 = 42;
static const uint8_t SDA1 = 45;
#define PIN_I2C_SCL 42
#define PIN_I2C_SDA 45
#define PIN_I2C_INT 46

// SPI
static const uint8_t SS = 42;
static const uint8_t MOSI = 35;
static const uint8_t SCK = 36;
static const uint8_t MISO = 37;

// XBEE Pins
#define PIN_XBEE_ENABLE 41
#define PIN_XBEE_INT 33
#define PIN_XBEE_CS 34
#define PIN_XBEE_MOSI 35
#define PIN_XBEE_SCLK 36
#define PIN_XBEE_MISO 37
#define PIN_XBEE_RESET 38
#define PIN_XBEE_TXD 17
#define PIN_XBEE_RXD 18

// Alias XB1
#define PIN_XB1_ENABLE 41
#define PIN_XB1_INT 33
#define PIN_XB1_CS 34
#define PIN_XB1_MOSI 35
#define PIN_XB1_SCLK 36
#define PIN_XB1_MISO 37
#define PIN_XB1_RESET 38
#define PIN_XB1_TXD 17
#define PIN_XB1_RXD 18

// IO Pins
#define PIN_LED 1
#define PIN_IO2 2
#define PIN_IO3 3
#define PIN_IO4 4
#define PIN_IO5 5
#define PIN_IO6 6
#define PIN_IO7 7
#define IO_ENABLE 8

static const uint8_t A2 = PIN_IO2;
static const uint8_t A3 = PIN_IO3;
static const uint8_t A4 = PIN_IO4;
static const uint8_t A5 = PIN_IO5;
static const uint8_t A6 = PIN_IO6;
static const uint8_t A7 = PIN_IO7;

static const uint8_t D2 = PIN_IO2;
static const uint8_t D3 = PIN_IO3;
static const uint8_t D4 = PIN_IO4;
static const uint8_t D5 = PIN_IO5;
static const uint8_t D6 = PIN_IO6;
static const uint8_t D7 = PIN_IO7;

// UART Port
static const uint8_t TX = 43;
static const uint8_t RX = 44;
#define PIN_UART_TXD 43
#define PIN_UART_RXD 44
#define PIN_UART_ENABLE 26

// UART XBee
static const uint8_t TX1 = 17;
static const uint8_t RX1 = 18;

// PD-Sensor
#define PD_SENSE 14
#define PD_ENABLE 21
#define PIN_PD_ENABLE 21

// SD-Card
#define VSPI_MISO 13
#define VSPI_MOSI 11
#define VSPI_SCLK 12
#define VSPI_SS 10
#define SD_ENABLE 9

#define PIN_SD_ENABLE 9
#define PIN_SD_CS 10
#define PIN_SD_MOSI 11
#define PIN_SD_SCLK 12
#define PIN_SD_MISO 13

// USB
#define PIN_USB_DM 19
#define PIN_USB_DP 20

// Touch Pins
static const uint8_t T2 = PIN_IO2;
static const uint8_t T3 = PIN_IO3;
static const uint8_t T4 = PIN_IO4;
static const uint8_t T5 = PIN_IO5;
static const uint8_t T6 = PIN_IO6;
static const uint8_t T7 = PIN_IO7;


static const uint8_t DAC1 = 17;
static const uint8_t DAC2 = 18;


#endif /* Pins_Arduino_h */
Binary file added variants/sensebox_mcu_esp32s2/tinyuf2.bin
Binary file not shown.
56 changes: 56 additions & 0 deletions variants/sensebox_mcu_esp32s2/variant.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021 Ha Thach (tinyusb.org) 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 "esp32-hal-gpio.h"
#include "pins_arduino.h"

extern "C" {

// Initialize variant/board, called before setup()
void initVariant(void)
{
//enable IO Pins by default
pinMode(IO_ENABLE, OUTPUT);
digitalWrite(IO_ENABLE,LOW);

//reset RGB
pinMode(PIN_NEOPIXEL, OUTPUT);
digitalWrite(PIN_NEOPIXEL, LOW);

//enable XBEE by default
pinMode(PIN_XB1_ENABLE, OUTPUT);
digitalWrite(PIN_XB1_ENABLE, LOW);

//enable UART by default
pinMode(PIN_UART_ENABLE, OUTPUT);
digitalWrite(PIN_UART_ENABLE, LOW);

//enable PD-Sensor by default
pinMode(PD_ENABLE, OUTPUT);
analogReadResolution(12);
digitalWrite(PD_ENABLE, HIGH);

}
}