Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2021-06-02 17:06:23 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-06-02 17:06:23 +0300
commite8da1e9fadc21aac11cd2e2c36d1cedaca8a8606 (patch)
tree0e69fd35b34f97e6b5d62996ac14ec8d844ed3dc
parent5a578f2a63d6e3b4526893f9beb6713f1224ef26 (diff)
Corrected initialisation of Aux1 on Duet 3 MB6HC
-rw-r--r--src/Comms/AuxDevice.cpp7
-rw-r--r--src/Hardware/SAME70/Devices.cpp40
2 files changed, 31 insertions, 16 deletions
diff --git a/src/Comms/AuxDevice.cpp b/src/Comms/AuxDevice.cpp
index babc9d2d..f788da20 100644
--- a/src/Comms/AuxDevice.cpp
+++ b/src/Comms/AuxDevice.cpp
@@ -151,8 +151,11 @@ bool AuxDevice::Flush() noexcept
void AuxDevice::Diagnostics(MessageType mt, unsigned int index) noexcept
{
- const UARTClass::Errors errs = uart->GetAndClearErrors();
- reprap.GetPlatform().MessageF(mt, "Aux%u errors %u,%u,%u\n", index, (unsigned int)errs.uartOverrun, (unsigned int)errs.bufferOverrun, (unsigned int)errs.framing);
+ if (enabled)
+ {
+ const UARTClass::Errors errs = uart->GetAndClearErrors();
+ reprap.GetPlatform().MessageF(mt, "Aux%u errors %u,%u,%u\n", index, (unsigned int)errs.uartOverrun, (unsigned int)errs.bufferOverrun, (unsigned int)errs.framing);
+ }
}
#endif
diff --git a/src/Hardware/SAME70/Devices.cpp b/src/Hardware/SAME70/Devices.cpp
index f6059509..008ac348 100644
--- a/src/Hardware/SAME70/Devices.cpp
+++ b/src/Hardware/SAME70/Devices.cpp
@@ -11,8 +11,32 @@
#include <AnalogOut.h>
#include <matrix/matrix.h>
-AsyncSerial Serial(UART2, UART2_IRQn, ID_UART2, 512, 512, [](AsyncSerial*) noexcept { }, [](AsyncSerial*) noexcept { });
-USARTClass Serial1(USART2, USART2_IRQn, ID_USART2, 512, 512, [](AsyncSerial*) noexcept { }, [](AsyncSerial*) noexcept { });
+AsyncSerial Serial(UART2, UART2_IRQn, ID_UART2, 512, 512,
+ [](AsyncSerial*) noexcept
+ {
+ SetPinFunction(APIN_Serial0_RXD, Serial0PinFunction);
+ SetPinFunction(APIN_Serial0_TXD, Serial0PinFunction);
+ },
+ [](AsyncSerial*) noexcept
+ {
+ ClearPinFunction(APIN_Serial0_RXD);
+ ClearPinFunction(APIN_Serial0_TXD);
+ }
+ );
+
+USARTClass Serial1(USART2, USART2_IRQn, ID_USART2, 512, 512,
+ [](AsyncSerial*) noexcept
+ {
+ SetPinFunction(APIN_Serial1_RXD, Serial1PinFunction);
+ SetPinFunction(APIN_Serial1_TXD, Serial1PinFunction);
+ },
+ [](AsyncSerial*) noexcept
+ {
+ ClearPinFunction(APIN_Serial1_RXD);
+ ClearPinFunction(APIN_Serial1_TXD);
+ }
+ );
+
SerialCDC SerialUSB;
void UART2_Handler(void) noexcept
@@ -25,17 +49,6 @@ void USART2_Handler(void) noexcept
Serial1.IrqHandler();
}
-void SerialInit() noexcept
-{
- SetPinFunction(APIN_Serial0_RXD, Serial0PinFunction);
- SetPinFunction(APIN_Serial0_TXD, Serial0PinFunction);
- EnablePullup(APIN_Serial0_RXD);
-
- SetPinFunction(APIN_Serial1_RXD, Serial1PinFunction);
- SetPinFunction(APIN_Serial1_TXD, Serial1PinFunction);
- EnablePullup(APIN_Serial1_RXD);
-}
-
void SdhcInit() noexcept
{
SetPinFunction(HsmciMclkPin, HsmciMclkPinFunction);
@@ -62,7 +75,6 @@ void DeviceInit() noexcept
LegacyAnalogIn::AnalogInInit();
AnalogOut::Init();
- SerialInit();
SdhcInit();
EthernetInit();