Some STM32-based boards may use multiplexed JTAG pins as IO. Up to now the `DISABLE_JTAG` option (defined in pins files) was only supported for AT90-based boards. This commit generalizes the code and adds support for boards based on STM32F1 and STM32F4.
The `binary.h` file required by `lcd/dogm/dogm_bitmaps.h` is not present in stm32duino environment. Binary macros are defined in `bit_constants.h` in stm32duino framework.
- Clean up the API to use a `static` class instance to adhere to Marlin convention
- Add `const` position data access for read/write
- Add Storage capacity to the interface
The current Marlin implementation relies on a timer interrupt to start the ADC conversion and read it. However in some circumstances the interrupt can be delayed resulting in insufficient time being available for the ADC conversion. This results in a bad reading and false temperature fluctuations. These changes make sure that the conversion is complete (by checking the ADC hardware via the HAL) before reading a value.
See: https://github.com/MarlinFirmware/Marlin/issues/11323
Enable the endstop interrupts feature for LPC176x boards. Although Smoothieboard chose to use non-interrupt capable pins for their endstops, and this has been copied by clones, so they can't use it.
An undocumented hw bug makes the UART lose chars when RX ISR is disabled, even for a very small amount of time. This happens when RX_BUFFER > 256, and the result is corrupted received commands. Solved by implementing pseudo-atomic operations on 16bit indices.
* Misc fixes and improvements
- Get rid of most critical sections on the Serial port drivers for AVR and DUE. Proper usage of FIFOs should allow interrupts to stay enabled without harm to queuing and dequeuing.
Also, with 8-bit indices (for AVR) and up to 32-bit indices (for ARM), there is no need to protect reads and writes to those indices.
- Simplify the XON/XOFF logic quite a bit. Much cleaner now (both for AVR and ARM)
- Prevent a race condition (edge case) that could happen when estimating the proper value for the stepper timer (by reading it) and writing the calculated value for the time to the next ISR by disabling interrupts in those critical and small sections of the code - The problem could lead to lost steps.
- Fix dual endstops not properly homing bug (maybe).
* Set position immediately when possible
Use macros that explicitly avoid double-evaluation and can be used for any datatype, replacing `min`, `max`, `abs`, `fabs`, `labs`, and `FABS`.
Co-Authored-By: ejtagle <ejtagle@hotmail.com>
Also simplify logic on all ARM-based interrupts. Now, it is REQUIRED to properly configure interrupt priority. USART should have highest priority, followed by Stepper, and then all others.
This is an initial cut for feedback, updated for 2.0.x.
Chamber temperature is currently reported along with hot end and bed
temperatures to serial. The format is just like that used for hot end
and bed temperatures, but using 'C' prefix. As there is no heater,
target is always 0. Is this appropriate, is there a better way to report
chamber temperatures?
Chamber temperatures are not reported on the LCD in any way.
When auto chamber fan is enabled, it currently just uses the same
temperature threshold as the other auto controlled fans.
As the chamber temperature is not connected to any heater, it doesn't
undergo mintemp/maxtemp monitoring. This would need to change in the
future if chamber heating became a feature.
The `_O2` attribute is no longer needed on the malyanlcd function, and the macros have broken timer numbers - reset this to a function to return the right device. Also fix the bit order cast in SPI.
- Watchdog reset during SD Card initialization.
- Move `DebugMonitor` to `DebugMonitor_Due.cpp`.
- Since the watchdog is enabled on boot do extra resets during init.
- Have `thermalManager` do watchdog reset before its ISR starts to prevent reset.
- Ensure that timers are stopped before reprogramming them to address tone issues.
- Improve SAM3XE reset when reflashed through the native port.
added device & comm drivers for shared SPI LCDs
mistyped some updates in ultralcd_impl_DOGM.h
remove unwanted changes in onfiguration.h
still can't type
Update HAL_LCD_class_defines.h
include USB mass storage & misc
* Work around for serial buffer over run
PronterFace sends a lot of M105 commands. During long operations such
as UBL's G29 P1, G29 P2, G29 P4 and G26 this can over run the serial
buffer. This results (very often) in a M1 (actually a M1M105) ending
up in the command queue.
Until we figure out a better way to resolve this issue, this will keep
the UBL commands from experiencing bogus commands at thier completion.
Some to correct missing files from previous PR to completely avoid
HardwareTimer Class (reduce overhead). Some changes to formatting.
Changes to DMA ADC to work correctly.
Change to F1 sanity check.
* Fixing the DUE serial port assignments: Now -1 means the SAM3x USB Device emulating a serial port, and 0 means the USB to serial adapter included as a programming port
* Improving the Fast IO port access implementation on Arduino DUE
* Implemented EEPROM emulation on Due by storing data on the internal FLASH (with wear leveling)
* Implemented a Software SPI for the ST7920 graphics display for the Arduino RAMPS for DUE, as the default one in u8glib is clocking data too fast on ARM, and the display does not understand it.
* Fixing the case where the serial port selected is the USB device
* Adding configuration for the Makerparts 3D printer (www.makerparts.net)
* Tuned MakerParts acceleration on X and Y axis so it never loses steps. Also adjusted pulses per mm to match default hw configuration
* Fine tuned Maximum acceleration for MakerParts printer
* Style cleanup
* Style cleanup (2)
* Style fixes (3)
* Fixing the DUE serial port assignments: Now -1 means the SAM3x USB Device emulating a serial port, and 0 means the USB to serial adapter included as a programming port
* Improving the Fast IO port access implementation on Arduino DUE
* Implemented EEPROM emulation on Due by storing data on the internal FLASH (with wear leveling)
* Implemented a Software SPI for the ST7920 graphics display for the Arduino RAMPS for DUE, as the default one in u8glib is clocking data too fast on ARM, and the display does not understand it.
* Fixing the case where the serial port selected is the USB device
* Adding configuration for the Makerparts 3D printer (www.makerparts.net)
* Tuned MakerParts acceleration on X and Y axis so it never loses steps. Also adjusted pulses per mm to match default hw configuration
* Fine tuned Maximum acceleration for MakerParts printer
* Style cleanup
* Style changes to u8g_dev_st7920_128_64_sw_spi.cpp
* Even more improvements to the FastIO HAL for DUE. Now WRITE() is 2 ASM instructions, if value is constant, and 5 cycles if value is not constant. Previously, it was 7..8 cycles
* After some problems and debugging, seems we need to align the interrupt vector table to 256 bytes, otherwise, the program sometimes stops working
* Moved comments out of macro, otherwise, token pasting does not properly work sometimes
* Improved Software SPI implementation on DUE: Now it honors the selected speed passed to spiInit(). This allows much faster SDCARD access, improving SDCARD menus and reducing latency
* Update u8g_dev_st7920_128_64_sw_spi.cpp
* Disabling EEPROM over FLASH emulatiion if an I2C or SPI EEPROM is present
* STM32F1 HAL
Adding files for STM32F1 HAL based on libmaple/stm32duino core.
Current persistent_store uses cardreader changes to be sent in separate
commit, but could be changed to use i2c eeprom.
There is another persistent_store implementation that uses the MCU flash memory
to emulate eeprom
Adding readme with some information about the stm32 HAL.
* Switch to Timer4 to avoid a hard reset on STM32F103C6 boards
On bluepill STM32F103C6 boards, using Timer5 results in a error() vector call. Switch to 4 since these are both general purpose, 16 bit timers.
* Add support for EEPROM emulation using Flash
Some low end machines doe not have EEPROM support. Simulate it using the last two pages of flash. Flash does not allow rewrite between erases, so skip writing the working version if that's enabled.
* Basic Pins for a malyan M200
This is a work in progress to go hand in hand with the STM32 work.
* Add support for ADC with DMA. This work has exposed a problem with the pin enumerations in STM boards vs what marlin expects (i.e, try defining PA0 as a temp pin). The hack can be removed with we go to fastio completely. To see this work, set something in adc_pins to a value like PA0 and connect your pullup resistor'd thermistor.
* Missing file - change HAL_adc_init to actually do something
We have an actual ADC init function now.
* Remove pinmode hack
Remove the pin mode hack that I was using to init PA0.
Updated Readme.md
* Several changes to timers and GPIO
Faster GPIO, and faster timer functions by accesing registers and
libmaple.
Still more changes pending for the Timer's code to skip using the
HardwareTimer class altogether.
Switch all enums to be within #defines
This change allows a user to have, for instance, TEMP_4 and TEMP_BED definied but nothing else. The enums which are not defined move "out", allowing the first ones to take the slots in the enum, and since the array is sized on ADC_PIN_COUNT, we always have the right size data and in order.
* Update Malyan M200 pins
Update Malyan M200 pins with correct fan values.
* Test all pins on actual hardware, update definitions
Some of the pin definitions were from knowlege base/pdfs. Now they've been tested against actual hardware. This should be very close to final.
* Update HAL_timers_Stm32f1.cpp
* Add sample configurations for Malyan M200
Add sample configuration for Malyan M200 without bed leveling, and move fan to auto cool E0 since this printer by default has only one fan.
Choose the timer based on MCU defintion. Timer5 is not valid on C8/CB class boards, so use Timer4 for the step timer.
readme.md update
* Updates to timers, and some stm32 boards definitiions
* Correct pin toggle macro.
* Remove duplicated Malyan M200 entry from pins.h
* Update configuration_store.cpp
* Formatting, indentation
* Formatting in HAL_Stm32f1.cpp
[2.0.x][LPC1768][FIX] NUM_DIGITAL_PINS was negative, fixes PWM, arduino io functions, M42, M43, M226, probably also Servo, some LCD, soft spi, SoftwareSerial, ... may be others
include LPC1768 syntax for M42
couple more pin_t changes
consistency
change M42 to R, P format
Revert "change M42 to R, P format"
This reverts commit 01f12f579ec9ccc1bb9126e68d2c86449e9b7edf.
LPC1768 VIKI2 & RRDFG are working
looks like all SPIs are working
library change
sh1106 locks up
fixed lockup, started I2C SW com
pretty
re-org
restore a few files
make library happy
switched HAL version of rrd
fix travis error
travis error fixes
another travis fix
cleanup
minor update
one more
correct spacing in platformio.ini
This is the ONLY way to be able to override ISRs stolen by the Arduino Runtime, such as Serial or USB device interrupts. This feature is needed so Arduino modules can be replaced and enhanced.
* Merging early because of build failures. See #8105
* Make LPC1768 pinmapping not specific to Re-ARM
* Add HAL_PIN_TYPE and LPC1768 pin features
* M43 Updates
* Move pin map into pinsDebug_LPC1768.h
* Incorporate comments and M226
* Fix persistent store compilation issues
* Update pin features
* Update MKS SBASE pins
* Use native LPC1768 pin numbers in M42, M43, and M226
* Enable hardware serial ports on LPC1768
* Fix compilation errors with other HALs
* FIx order of includes in LPC1768 HAL main.cpp
* Add support for RX_BUFFER_SIZE and TX_BUFFER_SIZE options in Configuration_adv.h
* Get UBL Mesh Generation, Mesh Save & Mesh Load working with 32-Bit platforms
* clean up read_data() and write_data() for non-LPC1768 HAL's
* Get read_data() and write_data() return codes consistent
All HAL's read_data() and write_data() return false if they succeed.
* Get read_data() and write_data() return codes to be consistent
Make read_data() and write_data() return true if an error happens.
* Say UBL is now checked out on machine types in default Configuration.h file.
* Add files via upload
* Add files via upload
* Add files via upload
* Checked LCD / edited / revised pins_MKS_BASE.h
As requested :)
* Delete Configuration_adv.h
* Delete Configuration.h
* Deleted /Marlin/Marlin/src/config/examples/MksSbase/*.* and moved them to /Marlin/Marlin/src/config/examples/Mks/Sbase/*.*
* Add files via upload
This change initialize any data in eeprom.dat beyond the current file size to FF.
That way if eeprom.dat is deleted and created again, it doesn't take the old values or random ones, but rather starts with FF in all positions as a real brand new or erased eeprom.dat
Currently if you delete eeprom.dat and restart the board, the new file is created in the same sector with the same content, since FAT does not actually delete the data, just marks the sector as free. I tested by deleting the file, and then rebooting the board, and checking the file content.
The change can be tested in the same way, deleting, rebooting the board, and then the new content should be all FF.
If an eeprom file already exist with data on it, but smaller than E2END, it will be padded with FF on first access, so it will not have random or old content appended.
* fixed some include paths
* LPC1768: Fix Serial API
Add missing serial methods used if TX_BUFFER_SIZE is set
Change return value of HalSerial:read to match Arduino API
* LPC1768: add filters to ADC
This is to try and compensate for hardware issue and oversensitivity to noise
* LPC1768: remove the polling section of delayMicroseconds
* LPC1768: lock usb mass storage device while device accesses it.
Currently only applicable to persistent store,
The device always has priority and will unmount the sd card from the host, Windows then tries to automount again so it can look like the explorer window freezes. Linux Mint, by default, just closes the Nemo window.
* Add timeout to make sure if Serial never connects that Marlin still boots
* Remove unneeded ifdef CPU_32_BIT
In general the need for ifdef CPU_32_BIT blocks means that something is missing from the HAL API or a Platform, in this case HAL_TICKS_PER_US was missing from the AVR Platform
* LPC1768: relocate RE-ARM debug_extra_script.py
Adding files for STM32F1 HAL based on libmaple/stm32duino core.
Current persistent_store uses cardreader changes to be sent in separate
commit, but could be changed to use i2c eeprom.
HardwareSerial has been tested on Uart0 (debug header) and Uart3 (i2c connector)
Software Serial has been tested to work bi-directionally at 9600 and 115200
using pins 6 and 63 on J5, and unidirectionally (write only) at 250000.
The code used to test was Teemuatlut's tmc2208 patch, and a few small changes to main used to echo recieved chars back to a host pc.
Uses PWM1 to directly control pins 4, 6 & 11 (servo 0, 1 & 3) and PWM1
generated interrupts to control other pins.
Interupt control of the servo pins had too much jitter so switched all
that we could to PWM1 direct control. The PWM1 direct control pins have
less than 1 microsecond pulse width jitter while the interrupt
controlled ones can have 20+ microseconds of jitter.
Also added insurance to the servo code in the "disable servo after move"
section.
* LCD_UBL_memory_slot_corrections
Changed the memory slot edit function to work with the
`settings.calc_num_meshes()`
* Add a little more safety margin...
* More corrections
Error handling when the EEPROM is not available.
This reverts commit 2dfa6ca72a2e8d43caf4932ca0d35792f0638917.
Revert "Base HAL SPI Changes"
This reverts commit 2afc521b8b6a81b2281a038f1b99a69f4a008e64.
Revert "Initial HAL SPI API"
This reverts commit 58f7ffe09ab5bc034b6510f5204f8d342138abaa.
Re-ARM has been tested. AVR has not been tested.
1) moved all cpu specific items to files in the low level HAL directory
for that CPU (pinDebug_Re-ARM.h & pinsDebug_AVR_8_bit.h
2) added pinsDebug.h to the top level directory
3) modified HAL_pinsDebug.h to select the correct support file for the
selected CPU
4) Patched sanitycheck to stop throwing false errors. A long term
solution will be done
5) misc changes & bug fixes
arduino.cpp - included macros.h to fix a missing definition
pinmap_re-arm.h - removed a duplicated line.
pinmapping.h - changed from "ENABLED" to "defined" to fix a compile
error
======================================================================
split SanityCheck up, improve pinsDebug system
======================================================================
switch to latest pins_RAMPS_RE_ARM.h