diff options
-rw-r--r-- | src/Config/Pins_Duet3_MB6XD.h | 3 | ||||
-rw-r--r-- | src/Platform/Platform.cpp | 48 | ||||
-rw-r--r-- | src/Platform/Platform.h | 4 |
3 files changed, 15 insertions, 40 deletions
diff --git a/src/Config/Pins_Duet3_MB6XD.h b/src/Config/Pins_Duet3_MB6XD.h index 59a8b140..2aee62ce 100644 --- a/src/Config/Pins_Duet3_MB6XD.h +++ b/src/Config/Pins_Duet3_MB6XD.h @@ -98,7 +98,8 @@ constexpr Pin UsbVBusPin = PortCPin(21); // Pin used to monitor VBUS on USB po // Drivers constexpr Pin STEP_PINS[NumDirectDrivers] = { PortCPin(18), PortCPin(16), PortCPin(28), PortCPin(01), PortCPin(4), PortCPin(9) }; constexpr Pin DIRECTION_PINS[NumDirectDrivers] = { PortBPin(5), PortDPin(10), PortAPin(4), PortAPin(22), PortCPin(3), PortDPin(14) }; -constexpr Pin ENABLE_PINS[NumDirectDrivers] = { PortBPin(4), PortAPin(21), PortAPin(9), PortAPin(23), PortAPin(2), PortDPin(17) }; +constexpr Pin ENABLE_PINS_v01[NumDirectDrivers] = { PortBPin(4), PortAPin(21), PortAPin(9), PortAPin(23), PortAPin(2), PortDPin(17) }; +constexpr Pin ENABLE_PINS_v100[NumDirectDrivers] = { PortBPin(4), PortAPin(21), PortCPin(20), PortAPin(23), PortAPin(2), PortDPin(17) }; constexpr Pin DRIVER_ERR_PINS[NumDirectDrivers] = { PortDPin(29), PortCPin(17), PortDPin(13), PortCPin(02), PortDPin(31), PortCPin(10) }; constexpr Pin StepGatePin = PortDPin(22); constexpr GpioPinFunction StepGatePinFunction = GpioPinFunction::C; // TIOB11 diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index fc1afd3f..54fd7916 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -551,40 +551,6 @@ void Platform::Init() noexcept # endif #endif -#if defined(DUET_06_085) - ARRAY_INIT(defaultMacAddress, DefaultMacAddress); - - // Motor current setting on Duet 0.6 and 0.8.5 - I2C::Init(); - mcpExpansion.setMCP4461Address(0x2E); // not required for mcpDuet, as this uses the default address - ARRAY_INIT(potWipes, POT_WIPES); - senseResistor = SENSE_RESISTOR; - maxStepperDigipotVoltage = MAX_STEPPER_DIGIPOT_VOLTAGE; - stepperDacVoltageRange = STEPPER_DAC_VOLTAGE_RANGE; - stepperDacVoltageOffset = STEPPER_DAC_VOLTAGE_OFFSET; -#elif defined(__ALLIGATOR__) - pinMode(EthernetPhyResetPin, INPUT); // Init Ethernet Phy Reset Pin - - // Alligator Init DAC for motor current vref - ARRAY_INIT(spiDacCS, SPI_DAC_CS); - dacAlligator.Init(spiDacCS[0]); - dacPiggy.Init(spiDacCS[1]); - // Get macaddress from EUI48 eeprom - eui48MacAddress.Init(Eui48csPin); - if (!eui48MacAddress.getEUI48(defaultMacAddress)) - { - ARRAY_INIT(defaultMacAddress, DefaultMacAddress); - } - - Microstepping::Init(); // Init Motor FAULT detect Pin - pinMode(ExpansionVoltageLevelPin, ExpansionVoltageLevel==3 ? OUTPUT_LOW : OUTPUT_HIGH); // Init Expansion Voltage Level Pin - pinMode(MotorFaultDetectPin,INPUT); // Init Motor FAULT detect Pin - pinMode(ExpansionPiggyDetectPin,INPUT); // Init Expansion Piggy module presence Pin - pinMode(FTDIconverterResetPin,INPUT); // Init FTDI Serial Converter Reset Pin - pinMode(SpiEEPROMcsPin,OUTPUT_HIGH); // Init Spi EEPROM Cs pin, not implemented, default unselected - pinMode(SpiFLASHcsPin,OUTPUT_HIGH); // Init Spi FLASH Cs pin, not implemented, default unselected -#endif - #if defined(__LPC17xx__) if (hasDriverCurrentControl) { @@ -646,6 +612,7 @@ void Platform::Init() noexcept // Set up the local drivers. Do this after we have read any direction pins that specify the board type. #ifdef DUET3_MB6XD + ENABLE_PINS = (GetBoardType() == BoardType::Duet3_6XD_v01) ? ENABLE_PINS_v01 : ENABLE_PINS_v100; unsigned int numErrorHighDrivers = 0; #endif for (size_t driver = 0; driver < NumDirectDrivers; ++driver) @@ -3793,12 +3760,15 @@ void Platform::SetBoardType(BoardType bt) noexcept ? BoardType::Duet3Mini_WiFi : BoardType::Duet3Mini_Ethernet; #elif defined(DUET3_MB6HC) - // Driver 0 direction has a pulldown resistor on v0.6 and v1.0 boards, but won't on v1.01 boards + // Driver 0 direction has a pulldown resistor on v0.6 and v1.0 boards, but not on v1.01 boards pinMode(DIRECTION_PINS[0], INPUT_PULLUP); delayMicroseconds(20); // give the pullup resistor time to work board = (digitalRead(DIRECTION_PINS[0])) ? BoardType::Duet3_6HC_v101 : BoardType::Duet3_6HC_v06_100; #elif defined(DUET3_MB6XD) - board = BoardType::Duet3_6XD; + // Driver 0 direction has a pulldown resistor on v1.0 boards, but not on v0.1 boards + pinMode(DIRECTION_PINS[0], INPUT_PULLUP); + delayMicroseconds(20); // give the pullup resistor time to work + board = (digitalRead(DIRECTION_PINS[0])) ? BoardType::Duet3_6XD_v01 : BoardType::Duet3_6XD_v100; #elif defined(FMDC_V02) || defined(FMDC_V03) board = BoardType::FMDC; #elif defined(SAME70XPLD) @@ -3878,7 +3848,8 @@ const char *_ecv_array Platform::GetElectronicsString() const noexcept case BoardType::Duet3_6HC_v06_100: return "Duet 3 " BOARD_SHORT_NAME " v0.6 or 1.0"; case BoardType::Duet3_6HC_v101: return "Duet 3 " BOARD_SHORT_NAME " v1.01 or later"; #elif defined(DUET3_MB6XD) - case BoardType::Duet3_6XD: return "Duet 3 " BOARD_SHORT_NAME; // we have only one version at present + case BoardType::Duet3_6XD_v01: return "Duet 3 " BOARD_SHORT_NAME " v0.1"; + case BoardType::Duet3_6XD_v100: return "Duet 3 " BOARD_SHORT_NAME " v1.0 or later"; #elif defined(FMDC_V02) || defined(FMDC_V03) case BoardType::FMDC: return "Duet 3 " BOARD_SHORT_NAME; #elif defined(SAME70XPLD) @@ -3917,7 +3888,8 @@ const char *_ecv_array Platform::GetBoardString() const noexcept case BoardType::Duet3_6HC_v06_100: return "duet3mb6hc100"; case BoardType::Duet3_6HC_v101: return "duet3mb6hc101"; #elif defined(DUET3_MB6XD) - case BoardType::Duet3_6XD: return "duet3mb6xd"; // we have only one version at present + case BoardType::Duet3_6XD_v01: return "duet3mb6xd001"; // we have only one version at present + case BoardType::Duet3_6XD_v100: return "duet3mb6xd100"; // we have only one version at present #elif defined(FMDC_V02) || defined(FMDC_V03) case BoardType::FMDC: return "fmdc"; #elif defined(SAME70XPLD) diff --git a/src/Platform/Platform.h b/src/Platform/Platform.h index b38533a5..585bf64a 100644 --- a/src/Platform/Platform.h +++ b/src/Platform/Platform.h @@ -127,7 +127,8 @@ enum class BoardType : uint8_t Duet3_6HC_v06_100 = 1, Duet3_6HC_v101 = 2, #elif defined(DUET3_MB6XD) - Duet3_6XD = 1, + Duet3_6XD_v01 = 1, + Duet3_6XD_v100 = 2, #elif defined(FMDC_V02) || defined(FMDC_V03) FMDC, #elif defined(SAME70XPLD) @@ -790,6 +791,7 @@ private: uint32_t stepPulseMinimumPeriodClocks; // minimum period between leading edges of step pulses, in step clocks uint32_t directionSetupClocks; // minimum direction change to step high time, in step clocks uint32_t directionHoldClocksFromLeadingEdge; // minimum step high to direction low step clocks, calculated from the step low to direction change hold time + const Pin *ENABLE_PINS; // 6XD version 0.1 uses different enable pins from version 1.0 and later #else uint32_t slowDriversBitmap; // bitmap of driver port bits that need extended step pulse timing uint32_t slowDriverStepTimingClocks[4]; // minimum step high, step low, dir setup and dir hold timing for slow drivers |