mirror of
https://github.com/meshtastic/firmware.git
synced 2025-05-10 15:19:25 +00:00
Fix T-Deck SD card detection (#6023)
* increase T-Deck PSRAM to avoid too early out-of-memory when messages fill up the storage * fix SDCard for T-Deck; allow SPI frequency config
This commit is contained in:
parent
62058b650a
commit
48b00188fb
@ -23,6 +23,10 @@ SPIClass SPI1(HSPI);
|
|||||||
#define SDHandler SPI
|
#define SDHandler SPI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SD_SPI_FREQUENCY
|
||||||
|
#define SD_SPI_FREQUENCY 4000000U
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // HAS_SDCARD
|
#endif // HAS_SDCARD
|
||||||
|
|
||||||
#if defined(ARCH_STM32WL)
|
#if defined(ARCH_STM32WL)
|
||||||
@ -361,8 +365,7 @@ void setupSDCard()
|
|||||||
#ifdef HAS_SDCARD
|
#ifdef HAS_SDCARD
|
||||||
concurrency::LockGuard g(spiLock);
|
concurrency::LockGuard g(spiLock);
|
||||||
SDHandler.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
|
SDHandler.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
|
||||||
|
if (!SD.begin(SDCARD_CS, SDHandler, SD_SPI_FREQUENCY)) {
|
||||||
if (!SD.begin(SDCARD_CS, SDHandler)) {
|
|
||||||
LOG_DEBUG("No SD_MMC card detected");
|
LOG_DEBUG("No SD_MMC card detected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -270,6 +270,15 @@ void setup()
|
|||||||
// TF Card , Display backlight(AW9364DNR) , AN48841B(Trackball) , ES7210(Decoder)
|
// TF Card , Display backlight(AW9364DNR) , AN48841B(Trackball) , ES7210(Decoder)
|
||||||
pinMode(KB_POWERON, OUTPUT);
|
pinMode(KB_POWERON, OUTPUT);
|
||||||
digitalWrite(KB_POWERON, HIGH);
|
digitalWrite(KB_POWERON, HIGH);
|
||||||
|
// T-Deck has all three SPI peripherals (TFT, SD, LoRa) attached to the same SPI bus
|
||||||
|
// We need to initialize all CS pins in advance otherwise there will be SPI communication issues
|
||||||
|
// e.g. when detecting the SD card
|
||||||
|
pinMode(LORA_CS, OUTPUT);
|
||||||
|
digitalWrite(LORA_CS, HIGH);
|
||||||
|
pinMode(SDCARD_CS, OUTPUT);
|
||||||
|
digitalWrite(SDCARD_CS, HIGH);
|
||||||
|
pinMode(TFT_CS, OUTPUT);
|
||||||
|
digitalWrite(TFT_CS, HIGH);
|
||||||
delay(100);
|
delay(100);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
|
||||||
|
#define TFT_CS 12
|
||||||
#ifndef HAS_TFT // for TFT-UI the definitions are in device-ui
|
#ifndef HAS_TFT // for TFT-UI the definitions are in device-ui
|
||||||
#define BUTTON_PIN 0
|
#define BUTTON_PIN 0
|
||||||
|
|
||||||
// ST7789 TFT LCD
|
// ST7789 TFT LCD
|
||||||
#define ST7789_CS 12
|
#define ST7789_CS TFT_CS
|
||||||
#define ST7789_RS 11 // DC
|
#define ST7789_RS 11 // DC
|
||||||
#define ST7789_SDA 41 // MOSI
|
#define ST7789_SDA 41 // MOSI
|
||||||
#define ST7789_SCK 40
|
#define ST7789_SCK 40
|
||||||
@ -46,6 +48,7 @@
|
|||||||
#define SPI_MISO (38)
|
#define SPI_MISO (38)
|
||||||
#define SPI_CS (39)
|
#define SPI_CS (39)
|
||||||
#define SDCARD_CS SPI_CS
|
#define SDCARD_CS SPI_CS
|
||||||
|
#define SD_SPI_FREQUENCY 75000000U
|
||||||
|
|
||||||
#define BATTERY_PIN 4 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 4 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
// ratio of voltage divider = 2.0 (RD2=100k, RD3=100k)
|
// ratio of voltage divider = 2.0 (RD2=100k, RD3=100k)
|
||||||
|
Loading…
Reference in New Issue
Block a user