Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 8 additions & 2 deletions lib/BlueSCSI_platform_RP2MCU/BlueSCSI_platform_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ static const char defaultMAC[] = { 0x00, 0x80, 0x19, 0xc0, 0xff, 0xee };

static bool network_in_use = false;

// Whether the WiFi interface answered the boot-time check in
// platform_network_iface_check(). The RM2 module is optional on Ultra,
// so this stays false until the module is actually detected.
static bool network_iface_present = false;

// WiFi reconnection state (file-static so wifi_join can reset on credential change)
static uint32_t wifi_reconnect_time = 0;
static uint32_t wifi_reconnect_interval = WIFI_RECONNECT_INTERVAL;
Expand All @@ -51,7 +56,7 @@ bool platform_network_supported()
{
/* from cores/rp2040/RP2040Support.h */
#if defined(BLUESCSI_ULTRA)
return true;
return network_iface_present;
#elif !defined(PICO_CYW43_SUPPORTED) || defined(BLUESCSI_ULTRA_WIDE)
return false;
#else
Expand Down Expand Up @@ -244,7 +249,8 @@ bool platform_network_iface_check()
{
cyw43_deinit(&cyw43_state);
cyw43_init(&cyw43_state);
return 0 == cyw43_gpio_set(&cyw43_state, PICO_W_GPIO_LED_PIN, 1);
network_iface_present = (0 == cyw43_gpio_set(&cyw43_state, PICO_W_GPIO_LED_PIN, 1));
return network_iface_present;
}

void platform_network_deinit()
Expand Down
22 changes: 21 additions & 1 deletion src/BlueSCSI.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* BlueSCSI v2
* Copyright (c) 2023-2025 Eric Helgeson, Androda, and contributors.
* Copyright (c) 2023-2026 Eric Helgeson, Androda, and contributors.
*
* This project is based on ZuluSCSI, BlueSCSI v1, and SCSI2SD:
*
Expand Down Expand Up @@ -1313,6 +1313,26 @@ STATIC_TESTABLE void bluescsi_setup_sd_card(bool wait_for_card = true)

#ifdef RECLOCKING_SUPPORTED
bluescsi_speed_grade_t speed_grade = (bluescsi_speed_grade_t) g_scsi_settings.getSystem()->speedGrade;
#if defined(BLUESCSI_ULTRA) && defined(BLUESCSI_NETWORK)
// The RM2 is reached over a PIO SPI bus whose divider is a compile-time
// constant sized for the stock clock, so the bus speed scales with clk_sys.
// Past the WifiRM2 grade the module stops answering, and it fails silently:
// cyw43_wifi_on() fails inside cyw43_wifi_set_up(), which returns void, so
// the interface is left down and every later scan/join returns -4 with
// nothing logged. Measured on an Ultra: the RM2 answers at 150MHz and is
// dead at 251MHz (TurboMax). When an RM2 is actually installed its clock wins
// over the configured grade - platform_network_supported() is only true
// here once the module answered the boot-time probe.
if (platform_network_supported() && speed_grade != SPEED_GRADE_WIFI_RM2)
{
logmsg("RM2 detected: overriding SpeedGrade \"", g_scsi_settings.getSpeedGradeString(),
"\" with \"WifiRM2\" - the RM2 does not respond at higher clocks");
// Update the setting itself, not just the local, so the reclock log below
// and every other reader report the grade actually in force.
speed_grade = SPEED_GRADE_WIFI_RM2;
g_scsi_settings.getSystem()->speedGrade = SPEED_GRADE_WIFI_RM2;
}
#endif
if (speed_grade != bluescsi_speed_grade_t::SPEED_GRADE_DEFAULT)
{
logmsg("Speed grade set to ", g_scsi_settings.getSpeedGradeString(), " reclocking system");
Expand Down