Skip to content

Commit

Permalink
Fix initiator DIP switch workaround for early RP2040 boards
Browse files Browse the repository at this point in the history
There was a regression affecting a small number of early RP2040
boards that have Diodes Incorporated 74LVT245B tranceivers.
These have higher bus hold current than Texas Instruments parts
used in later revisions, requiring a software workaround.

This regression caused initiator mode DIP switch not to work
on the affected boards, starting with firmware version 2023-10-20.
  • Loading branch information
PetteriAimonen committed Dec 11, 2024
1 parent b6c83d8 commit 3c35a5c
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions lib/ZuluSCSI_platform_RP2MCU/ZuluSCSI_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,24 @@ void platform_init()

}
# else
g_scsi_initiator = SETUP_TRUE == read_setup_ack_pin();
pin_setup_state_t dip_state = read_setup_ack_pin();
if (dip_state == SETUP_UNDETERMINED)
{
// This path is used for the few early RP2040 boards assembled with
// Diodes Incorporated 74LVT245B, which has higher bus hold
// current.
working_dip = false;
g_scsi_initiator = !gpio_get(DIP_INITIATOR); // Read fallback value
}
else
{
g_scsi_initiator = (SETUP_TRUE == dip_state);
termination = !gpio_get(DIP_TERM);
}

// dbglog DIP switch works in any case, as it does not have bus hold.
dbglog = !gpio_get(DIP_DBGLOG);
termination = !gpio_get(DIP_TERM);
g_log_debug = dbglog;
# endif
#else
delay(10);
Expand Down Expand Up @@ -319,9 +334,13 @@ void platform_init()
else
{
logmsg("SCSI termination is determined by the DIP switch labeled \"TERM\"");

#if defined(ZULUSCSI_PICO) || defined(ZULUSCSI_PICO_2)
logmsg("Debug logging can only be enabled via INI file \"DEBUG=1\" under [SCSI] in zuluscsi.ini");
logmsg("-- DEBUG DIP switch setting is ignored on ZuluSCSI Pico FS Rev. 2023b and 2023c boards");
g_log_debug = false;
#endif

}
#else
g_log_debug = false;
Expand Down

0 comments on commit 3c35a5c

Please sign in to comment.