Skip to content

Commit d48aec4

Browse files
committed
Move MUX from I2C bus by default to prevent external device problems
Fix for #474
1 parent c5c593d commit d48aec4

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,8 @@ void setup()
752752

753753
initializePowerPins(); //Initialize any essential power pins - e.g. enable power for the Display
754754

755+
beginMux(); //Must come before I2C activity to avoid external devices from corrupting the bus. See issue #474: https://github.com/sparkfun/SparkFun_RTK_Firmware/issues/474
756+
755757
beginI2C();
756758

757759
beginDisplay(); //Start display to be able to display any errors

Firmware/RTK_Surveyor/System.ino

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,28 @@ void cyclePositionLEDs()
476476
}
477477
}
478478

479+
//Determine MUX pins for this platform and set MUX to ADC/DAC to avoid I2C bus failure
480+
void beginMux()
481+
{
482+
if (productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS_PLUS)
483+
{
484+
pin_muxA = 2;
485+
pin_muxB = 4;
486+
}
487+
else if (productVariant == RTK_FACET || productVariant == RTK_FACET_LBAND)
488+
{
489+
pin_muxA = 2;
490+
pin_muxB = 0;
491+
}
492+
493+
setMuxport(MUX_ADC_DAC); //Set mux to user's choice: NMEA, I2C, PPS, or DAC
494+
}
495+
479496
//Set the port of the 1:4 dual channel analog mux
480497
//This allows NMEA, I2C, PPS/Event, and ADC/DAC to be routed through data port via software select
481498
void setMuxport(int channelNumber)
482499
{
483-
if (productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS_PLUS || productVariant == RTK_FACET || productVariant == RTK_FACET_LBAND)
500+
if (pin_muxA >= 0 && pin_muxB >= 0)
484501
{
485502
pinMode(pin_muxA, OUTPUT);
486503
pinMode(pin_muxB, OUTPUT);

0 commit comments

Comments
 (0)