mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
fix: warn of radio pins that block flashing over USB
GPIO2 on the original ESP32, 46 on the S2/S3 and 8 on the C3/C6 don't stop a normal boot, but held at the wrong level at reset they keep esptool from starting the download mode. The WT32-ETH01 wiring puts TX on GPIO2. Each warning now says what the pin does and what to do: move it for a pin that stops the boot, disconnect it to flash for one that only blocks USB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
658f5eabeb
commit
92e69d599f
6 changed files with 87 additions and 40 deletions
|
|
@ -18,6 +18,22 @@ test('RX on GPIO12 warns of the flash voltage on the original ESP32', () => {
|
|||
assert.match(warnings[0], /1\.8 V/);
|
||||
});
|
||||
|
||||
test('TX on GPIO2 warns of flashing over USB on the original ESP32', () => {
|
||||
// The WT32-ETH01 wiring in the wiki.
|
||||
const warnings = BootPins.radioWarnings('', Object.assign({}, esp32Defaults, { TXPin: 2 }));
|
||||
assert.equal(warnings.length, 1);
|
||||
assert.match(warnings[0], /^TX is on GPIO-2, .*Held high, it stops flashing over USB, so disconnect it to flash\.$/);
|
||||
});
|
||||
|
||||
test('GPIO8 held low blocks flashing on the C3 and C6', () => {
|
||||
const config = { SCKPin: 4, CSNPin: 7, MOSIPin: 6, MISOPin: 5, TXPin: 10, RXPin: 8 };
|
||||
for (const chip of ['c3', 'c6']) {
|
||||
const warnings = BootPins.radioWarnings(chip, config);
|
||||
assert.equal(warnings.length, 1);
|
||||
assert.match(warnings[0], /^RX is on GPIO-8, .*Held low, it stops flashing over USB/);
|
||||
}
|
||||
});
|
||||
|
||||
test('an unknown chip model warns of nothing', () => {
|
||||
assert.deepEqual(BootPins.radioWarnings('h2', Object.assign({}, esp32Defaults, { RXPin: 12 })), []);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,10 +19,18 @@ static void test_gpio0_picks_the_boot_mode() {
|
|||
TEST_ASSERT_NOT_NULL(strstr(effect, "download mode"));
|
||||
}
|
||||
|
||||
static void test_gpio2_blocks_flashing_over_usb() {
|
||||
// It only counts with GPIO0 low, so the board boots, but esptool can't
|
||||
// start the download mode while it is high.
|
||||
const char *effect = bootPinEffect(2);
|
||||
TEST_ASSERT_NOT_NULL(effect);
|
||||
TEST_ASSERT_NOT_NULL(strstr(effect, "high"));
|
||||
TEST_ASSERT_NOT_NULL(strstr(effect, "USB"));
|
||||
}
|
||||
|
||||
static void test_harmless_strapping_pins_are_not_listed() {
|
||||
// 2 only matters for the download mode, 5 and 15 set the SDIO timing and
|
||||
// the boot log. 5 is the default CSN.
|
||||
TEST_ASSERT_NULL(bootPinEffect(2));
|
||||
// 5 and 15 set the SDIO timing and quiet the boot log. 5 is the default
|
||||
// CSN.
|
||||
TEST_ASSERT_NULL(bootPinEffect(5));
|
||||
TEST_ASSERT_NULL(bootPinEffect(15));
|
||||
}
|
||||
|
|
@ -34,14 +42,17 @@ static void test_default_radio_pins_are_safe() {
|
|||
}
|
||||
|
||||
static void test_other_chips_boot_pins_are_safe_here() {
|
||||
TEST_ASSERT_NULL(bootPinEffect(8));
|
||||
TEST_ASSERT_NULL(bootPinEffect(9));
|
||||
TEST_ASSERT_NULL(bootPinEffect(45));
|
||||
TEST_ASSERT_NULL(bootPinEffect(46));
|
||||
}
|
||||
|
||||
int main(int, char **) {
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(test_gpio12_picks_the_flash_voltage);
|
||||
RUN_TEST(test_gpio0_picks_the_boot_mode);
|
||||
RUN_TEST(test_gpio2_blocks_flashing_over_usb);
|
||||
RUN_TEST(test_harmless_strapping_pins_are_not_listed);
|
||||
RUN_TEST(test_default_radio_pins_are_safe);
|
||||
RUN_TEST(test_other_chips_boot_pins_are_safe_here);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,12 @@ static void test_gpio0_picks_the_boot_mode() {
|
|||
TEST_ASSERT_NOT_NULL(bootPinEffect(0));
|
||||
}
|
||||
|
||||
static void test_gpio46_blocks_flashing_over_usb() {
|
||||
const char *effect = bootPinEffect(46);
|
||||
TEST_ASSERT_NOT_NULL(effect);
|
||||
TEST_ASSERT_NOT_NULL(strstr(effect, "USB"));
|
||||
}
|
||||
|
||||
static void test_gpio12_is_safe() {
|
||||
// 12 is the S3's default SCK.
|
||||
TEST_ASSERT_NULL(bootPinEffect(12));
|
||||
|
|
@ -32,6 +38,7 @@ int main(int, char **) {
|
|||
UNITY_BEGIN();
|
||||
RUN_TEST(test_gpio45_picks_the_flash_voltage);
|
||||
RUN_TEST(test_gpio0_picks_the_boot_mode);
|
||||
RUN_TEST(test_gpio46_blocks_flashing_over_usb);
|
||||
RUN_TEST(test_gpio12_is_safe);
|
||||
RUN_TEST(test_default_radio_pins_are_safe);
|
||||
return UNITY_END();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue