Skip to content

2.2.0 - UPDI programming with just a serial adapter!

Compare
Choose a tag to compare
@SpenceKonde SpenceKonde released this 06 Jan 07:07
· 1426 commits to master since this release
2fd83a6

This is a huge release.
Undoubtedly the most exciting change is the addition of support for programming using just a serial adapter with a 4.7k resistor between Tx and Rx (many serial adapters already have a 1k resistor in series with Tx - in that case you'll want to connect a lower value resistor to total around 4.7k). Connect Rx to the UPDI pin, Vcc, and Ground and the new programmer option... and there you have it. And you don't have to fight with the strange problems that seem to plague jtag2updi, either.
Additionally, now, when uploading a sketch via UPDI, all "safe" fuses that are configured by a tools submenu (that is, those that could not result in the board being difficult to recover - namely BODCFG (setting BOD level higher that voltage you are running the device at) or SYSCFG1 (which is where UPDI vs Reset is selected - also unfortunately where EESAVE is). The main benefits are that you don't have to burn bootloader to change between 20-MHz-derived and 16-MHz derived clock speeds (a very frequent point of confusion). Al
Since fuses cannot be set through the bootloader, though you do still need to burn bootloader to change this if you are using Optiboot; options which require "burn bootloader" say so in the tools menu. Uploading through UPDI (with optiboot or non-optiboot option selected) always erased the bootloader (like classic AVRs) - but now the BOOTEND fuses also get set to match what is being uploaded, so at least the sketch will run.
Added digitalWriteFast() and digitalReadFast() - these take the same arguments as the normal version of these functions (though they do not do anything fancier than changing the output value; digitalWriteFast() doesn't switch the pullups on and off if the pin is input or turn off PWM), and the pin number must be a constant known at compile time (otherwise it is a compile error) - but it is lightning fast, optimizing down to a single instruction! Speaking of digitalWrite() related stuff digitalWrite() on an INPUT will also set the pin's OUT value, emulating the behavior of classic AVRs which a lot of code relied on
The Servo library now works correctly.
PWM on the pins controlled by TCD0 now works again (20 and 24-pin 1-series parts only)
Corrected PWM duty cycle calculations on TCD0 pins (they were slightly off, though barely noticable in most circumstances.
New special feature on the TCD0 pins only: analogWrite(pin,255) results in a steady high, and analogWrite(pin,0) a steady low - but without the brief glitch from stopping the timer for a few cycles. digitalWrite() on those pins will fully disconnect them from the timer (which does cause the glitch, of course).
On all PWM pins, reduced the potential for a momentary glitch when turning off PWM.
A lot of functions will now give a compile error if passed arguments which are constants, and not valid - such as writing to a non-existent pin, trying to set DACReference(VDD);, and so on. If it's not a constant, we can't catch it for you - but where we know that what you're doing is not going to work...the core will now try to point it out to you.

Enjoy!!

The "Source Code" link below is the manual installation version, megaTinyCore-2.2.0.tar.gz is the board manager version.