Skip to content

Commit 5ce570d

Browse files
committed
update ide and move sd to real spi
1 parent 5bf5216 commit 5ce570d

File tree

3 files changed

+51
-13
lines changed

3 files changed

+51
-13
lines changed

platformio.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ src_dir = src
55
boards_dir = ./boards
66

77
[env]
8-
platform = espressif32@6.3.0
8+
platform = espressif32
99
framework = arduino
1010
upload_speed = 921600
1111
monitor_speed = 115200
@@ -54,7 +54,7 @@ board_build.partitions = default_16MB.csv
5454

5555
;FLASH = 4M, 2M PSRAM
5656
[env:T-QT-Pro-N4R2]
57-
platform = espressif32
57+
platform = espressif32@6.6.0
5858
board = esp32-s3-t-qt-pro
5959
framework = arduino
6060

src/main.ino

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
#include <NTPClient.h>
1313

1414
#define TOUCH_PIN GPIO_NUM_17
15-
#define MAX_TOUCH_BUTTON_CYCLES_TO_RESPOND 2
1615

17-
#define PIN_MIC_BCK GPIO_NUM_33
18-
#define PIN_MIC_WS GPIO_NUM_34
16+
#define PIN_MIC_BCK GPIO_NUM_48
17+
#define PIN_MIC_WS GPIO_NUM_18
1918
#define PIN_MIC_DATA GPIO_NUM_16
2019

2120
#define PIN_SPEAKER_LEFT_OUT GPIO_NUM_38
2221
#define PIN_SPEAKER_RIGHT_OUT GPIO_NUM_39
2322

24-
#define PIN_SD_CARD_CS GPIO_NUM_18
25-
#define PIN_SD_CARD_MOSI GPIO_NUM_37
23+
#define PIN_SD_CARD_CS GPIO_NUM_34
24+
#define PIN_SD_CARD_MOSI GPIO_NUM_35
2625
#define PIN_SD_CARD_CLK GPIO_NUM_36
27-
#define PIN_SD_CARD_MISO GPIO_NUM_35
26+
#define PIN_SD_CARD_MISO GPIO_NUM_37
2827

2928
#define INITIAL_DELAY 300
29+
#define MAX_TOUCH_BUTTON_CYCLES_TO_RESPOND 2
3030

3131
// Configuration
3232
ConfigManager config = ConfigManager();
@@ -59,6 +59,43 @@ String current_emotion;
5959
void
6060
setup()
6161
{
62+
63+
// Debug SD card connections
64+
// int ctr = 0;
65+
// while (1) {
66+
// ctr++;
67+
68+
// pinMode(TOUCH_PIN, OUTPUT);
69+
70+
// pinMode(PIN_MIC_BCK, OUTPUT);
71+
// pinMode(PIN_MIC_WS, OUTPUT);
72+
// pinMode(PIN_MIC_DATA, OUTPUT);
73+
74+
// pinMode(PIN_SPEAKER_LEFT_OUT, OUTPUT);
75+
// pinMode(PIN_SPEAKER_RIGHT_OUT, OUTPUT);
76+
77+
// pinMode(PIN_SD_CARD_CS, OUTPUT);
78+
// pinMode(PIN_SD_CARD_MOSI, OUTPUT);
79+
// pinMode(PIN_SD_CARD_CLK, OUTPUT);
80+
// pinMode(PIN_SD_CARD_MISO, OUTPUT);
81+
82+
// digitalWrite(TOUCH_PIN, ctr % 2);
83+
84+
// digitalWrite(PIN_MIC_BCK, ctr % 2);
85+
// digitalWrite(PIN_MIC_WS, ctr % 2);
86+
// digitalWrite(PIN_MIC_DATA, ctr % 2);
87+
88+
// digitalWrite(PIN_SPEAKER_LEFT_OUT, ctr % 2);
89+
// digitalWrite(PIN_SPEAKER_RIGHT_OUT, ctr % 2);
90+
91+
// digitalWrite(PIN_SD_CARD_CS, ctr % 2);
92+
// digitalWrite(PIN_SD_CARD_MOSI, ctr % 2);
93+
// digitalWrite(PIN_SD_CARD_CLK, ctr % 2);
94+
// digitalWrite(PIN_SD_CARD_MISO, ctr % 2);
95+
96+
// delay(2000);
97+
// }
98+
6299
Serial.begin(115200);
63100
delay(INITIAL_DELAY);
64101

src/sd.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@ class SDCard
1919
void begin()
2020
{
2121

22-
// needed for MOSI pullup, read
22+
// need to set MISO to pullup, read
2323
// https://github.com/espressif/arduino-esp32/issues/524
2424
pinMode(sd_MISO, INPUT_PULLUP);
25+
digitalWrite(sd_CS, HIGH);
2526

26-
sd_spi.begin(sd_CLK, sd_MISO, sd_MOSI);
27-
delay(100);
27+
sd_spi.begin(sd_CLK, sd_MISO, sd_MOSI, sd_CS);
28+
sd_spi.setDataMode(SPI_MODE0);
2829

2930
if (!SD.begin(sd_CS, sd_spi)) {
30-
Serial.println("\n\nSD card initialization failed!\n\n");
31+
Serial.println("\nFailed to mount SD Card.\n\n");
3132
return;
3233
}
33-
Serial.println("SD Card mounted, directories:\n");
34+
Serial.println("SD Card mounted, continuing.\n");
3435
}
3536

3637
void printDirectory(File dir, int numTabs)

0 commit comments

Comments
 (0)