Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v3.01-dev-lpc' into v3.01-dev-lpc
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysuk committed Jul 29, 2020
2 parents 498ea23 + c42aeb3 commit 57e0143
Show file tree
Hide file tree
Showing 20 changed files with 1,854 additions and 131 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Information to support using this firmware can be found on the [wiki](https://gi
The wiki also details different methods of connecting for different boards.

## Support
For LPC specific questions (and general questions too), please get in touch over at the [RepRap Forum](https://reprap.org/forum/read.php?147,859857,page=1)
For LPC specific questions (and general questions too), please get in touch over at the [RepRap Forum](https://reprap.org/forum/read.php?147,874661)
There is also a [Discord Channel](https://discord.gg/uS97Qs7) where LPC support can also be found.
For generic RepRapFirmware questions, please use the [Duet Forum](forum.duet.com)

Expand Down
34 changes: 34 additions & 0 deletions WHATS_NEW_LPC.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,40 @@ Please note
============
The sample board.txt files which are here: https://github.com/gloomyandy/RepRapFirmware/tree/v3.01-dev-lpc/LPC/ExampleBoardConfig are out of date and may contain invalid settings. In addition the current software is not very good at detecting errors in these files and providing feedback to the user. Hopefully this will be improved soon, but for now the best way to check if the settings are correct is to issue an M122 p200 and check that the configuration matches your board. The current best source for the available settings is the configuration source: https://github.com/gloomyandy/RepRapFirmware/blob/v3.01-dev-lpc/src/LPC/BoardConfig.cpp#L33

Version 3.1.1-14
=============
This version contains only two change...
* Fix for a bug that can result in changes to the PWM output used for Fans/Heaters not being made if the frequency of the output is changed at the same time. Often this willoccur the first time that the speed is set.
* The Ethernet build no longer has support for LCD displays enabled due to memory limitations.

Version 3.1.1-12
=============
This version contains a number of fixes and minor improvements following user testing.
* Detect ADC problems and attempt to fix them. In some situations the ADC does not seem to start operation correctly after reboot. This results in very high (2000 degrees plus) temperature readings. This change attempts to detect this and restart the ADC.
* UART 3 support is now enabled by default. This allows the WiFi UART interface and PanelDue to be used at the same time on some hardware (BTT SKR V1.4).
* Fix firmware reset caused by division by zero when setting the PWM frequency to zero.
* Added Azteeg X5 mini v2 and MKS SGen L (thanks to Jay_S).

Version 3.1.1-9
=============
This version contains changes to allow the updating of ESP8266 WiFi firmware via the serial port interface. Note that to use this change may require hardware changes to any adaptor boards you are using. Also includes updates to the USB serial port implementation to reduce memory and improve performance.


Version 3.1.1-8
=============
This version contains one major new feature, support for TMC2209 devices which includes stall detection and sensorless homing. However it also includes a number of other changes (some to support the TMC2209 feature, others to fix bugs or improve other features), these are detailed below:
* New board.txt setting stepper.TmcDiagPins = {<pin 0>, <pin 2>, ...} This setting is used to provide details of the pins used for the TMC2209 DIAG output. This must be provided for the drivers which use stall detection/sensorless homing. By Default no pins are defined.
* SerialUSB Writeable now returns the number of bytes that can be written. This will hopefully fix some of the watchdog timeouts caused by the firmware attempting to write data when no program was consuming the output. There may still be problems with debug output.
* New software PWM implementation. This new implementation has a lower overhead then the original version and is more robust to situations in which the timer is set to times that have already passed.
* Fix watchdog timeout caused by PanelDue or other serial devices. This was caused by by the PanelDue output generating framing errors that were not cleared when enabling the UART.
* DMA completion interrupts. These have been reworked to allow devices to use completion interrupts that are called at a different interrupt level to that used by the main DMA device. This in turn allows us to use a higher priority interrupt for the DMA devices itself while still allowing the use of DMA with devices that make use of RTOS scheduling.
* Various build system changes. The new TMC2209 driver is now located in the LPC specific part of the tree, the build scripts have been updated for this and to preserve the map files for debug use.
* Flash accelerator configuration. Previous builds used settings that are in theory invalid for the LPC1769 chip.
* Zero allocated memory. Allocated memory was previously left uninitialised, this could cause unpredictable results in some situations.
* Adjusted interrupt priorities. This allows the TMC2209 driver to run the serial communications (via the software UART) at a higher baud rate, which allows changes to stall detection, motor current etc. to propagate to the drivers more rapidly.
* Increased GCode buffer size from 101 to 201 bytes to match Duet settings.
* Various debug enhancements, allow better stack capture/display, pwm debug display, USBSerial display.

Version 3.1.1
=============
* Updated to include bugfixes from DC42
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ constexpr size_t RepRapPasswordLength = StringLength20;
constexpr size_t MediumStringLength = MaxFilenameLength;
constexpr size_t StringBufferLength = StringLength256; // Length of the string buffer used by the expression parser

#if SAM4E || SAM4S || SAME70 || ESP_NETWORKING
#if SAM4E || SAM4S || SAME70 || ESP_NETWORKING || defined(__LPC17xx__)
// Increased GCODE_LENGTH on the SAM4 because M587 and M589 commands on the Duet WiFi can get very long and GCode meta commands can get even longer
constexpr size_t GCODE_LENGTH = 201; // maximum number of non-comment characters in a line of GCode including the null terminator
constexpr size_t SHORT_GCODE_LENGTH = 61; // maximum length of a GCode that we can queue to synchronise it to a move
Expand Down
15 changes: 15 additions & 0 deletions src/Endstops/Endstop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@
*/

#include "Endstop.h"
#if SUPPORT_TMC22xx && HAS_STALL_DETECT
# include "Movement/StepperDrivers/TMC22xx.h"

void EndstopOrZProbe::UpdateStalledDriversState(DriversBitmap drivers) noexcept
{
// Poll all of the drivers we are interested in
while(drivers.IsNonEmpty())
{
const unsigned int index = drivers.LowestSetBit();
// calling GetLiveStatus will update the stalledDrivers bitmap
SmartDrivers::GetLiveStatus(index);
drivers.ClearBit(index);
}
}
#endif

// Endstop base class
DriversBitmap EndstopOrZProbe::stalledDrivers; // used to track which drivers are reported as stalled, for stall detect endstops and stall detect Z probes
Expand Down
3 changes: 3 additions & 0 deletions src/Endstops/Endstop.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class EndstopOrZProbe INHERIT_OBJECT_MODEL
void SetNext(EndstopOrZProbe *e) noexcept { next = e; }

static void UpdateStalledDrivers(DriversBitmap drivers, bool isStalled) noexcept;
#if SUPPORT_TMC22xx && HAS_STALL_DETECT
static void UpdateStalledDriversState(DriversBitmap drivers) noexcept;
#endif

protected:
static DriversBitmap GetStalledDrivers() noexcept { return stalledDrivers; }
Expand Down
7 changes: 7 additions & 0 deletions src/Endstops/StallDetectionEndstop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ StallDetectionEndstop::StallDetectionEndstop() noexcept
// Test whether we are at or near the stop
EndStopHit StallDetectionEndstop::Stopped() const noexcept
{
#if SUPPORT_TMC22xx && HAS_STALL_DETECT
UpdateStalledDriversState(driversMonitored);
#endif
return (GetStalledDrivers().Intersects(driversMonitored)) ? EndStopHit::atStop : EndStopHit::noStop;
}

Expand All @@ -46,8 +49,12 @@ bool StallDetectionEndstop::Prime(const Kinematics& kin, const AxisDriversConfig
// Note, the result will not necessarily be acted on because there may be a higher priority endstop!
EndstopHitDetails StallDetectionEndstop::CheckTriggered(bool goingSlow) noexcept
{
#if SUPPORT_TMC22xx && HAS_STALL_DETECT
UpdateStalledDriversState(driversMonitored);
#endif
EndstopHitDetails rslt; // initialised by default constructor
const DriversBitmap relevantStalledDrivers = driversMonitored & GetStalledDrivers();

if (relevantStalledDrivers.IsNonEmpty())
{
rslt.axis = GetAxis();
Expand Down
3 changes: 3 additions & 0 deletions src/Endstops/ZProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ int ZProbe::GetReading() const noexcept
#if HAS_STALL_DETECT
{
const DriversBitmap zDrivers = reprap.GetPlatform().GetAxisDriversConfig(Z_AXIS).GetDriversBitmap();
#if SUPPORT_TMC22xx
UpdateStalledDriversState(zDrivers);
#endif
zProbeVal = (zDrivers.Intersects(GetStalledDrivers())) ? 1000 : 0;
}
#else
Expand Down
10 changes: 8 additions & 2 deletions src/LPC/BoardConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ static const boardConfigEntry_t boardConfigs[]=
{"stepper.TmcUartPins", TMC_UART_PINS, &MaxTotalDrivers, cvPinType},
{"stepper.numSmartDrivers", &lpcSmartDrivers, nullptr, cvUint32Type},
#endif
#if HAS_STALL_DETECT
{"stepper.TmcDiagPins", DIAG_PINS, &MaxTotalDrivers, cvPinType},
#endif

//Heater sensors
{"heat.tempSensePins", TEMP_SENSE_PINS, &NumThermistorInputs, cvPinType},
Expand Down Expand Up @@ -145,12 +148,15 @@ void BoardConfig::Init() noexcept
FIL configFile;
FATFS fs;
FRESULT rslt;

// We need to setup DMA and SPI devices before we can use File I/O
NVIC_SetPriority(DMA_IRQn, NvicPriorityDMA);
NVIC_SetPriority(SSP0_IRQn, NvicPrioritySpi);
NVIC_SetPriority(SSP1_IRQn, NvicPrioritySpi);

NVIC_SetPriority(DMA_IRQn, NvicPrioritySpi);
#if !HAS_MASS_STORAGE
sd_mmc_init(SdWriteProtectPins, SdSpiCSPins);
#endif

// Mount the internal SD card
rslt = f_mount (&fs, "0:", 1);
if (rslt == FR_OK)
Expand Down
Loading

0 comments on commit 57e0143

Please sign in to comment.