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

[BOARD] Adds Waveshare ESP32-S3-PICO #3081

Merged
merged 28 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2b196a8
Update architecture.h
markbirss Jan 11, 2024
6ad7007
Add files via upload
markbirss Jan 11, 2024
507aeb9
Add files via upload
markbirss Jan 11, 2024
8725fd3
Update EInkDisplay2.cpp
markbirss Jan 11, 2024
626a134
Update platformio.ini
markbirss Jan 11, 2024
292360f
Merge branch 'master' into master
thebentern Jan 11, 2024
971774f
Update architecture.h
markbirss Jan 11, 2024
cb783ce
Update EInkDisplay2.cpp
markbirss Jan 11, 2024
0252561
Update platformio.ini
markbirss Jan 11, 2024
405a05d
Update EInkDisplay2.cpp
markbirss Jan 11, 2024
8828500
Merge branch 'master' into master
markbirss Jan 11, 2024
f9a8581
Update platformio.ini
markbirss Jan 11, 2024
ef0b197
Merge branch 'master' into master
markbirss Jan 14, 2024
014e672
Merge branch 'master' into master
thebentern Jan 15, 2024
5bd0820
Merge branch 'master' into master
thebentern Jan 16, 2024
f8e7c65
Merge branch 'master' into master
thebentern Jan 19, 2024
4fc2754
Merge branch 'master' into master
thebentern Jan 19, 2024
a156237
Merge branch 'master' into master
thebentern Jan 20, 2024
a39b186
Merge branch 'master' into master
markbirss Jan 21, 2024
8b3bc94
Merge branch 'master' into master
thebentern Jan 23, 2024
1786da0
Merge branch 'master' into master
markbirss Jan 26, 2024
e3ea77b
Update EInkDisplay2.cpp
markbirss Jan 26, 2024
d3bee28
Merge branch 'master' into master
thebentern Jan 29, 2024
8199af9
Merge branch 'master' into master
thebentern Feb 9, 2024
7ae8684
Merge branch 'master' into master
thebentern Feb 10, 2024
2b7bfe6
Merge branch 'master' into master
thebentern Feb 14, 2024
f3ef3b7
Merge branch 'master' into master
markbirss Feb 20, 2024
f5b9f1a
Merge branch 'master' into master
caveman99 Feb 21, 2024
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
40 changes: 40 additions & 0 deletions boards/esp32-s3-pico.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"build": {
"arduino": {
"ldscript": "esp32s3_out.ld",
"partitions": "default_16MB.csv"
markbirss marked this conversation as resolved.
Show resolved Hide resolved
},
"core": "esp32",
"extra_flags": [
"-DARDUINO_ESP32S3_DEV",
markbirss marked this conversation as resolved.
Show resolved Hide resolved
"-DARDUINO_USB_MODE=1",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
markbirss marked this conversation as resolved.
Show resolved Hide resolved
"hwids": [["0x303A", "0x1001"]],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": ["wifi", "bluetooth", "lora"],
"debug": {
"default_tool": "esp-builtin",
"onboard_tools": ["esp-builtin"],
"openocd_target": "esp32s3.cfg"
},
"frameworks": ["arduino", "espidf"],
"name": "Waveshare ESP32-S3-Pico (16 MB FLASH, 2 MB PSRAM)",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"use_1200bps_touch": true,
"wait_for_upload_port": true,
"require_upload_port": true,
"speed": 921600
},
"url": "https://www.waveshare.com/esp32-s3-pico.htm",
"vendor": "Waveshare"
}
14 changes: 11 additions & 3 deletions src/graphics/EInkDisplay2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl, OLEDDISPLAY_GEOMETRY
setGeometry(GEOMETRY_RAWMODE, 296, 128);
LOG_DEBUG("GEOMETRY_RAWMODE, 296, 128\n");

#elif defined(ESP32_S3_PICO)
markbirss marked this conversation as resolved.
Show resolved Hide resolved

// GxEPD2_290_T94_V2
setGeometry(GEOMETRY_RAWMODE, EPD_WIDTH, EPD_HEIGHT);
LOG_DEBUG("GEOMETRY_RAWMODE, 296, 128\n");

#endif
// setGeometry(GEOMETRY_RAWMODE, 128, 64); // old resolution
// setGeometry(GEOMETRY_128_64); // We originally used this because I wasn't sure if rawmode worked - it does
Expand Down Expand Up @@ -149,9 +155,11 @@ bool EInkDisplay::forceDisplay(uint32_t msecLimit)
adafruitDisplay->nextPage();
#elif defined(HELTEC_WIRELESS_PAPER)
adafruitDisplay->nextPage();
#elif defined(PRIVATE_HW) || defined(my)
#elif defined(my)
adafruitDisplay->nextPage();

#elif defined(ESP32_S3_PICO)
adafruitDisplay->nextPage();

#endif

