Skip to content

Commit a63e116

Browse files
authored
SDMMC for tab5
1 parent afa499d commit a63e116

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Things that needs to be done in next updates
8585

8686
## Latest Changelog
8787
* 2.6.5:
88+
* [x] M5-Tab5 using SDMMC driver for compatibility with other firmware
8889
* [x] Added possibility to order by "Latest update"
8990
* [x] Port to OpenSourceSRDLabs [WaveSentry and WaveSentry Pro ](https://opensourcesdrlab.com/products/aifw-wavesentry-esp32?VariantsId=10331)
9091
* [x] Battery ADC measurement fix for Cardputer, Tdeck, StickCPlus2, T-Display S3, T-HMI

boards/m5stack-tab5/interface.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "powerSave.h"
22
#include <M5Unified.h>
3+
#include <SD_MMC.h>
34
#include <WiFi.h>
45
#include <interface.h>
56
#define SDIO2_CLK GPIO_NUM_12
@@ -16,6 +17,8 @@
1617
** Description: initial setup for the device
1718
***************************************************************************************/
1819
void _setup_gpio() {
20+
SD_MMC.setPins(43, 44, 39, 40, 41, 42);
21+
SD_MMC.begin("/sdcard");
1922
Serial.println("M5.begin");
2023
M5.begin();
2124
Serial.println("M5.begin Passou");

boards/pinouts/m5stack-tab5.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
// BOOT_MODE 35
88
// BOOT_MODE2 36 pullup
99

10+
#define SDM SD_MMC
11+
1012
static const uint8_t TX = 37;
1113
static const uint8_t RX = 38;
1214

src/sd_functions.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ bool eraseFAT() {
5454
***************************************************************************************/
5555
bool setupSdCard() {
5656
#if !defined(SDM_SD) // fot Lilygo T-Display S3 with lilygo shield
57-
if (!SD_MMC.begin("/sdcard", true))
57+
#if defined(ARDUINO_M5STACK_TAB5)
58+
if (!SD_MMC.begin("/sdcard"))
59+
#else
60+
if (!SD_MMC.begin("/sdcard", true)) // One bit mode
61+
#endif
5862
#elif (TFT_MOSI == SDCARD_MOSI)
5963
if (!SDM.begin(SDCARD_CS)) // https://github.com/Bodmer/TFT_eSPI/discussions/2420
6064
#elif defined(HEADLESS)
@@ -451,8 +455,7 @@ void performUpdate(Stream &updateSource, size_t updateSize, int command) {
451455
log_i("Update successfully completed. Rebooting.");
452456
displayRedStripe("Removing coredump (if any)...");
453457
clearCoredump();
454-
}
455-
else log_i("Update not finished? Something went wrong!");
458+
} else log_i("Update not finished? Something went wrong!");
456459
} else {
457460
log_i("Error Occurred. Error #: %s", String(Update.getError()));
458461
}
@@ -464,7 +467,6 @@ void performUpdate(Stream &updateSource, size_t updateSize, int command) {
464467
vTaskResume(xHandle);
465468
}
466469

467-
468470
/***************************************************************************************
469471
** Function name: clearCoredump
470472
** Description: As some programs may generate core dumps,
@@ -474,14 +476,13 @@ void performUpdate(Stream &updateSource, size_t updateSize, int command) {
474476
bool clearCoredump() {
475477
const esp_partition_t *partition =
476478
esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "coredump");
477-
Serial.printf("Coredump partition address: 0x%08X\n", partition ? partition->address : 0);
479+
Serial.printf("Coredump partition address: 0x%08X\n", partition ? partition->address : 0);
478480
if (!partition) {
479481
Serial.println("Failed to find coredump partition");
480482
log_e("Failed to find coredump partition");
481483
return false;
482484
}
483-
log_i("Erasing coredump partition at address 0x%08X, size %d bytes",
484-
partition->address, partition->size);
485+
log_i("Erasing coredump partition at address 0x%08X, size %d bytes", partition->address, partition->size);
485486

486487
// erase all coredump partition
487488
esp_err_t err = esp_flash_erase_region(NULL, partition->address, partition->size);

0 commit comments

Comments
 (0)