Releases: SpenceKonde/megaTinyCore
2.6.10 - Critical Bugfix
This corrects an error in packing the toolchain for Windows that caused a failed CRC on installation,
This release also contains fixes for a number of warnings that had snuck into some libraries and examples, and corrects ADCPowerOptions constants on non-Ex-series parts.
2.6.9 - A general pack of fixes
Yeah - This one is bugfixes and better docs. This is a new packaging script so there may be some delays in getting the board manager package out.
- Bugfix: optiboot_x.c that has been in use since newyears day 2023 was never committed.
- Bugfix: Remove boot_opt.h which is not applicable to modern AVRs.
- Bugfix: Remove the useless dummy app that forced us to use avr-size -A to see the size of the bootloader separated from the app, and switch avr-size -A to normal avr-size to take advantage of this.
- Maintenance: Rebuild all bootloader files.
- Bugfix: The recently introduced entry condition functionality of Optiboot was busted.
- Maintenance: Rebuild all bootloader files again.
- Bugfix: Correct issue with missing getAnalogReadResolution function body.
- Bugfix: Ensure that the default parameters in boards.txt for 8-pin parts are defined boardwide, rather than for the default option, because people on PIO don't know when new options are added, or that all options are expected to be included. This was done for most - but not all - parts.
- Bugfix: Azduino7 toolchain for windows had excessive bloat (duplicated files - which raises some questions about the BZIP2 algorithm. (note that if arduino knew how to deal with .tar.xz (LZMA), the toolchain download would be 1/3rd the size!), and all platforms had bad copies of eeprom.h and power.h.
- Enhancement: Improve error messages when third party IDEs like PIO allow people to specify more than one millis timer, which would then fail to compile (#1002).
- Maintenance: Work around CLI regression by specifying cli 0.33.0 for the CI.
- Enhancement (contributed): Merge in support for using XDIR and RS485 (custom optiboot build only).
- Enhancement: Add a test to the start of twi_pins.h that will allows it to be carried to another modern AVR core that doesn't provide badArg and badCall. Add CORE_HAS_ERRORFUNS #define.
- Enhancement: Add
_digitalPinToCanon()
to convert pin numbers to(port * 8) + bit_position
, will be needed to address recently reported shortcomings of the SPI library surrounding interrupts. - Documentation: Many, many improvements to reference docs.
- Documentation: Move the errata tables to a google sheets spreadsheet. The table was beyond markdown
- Packaging: Do not delete the entire extras folder, only .png/gif/jpg/jpeg files and the subfolders, when making the board manager versions.
2.6.8 - CRITICAL BUGFIX
2.6.7 broke compile for microchip boards and 1-series parts. This should correct these problems (introduced by the PWM menu in 2.6.7; Note that prior to this,at some point in 2.6.x I had started but not completed work on that feature, and I suspect pwm problems were present in 2.6.6 and earlier that had not been reported on higher pincount parts
This version also fixes behavior of tinyNeoPixel at some (high) clock speeds, and adds an updateLatch() method to let you change the latch timeout (which prevents fast calls to show() from breaking), since the library defaults to the 50 that the datasheet specifies, but it's unclear whether any leds with a 50us timeout actually exist or ever existed: the original ones actually only had a 6us latch timeout, while followon parts have in some cases been willing to wait a whopping 200 us, maybe even 250us, between bits without latching.
megaTinyCore.h library gets a number of fixes and corrections, and more of these examples are now tested so that we don't have examples calling functions that don't exist or calling them by the wrong names.
The analog documentation for getAnalogReference and the table of reference ID's was corrected to reflect megaTinyCore instead of DxCore.
getAnalogReference was also, in fact, missing from wiring_analog.c. This is corrected.
2.6.7 - Doubleheader release, combined 2.6.6 (which was skipped) and 2.6.7
2.6.7
- Add menu to select which set of PWM pins to use (there are a huge number of configurations on 24 pin chips, a few on 20 pin ones, and like 3 everywhere else. This covers both the TCA0 and TCD0 pins and allows setting the TCA pins to operate in buffered mode (with only 3 channels).
- Fix issue with the change to the comparator and logic libraries so it actually lets you make your own ISR.
- Bugfix - Change clockCyclesToMicroseconds, microsecondsToClockCycles, and clockCyclesPerMicrosecond back into macros instead of inlinable functions, as some libraries depend on them being valid constexprs (which an inlinable function is not)
- Bugfix - pinModeFast will now turn off pullups if they're on when a pin is set to output. otherwise, the result could be highly problematic. For example, a situation I ran into: I had a keypad matrix, 4x4, rows set input pullup, columns set output, low. The device woke up when a button was pressed, which pulled the row down. At that point (while the button was still pressed - wake is slow on computer timescales, but very fast on human ones), I would read the pins, and then swap the pin modes, so the rows were output-low, and the columns were input pullup. One of the columns would thus be pulled low through the depressed switch, I'd read the columns, combine the two. Since this was happening in an ISR, hence should be fast, I used the pinModeFast function (and direct port reads, since I cared about a whole nybble of each port). Then I'd set the rows back to input_pullup and the columns back to output, low, and then enter power-down sleep mode. However the pullups on the columns (output, low) were still on. While the effect on battery life was non-catastrophic (it had a several hundred mAh rechargeable battery, and the excess load was a little under half a milliamp, so the battery life would be expected to be nearly a month. But without the driven-low, pullup-enabled pins, the current was below my ability to measure (datasheet says typical 0.2uA - so it was about 2000 times expected). This is no longer possible - pinModeFast(pin, OUTPUT) will turn off the pullups on the pin if they're on. pinModeFast is now a 6 word 7 clock function in this case, which is disappointing, but I think this would catch more people than the number of people who need e
- Remove optimization menu as it was found to be incompatible with our implementation of Serial, and I had not a clue how to fix it but could see well enough that this would have required generating horrendously bad code. At some future time, a menu might go in there, but the options have to work. ()
- Enhancement: Choose PWM mapping pins from tools menu!
- Bugfix: printHexln was spelled printHexLn in keywords.txt
2.6.7 addendum (stuff belived released with 2.6.6 which was never a release)
Enhancement/bugfix: 2.6.5 was intended to add an optimization level submenu. Due to a typographical error, the menu was not shown (though no harm was done). That menu is now actually available.menu has been removed, it caused issues- Enhancement: Add a few more macros for getting information on peripherals and updated define reference.
- Critical Bugfix Correct regression in Wire.h regarding master+slave mode
- Bugfix: Attached pin interrupts on parts with less than 128k of flash were wasting 2 clocks before the user code was called and 3 clocks after, as well as 4 bytes. Small potatoes compared to the overall overhead of that abomination, but there's no need to push RAMPZ if there isn't a RAMPZ register (it reads as 0 and writes to it are ignored - so there was a donothing in/push and pop/out on parts without RAMPZ. And no tinyAVR parts have a RAMPZ.
- Bugfix: pinConfigure would under some circumstances fail because of a misspelled variable
- Bugfix: gcse was incorrectly left off at one step (whereit had little if any impact on flash use) regardless of the menu setting (which coulod not be changed anyway)
2.6.5 - Improved bootloaders, assorted fixed new optimization options
This adds:
Whole new set of bootloader entry conditions, similar to what DxCore now has.
A number of assorted changes directed at performance and flash size.
We also get the new version of pinConfigure(). This version allows you to pass an arbitrary number of arguments. They will be automagically combined instead of you having to use the less natural chain of bitwise or's.
Several bugs have been fixed involving sampled BOD, some missing bootloaders for certain Microchip boards. A but that caused problems with reads via SerialUPDI is fixed. A few stupid UART bugs were fixed, like half duplex being broken on UART0, receive being broken on UART1 (both due to analogous mistakes - the UART0 and UART1 specific files were copy/pasted, and in key places, I missed the place where I was supposed to change the number of the USART.
Aaand we add an optimization level menu. This is not really that useful if you're not able to make sense of assembly listings. You can choose the normal -Os, or -O3. For either option, GCSE can be enabled or disabled. This is an option because it makes a non-negligible difference in the size of some sketches. The problem is.... it's about even money which direction the size will move in. Effects of any change in the tool submenu options or changing the chip also impacts the extent to which this helps or hinders. Unfortunately, the magnitude of this is large enough (5% was seen) that we can't really ignore it. So when you really need a little bit more flash, you can always check if this will help you. It's unlikely to make much difference, but for around 10-20% of sketches seemed to benefit at least modestly, about half that suffered modest increase in binary size, and the majority gained or lost a few instruction words.
2.6.4 - let's try once more....
Because 2.6.2 couldn't be installed, the CI scripts couldn't run, and as a result 2.6.3 was bad because no testing had occurred on it.
This fixes a few (largely minor, aside from a widespread compile error) issues with 2.6.3, and also at the request of a user, adds support for configuring the watchdog timer to be forced on via the fuse (easy feature to add); though obviously I will note that unless you understand why you need the watchdog timer to keep the sketch from getting into a bad place, turning on the watchdog timer to force resets is the wrong approach. You should figure out what is going wrong, and then decide whether it is a bug you could fix, or is a condition forced on you by surrounding conditions, and hence . Note that this feature is only available for non-optiboot selections, because optiboot makes heavy use of the watchdog timer, and at best will have the wrong timeout, and at worst could fail entirely if the WDT is forced on.
2.6.3 - 2.6.2 re-release.
This release replaces the 2.6.2 release, which referenced the incorrect version of the toolchain. That version does not exist and cannot be downloaded.
It also fixes some issues in Comparator and pulls in assorted documentation improvements.
2.6.2 - Critical bugfix to "burn bootloader", and Wire fixes
2.6.1 contained a bug that prevented "burn bootloader" from working correctly. This is corrected.
This version also contains a further-improved version of Wire, as usual, thanks to the hard work of @MX682X who did a considerable amount of work to ensure that sleep functioned correctly on I2C slave devices. including testing on an astounding scale to verify the absence of cursed intervals during which an attempt to talk to the device would instead lead to it dragging down the bus until a reset or power cycle (most people who have worked with I2C have met at ke. There are a few new hacky ugly bits too (namely, the compile time errors for clearly wrong values passed to pins() and swap() are back - they were lost with the wire rewrite a while back, and the there is now an option to configure the hodge podge of strange compatibility options that the TWI of modern AVRs has. This is mostly directed towards the Dx-series, where the SMBus levels enable communication with newfangled sensors with 1.8-2v logic levels even without using MVIO - this version of Wire is identical to what will be in the next version of DxCore, but this also lets you configure hold times if you need to work with something that is designed such that it requires meeting SMBus specs), and when some part is being uncooperative, gives you some the two timing-related knobs to turn in the hopes of fixing it).
Half duplex serial should now work correctly.
The documentation has been improved.
Warnings associated with the Event library on some parts are corrected.
Some newly added or altered functionality was not getting proper keyword highlighting.
2.6.1 - What 2.6.0 was supposed to be
Okay, so 2.6.0 didn't work out very well. Hopefully this will work better, but the debacle brought down CI testing, which needs to be able to install the last release, so there may very well be problems that it would have caught, had 2.6.0 not been an unmitigated disaster.
The big Bugfix/enhancements from 2.6.0/2.6.1 are:
- Serious issues in Event for tinyAVR 0/1-series parts have been corrected, and the logic and comparator libraries can now (by not touching ComparatorN.attachInterrupt(), manually define an interrupt with attachInterrupt. The same goes for Logic (though with the CCL , all the LUTs share one ISR).
- Bugs relating to waking from sleep modes other than idle (which is the "why am I bopther with this" sleep mode that barely saves any power) while acting as TWI slave have been fixed and it now wakes reliably from all sleep modes, including TWI address match (which is one of few privileged things that can wake from power down sleep mode]
- A pair of enhancements to serial from completely different angles have been added:
- Thanks to the work of @MX682X we have been able to take yet another piece of the disastrous Arduino API out behind the woodshed to get what it deserves. By reworking the class hierarchy, we have slashed the number of flash wasting virtual member functions, which the compiler is required to generate even when they are never called. The savings is on the order of around 500 bytes. That's not going to excite people working with 32k parts, but we absolutely do have users on 2k and 4k parts for whom 500 bytes is a great blessing.
- That is in spite of my adding functionality to Serial: getStatus(), autobaud support see the [serial reference] (https://github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/Ref_Serial.md) and should now automatically dodge the SFDEN errata so you should be able to wake on that.
Full list of changes:
- 2.6.0 Bugfix: Correct several USART bugs that snuck through, including an apparent regression that would prevent proper serial operation.
- 2.6.0 Bugfix: Azduino5 was no good. Same filesystem structure error as usual, moved to Azduino6.
- 2.6.0 Bugfix: The 4000 lines of workarounds for compatibility issues introduced by the toolchain update didn't make it into the megaTinyCore release.
- 2.6.0 Bugfix: The platform.txt file had been trashed by a bungled merge and tried to upload based on params that didn't exist.
- 2.6.0 Bugfix: Correct an include path that confused some alternative IDEs.
- 2.6.0 Bugfix: Correct compile error involving RS485 USART configuration.
- 2.6.0 Bugfix: Comparator library namespace error fixed. (thanks @ObviousInRetrospect)
- 2.6.0 Bugfix: Advertised 2 MHz internal option was not actually available in non-tuned configurations. Prior to 2.6.0 there was no intent to support this.
- Enhancement: millis with a type B timer is over 25% faster, and uses 30% less flash for the ISR. (thanks @MX683X)
- Bugfix: Correct a few anomalies in boards.txt.
2.6.0
- You can now enable and disable the ADC with analogPowerOption() and enable/disable standby mode.
- Bugfix: Fix issue with SSD bit being cleared when using beginTransaction().
- Bugfix: Fix bug in Logic with pin inputs being handled improperly.
- Bugfix: Remove multiple signatures for Wire.requestFrom to fix issues with Wire with certain libraries.
- Bugfix: Correct tuning, particularly to speeds below 16 MHz. Boards should be re-tuned if 14 MHz-derived speed is to be used
- Bugfix: Correct default option for Optiboot 2-series boards with 20 pins to be the one with alt reset.
- Bugfix:
long_soft_event
method did not work correctly. - Bugfix: Removed attempted optimization by inlining analogReadEnh; I had wrongly assumed that it would then not inline the call to
_analogReadEnh
. Well, it wound up inlining it, with the result being exactly what I had hoped to prevent. I don't think this made it into a release. - Bugfix: Event was not functioning correctly on tinyAVR parts.
- Bugfix: Correct bug(s) when waking from sleep mode via TWI (aka I2C/Wire) address match (Thanks @MX682X. You are one of our MVPs). TWI slaves should now reliably wake on address match and other wake sources from all sleep modes.
- Bugfix: 3224 optiboot maximum upload size was same as 1624. Oops.
- Bugfix: Microchip boards in optiboot mode (admittedly a rare mode) were not subtracting the size of the bootloader from the chip capacity.
- Enhancement: Lay groundwork in Event library for the new event system changes in the EA-series (There will be 2 generators per port, and 2 for RTC - but all of these will be accessible by all event channels, and a register on the peripheral controls which of the options is used for these two channels). While inapplicable to tinyAVR, Event.h and Event.cpp distributed with DxCore and megaTinyCore is identical.
- Bugfix: Fix compatibility of Comparator, Event, and Logic.
- Workaround: mysterious issues with detecting the major version that prevented manual installation ever since 1.8.14. I kept hoping that the next version would fix it, but, no such luck. It still impacted used on 1.8.19 and likely future versions as well.
- Major enhancement: Change class hierarchy for UARTs, as was done for Two_Wire (Wire.h), so that rather than pulling in api/HardwareSerial.h, and subclassing that definition of HardwareSerial (itself a subclass of Stream) as UartClass, we instead simply subclass Stream directly. UART.h will be renamed to HardwareSerial.h, HardwareSerial.h (a compatibility layer) will be renamed to UART.h and the latter adjusted to #define UartClass as HardwareSerial, and api/HardwareSerial.h will be gutted and simply #include <HardwareSerial.h> This will remove yet another piece of the disastrous "ArduinoAPI". I describe it as such because on low resource platforms like AVR; this will allow several functions currently declared virtual to lose that keyword, as the linker, even with LTO enabled, is not permitted to remove unused virtual functions. This reduces binary size when using serial significantly, despite significant new features. Credit goes to @MX624X.
- Enhancement: Split up the Event and Logic library headers for improved readability.
- Enhancement: RTC millis does not interfere with waking on RTC compare match. (PR #793)
- Enhancement: great deal of harmonization with DxCore.
- Enhancement: Improvement to stream timed read to make it work when millis is disabled, and to save 4 bytes of RAM. Note that this also requires all offsets used to access the Serial transmit and receive buffers to be reduced accordingly in the inline assembly in UART.cpp.
- New Feature: Now you can use ADC1 just like it was an ADC0, see the notes in Analog Input (ADC) and output (DAC) for steps required to enable it. This does not use space if not enabled.
- New Feature: Add new functions to assist checking error codes in analogRead results.
- New Feature: Permit Logic and Comparator ISRs to be defined manually if (and only if!) the
.attachInterrupt()
method of an instance of that class is not called. You can then manually create the ISR saving about 40 bytes and 50 clock cycles, give or take. - New Feature: megaTinyCore.h now provides functions to reset chip via WDT timeout and via software reset. If optiboot is used, the former will not run it, while the latter will.
- New Feature: Add option for serial autobaud use, record cumulative errors USART has encountered and provide method to view and clear them.
- New Feature: Support SFD to wake on USART. User is otherwise responsible to configuring this and should be aware that in order to be able to receive the characters, we turn it off after receiving a character.
- Docs: made clear om PowerSave.md that the ADC must be disabled to get low standbby current.
- Docs: Add link to my article on AVR math speed (TLDR: avoid
int64_t
long long
like the plague) - Docs: Fix many documentation issues, improve docs generally.
- Docs: Expand documentation significantly, and document the new serial features.
- Unenhancement: Remove getAnalogSampleDuration(), as I could not make anything compile with that in and had worked on it over a day.
- Enhancement: 2 MHz is now a supported clock speed.
2.6.0 withdrawn, 2.6.1 will be released soon.
Hence 2.5.11 is again latest.
This fixes two critical bugs that were present in 2.5.10.
- First, and foremost, it fixes the attachInterrupt bug with the new implementations.
- Secondly, It fixes a related issue in the SPI library which led to horrible bloat of the SPI library; this was intended to go in at the same time as the attachInterrupt changes, but the porting from DxCore was missed. It removes support for disabling a single specific interrupt only during an SPI transaction. Note that you are free to manually do so, and the result will take far less than the 800 bytes wasted by the general implementation. And could be used on any interrupt(s) not just a single pin interrupt that was attached (one should try to avoid attachInterrupt entirely if possible as it is both slow and inefficient. This allows the attachInterrupt changes to reap the full flash size benefits that motivated it.
Additionally few other significant changes went in:
- By unanimous demand of users (a large discussion yielded many voices in favor of this change, and not one against it), pinMode no longer emulates classic AVR behavior (where turning on the pullup set the output register, so when then flipped to output, the pin would be HIGH. The consensus in that thread was that a sketch relying on that behavior is in the thing acting in error.
- Fixes several issues with the compatibility macos provided to paper over microchip's crazed need to alter the names of their registers and bitfields without changing their function.
- The asset names for the Microchip board definitions was broken (exported hex/lst/map files)
- Apparently, a small number of libraries expect to be able to pick up our hardware serial class from HardwareSerial.h and expect the class to be named HardwareSerial - that's never been what it was called on modern AVR cores, however rather than being addressed at the core level, this was being handled on an adhoc basis by individual libraries - we now provide a "band-aid" header to fix this issue in the form of HardwareSerial.h - which #defines HardwareSerial to USARTClass and includes USART.h.
- Updates to tinyNeoPixel to improve technical correctness of assembly. During this investigation, I realized that while the timing cannot be made perfect, it can still be made good enogh down as low as 4 MHz. No, I'm not sure what someone would be doing running at 4 MHz with a string of neopixels connected - clearly they don't care about power consumption, because neopixels are power hogs even when off, and it is implausible that 8-10 MHz wouldn't be within spec at any voltage that would successfully drive neopixels - but the technical challenge was small and there was no penalty imposed on users running a other speeds.
- The API for the USERSIG libraries on the tinyAVR and Dx-series parts had been incompatible. It is now possible to write portable code for that library without #fdef's wrapping calls to USERSIG.flush() etc. Functions specific to the erase granularity (or lack thereof) of te DX-series parts were mirrored here. This is explained in detail in the USERSIG library docuementation.