// Put screen to sleep to save power (possibly not necessary because we already did poweroff inside of display)
Expand Down Expand Up @@ -256,7 +264,7 @@ bool EInkDisplay::connect()
adafruitDisplay->init(115200, true, 40, false, SPI, SPISettings(4000000, MSBFIRST, SPI_MODE0));
adafruitDisplay->setRotation(0);
adafruitDisplay->setPartialWindow(0, 0, EPD_WIDTH, EPD_HEIGHT);
#elif defined(my)
#elif defined(my) || defined(ESP32_S3_PICO)
markbirss marked this conversation as resolved.
Show resolved Hide resolved
{
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
adafruitDisplay = new GxEPD2_BW<TECHO_DISPLAY_MODEL, TECHO_DISPLAY_MODEL::HEIGHT>(*lowLevel);
Expand Down
6 changes: 3 additions & 3 deletions src/platform/esp32/architecture.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@
#define HW_VENDOR meshtastic_HardwareModel_BETAFPV_900_NANO_TX
#elif defined(PICOMPUTER_S3)
#define HW_VENDOR meshtastic_HardwareModel_PICOMPUTER_S3
#elif defined(HELTEC_HT62)
#define HW_VENDOR meshtastic_HardwareModel_HELTEC_HT62
#elif defined(ESP32_S3_PICO)
thebentern marked this conversation as resolved.
Show resolved Hide resolved
#define HW_VENDOR meshtastic_HardwareModel_ESP32_S3_PICO
#elif defined(SENSELORA_S3)
#define HW_VENDOR meshtastic_HardwareModel_SENSELORA_S3
#elif defined(HELTEC_HT62)
Expand All @@ -147,4 +147,4 @@
#define LORA_CS 18
#endif

#define SERIAL0_RX_GPIO 3 // Always GPIO3 on ESP32 // FIXME: may be different on ESP32-S3, etc.
#define SERIAL0_RX_GPIO 3 // Always GPIO3 on ESP32 // FIXME: may be different on ESP32-S3, etc.
36 changes: 36 additions & 0 deletions variants/esp32-s3-pico/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>

#define USB_VID 0x303a
#define USB_PID 0x1001

#define EXTERNAL_NUM_INTERRUPTS 46
#define NUM_DIGITAL_PINS 48
#define NUM_ANALOG_INPUTS 20

#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
#define digitalPinHasPWM(p) (p < 46)

// The default Wire will be mapped to PMU and RTC
static const uint8_t SDA = 15;
static const uint8_t SCL = 16;

// Default SPI will be mapped to Radio
static const uint8_t MISO = 37;
static const uint8_t SCK = 35;
static const uint8_t MOSI = 36;
static const uint8_t SS = 14;

static const uint8_t BAT_ADC_PIN = 26;

// #define SPI_MOSI (11)
// #define SPI_SCK (14)
// #define SPI_MISO (2)
// #define SPI_CS (13)

// #define SDCARD_CS SPI_CS

#endif /* Pins_Arduino_h */
25 changes: 25 additions & 0 deletions variants/esp32-s3-pico/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[env:ESP32-S3-Pico]

board_level = extra
extends = esp32s3_base
upload_protocol = esptool
board = esp32-s3-pico

board_upload.use_1200bps_touch = yes
board_upload.wait_for_upload_port = yes
board_upload.require_upload_port = yes

;upload_port = /dev/ttyACM0

build_flags = ${esp32_base.build_flags}
-DESP32_S3_PICO
;-DPRIVATE_HW
-Ivariants/esp32-s3-pico
-DBOARD_HAS_PSRAM
-DTECHO_DISPLAY_MODEL=GxEPD2_290_T94_V2
-DEPD_HEIGHT=128
-DEPD_WIDTH=296

lib_deps = ${esp32s3_base.lib_deps}
zinggjm/GxEPD2@^1.5.3
;adafruit/Adafruit NeoPixel@^1.10.7
77 changes: 77 additions & 0 deletions variants/esp32-s3-pico/variant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*

*/
#define HAS_GPS 0
#undef GPS_RX_PIN
#undef GPS_TX_PIN

#define EXT_NOTIFY_OUT 22
#define BUTTON_PIN 0 // 17

// #define LED_PIN PIN_LED
// Board has RGB LED 21

//The usbPower state is revered ?
//DEBUG | ??:??:?? 365 [Power] Battery: usbPower=0, isCharging=0, batMv=4116, batPct=90
//DEBUG | ??:??:?? 385 [Power] Battery: usbPower=1, isCharging=1, batMv=4243, batPct=0

// https://www.waveshare.com/img/devkit/ESP32-S3-Pico/ESP32-S3-Pico-details-inter-1.jpg
// digram is incorrect labeled as battery pin is getting readings on GPIO7_CH1?
#define BATTERY_PIN 7
#define ADC_CHANNEL ADC1_GPIO7_CHANNEL
// #define ADC_CHANNEL ADC1_GPIO6_CHANNEL
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
#define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic

#define I2C_SDA 15
#define I2C_SCL 16

// Enable secondary bus for external periherals
// https://www.waveshare.com/wiki/Pico-OLED-1.3
// #define USE_SH1107_128_64
// Not working
#define I2C_SDA1 17
#define I2C_SCL1 18

#define BUTTON_PIN 0 // This is the BOOT button
#define BUTTON_NEED_PULLUP

// #define USE_RF95 // RFM95/SX127x
#define USE_SX1262
// #define USE_SX1280

#define LORA_MISO 37
#define LORA_SCK 35
#define LORA_MOSI 36
#define LORA_CS 14

#define LORA_RESET 40
#define LORA_DIO1 4
#define LORA_DIO2 13

#ifdef USE_SX1262
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif

#ifdef USE_SX1280
#define SX128X_CS LORA_CS
#define SX128X_DIO1 LORA_DIO1
#define SX128X_BUSY 9
#define SX128X_RESET LORA_RESET
#endif

#define USE_EINK
/*
* eink display pins
*/
#define PIN_EINK_CS 34
#define PIN_EINK_BUSY 38
#define PIN_EINK_DC 33
#define PIN_EINK_RES 42 // 37 //(-1) // cant be MISO Waveshare ??)
#define PIN_EINK_SCLK 35
#define PIN_EINK_MOSI 36
Loading