You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ChangeLog.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Changes listed here are checked in to GitHub ("master" branch unless specificall
25
25
### Planned 2.6.11
26
26
* Pending: New toolchain version.
27
27
* Make wiring.c have the functions referred to in the doc.
28
-
* Fix some of the constants for timers so that all timers can still get uniform codes specifying the portmux and (for non-TCA's) which pin within the mux it is, which matters forthe other core.
28
+
* Fix some of the constants for timers so that all timers can still get uniform codes specifying the portmux and (for non-TCA's) which pin within the mux it is, which matters for the other core.
29
29
* Documentation improvements.
30
30
* Corrected bug sometimes encountered when using serial under atypical cases the causes of which remain mysterious), where it would complain about `__poll_dre_done`.
Copy file name to clipboardExpand all lines: megaavr/extras/Ref_Timers.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,9 @@ This document is divided into two sections. The first one simply describes the a
6
6
### tinyAVR
7
7
On the tinyAVR parts using megaTinyCore, there are no bad PWM pins - we don't use TCBs on mTC for PWM. Not worth the flash, not worth the clocks to check.
8
8
9
-
We support compiletime selection of alternate pinout sets for the PWM via the submenu option.
9
+
We support compile time selection of alternate pinout sets for the PWM via the submenu option.
10
10
11
-
You will see very small differences in flashsize when switching between pins because the routines to check pins for current PWM activity and findthe bit to clear to turn it off (which constitute a significat portion of the time taken for digitalWrite(), which is why we have digitalWriteFast(), see [Digital Reference](Ref_Digital.md))
11
+
You will see very small differences in flashsize when switching between pins because the routines to check pins for current PWM activity and findthe bit to clear to turn it off (which constitute a significant portion of the time taken for digitalWrite(), which is why we have digitalWriteFast(), see [Digital Reference](Ref_Digital.md))
12
12
13
13
### AVR Dx/Ex-series
14
14
PWM can come from a TCA or TCE, a TCB (of which these parts have 2 to 5), or - if present - a TCD or TCF. This is marked on pinout diagrams.
@@ -133,7 +133,7 @@ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
133
133
We have a separate [document entirely dedicated to TCD0](Ref_TCD.md)
134
134
135
135
### TCE - New in the EB-series
136
-
A 4-channel PWM timer otherwise very similar to TCA, except that it also has this bizzare contraption called Waveform Extension on it (which looks less than useful for most Arduino people). Up to 16-bit resolution with the debut of the old HiRes functionality from XMega: The chip has a PLL that runs at up to 80 MHz and if used, is generally run at 4x the system clock (ie, the 20 MHz internal oscillator is prescaled, kicked up to 80 MHz, which it subsequently divides down ) *no split mode!* Will be detailed in the documentation for DxCore, which intends to support those.
136
+
A 4-channel PWM timer otherwise very similar to TCA, except that it also has this bizarre contraption called Waveform Extension on it (which looks less than useful for most Arduino people). Up to 16-bit resolution with the debut of the old HiRes functionality from XMega: The chip has a PLL that runs at up to 80 MHz and if used, is generally run at 4x the system clock (ie, the 20 MHz internal oscillator is prescaled, kicked up to 80 MHz, which it subsequently divides down ) *no split mode!* Will be detailed in the documentation for DxCore, which intends to support those.
137
137
138
138
### TCF - Another new timer
139
139
Will be detailed in the documentation for DxCore, which intends to support those.
@@ -223,7 +223,7 @@ Note that while it does not currently impact any parts, there is a significant l
223
223
In the future EB-series, the timer priorities will have to be considered carefully.
224
224
225
225
#### Channels without pins
226
-
On some there exist channels that aren't connected to any pins. These can often be grabbed using the event system (however, this only is possible for the three single/16-bit mode pins, not WO3-5). You'll likely not find yourself struggling with pins having been dropped from the pincount you're using. While the Dx/Ex series parts have a grand unifying vision encompasing all modern AVRs since the tiny2, the tinyAVR pinouts are designed to make sense when you have 14-24 pins (The 8-pin modern tinies seem to have been abandoned almost as soon as they decided to make them. These days, with the competitive prices of the larger tinies, including in the 3mm x 3mm 20-pin QFN, it's hardto imagine someone getting these
226
+
On some there exist channels that aren't connected to any pins. These can often be grabbed using the event system (however, this only is possible for the three single/16-bit mode pins, not WO3-5). You'll likely not find yourself struggling with pins having been dropped from the pincount you're using. While the Dx/Ex series parts have a grand unifying vision encompassing all modern AVRs since the tiny2, the tinyAVR pinouts are designed to make sense when you have 14-24 pins (The 8-pin modern tinies seem to have been abandoned almost as soon as they decided to make them. These days, with the competitive prices of the larger tinies, including in the 3mm x 3mm 20-pin QFN, it's hardto imagine someone getting these
227
227
228
228
But you could set input0 of LUT2 to be TCA0, enable the alternate pin mapping for the CCL LUT2 output (CCL output is on pin 3 or 6 of the LUT's "home port"), mask the other two inputs and set the truth table to 0x02, and get TCA0 WO0 on PD6. 6 PWM channels! Hm? You need seven you say? Well, okay - you could use TCB0 as the input for a the CCL LUT0, 1, or 3, but instead of enabling pin output (since those pins don't exist, or in the case of LUT1 on PORTC are already being used), you would have to instead set one of the event channels to use that CCL LUT as it's generator. Event output can be piped to either pin 2 or 7 in a port. PORTD is your only good choice. Then you could set EVOUTD to be an event user for that channel, and switch it's portmux to the alternate pin, PIN_PD7. Now you've got 7 channels! You need *another*? You can actually get an 8th if you really work at it - but millis must be either running on TCA0 or disabled, you must have an HV UPDI programmer to reprogram it, otherwise the required fuse settings will brick it. You would have to disable the UPDI functionality (hence it cannot be reprogrammed without an HV programmer). That turns PF7, the nominal UPDI pin, into a GPIO pin (reset can be turned into an input, but not an output on the DD (and barely can in general) `*`) This has very few functions available - in fact it has only 2 special functions, the SS pin of one of the wacky SPI mappings on the DD-series... and the alternate output pin of EVOUTF! You can then repeat the process above with TCB1 and EVOUTF. And at that point you have 8 independently controllable duty cycles coming out of 8 pins on your 14-pin package, of which 3 pins are power or ground, and another of which (PF6/reset) is input only. So 80% of the potential output pins and more over half of the physical pins could be used to output PWM without even having to use some sort of software PWM scheme - once the duty cycles were set and the peripherals enabled, the PWM would be generated without CPU intervention. The two remaining pins could then be used as, say, a serial port so you could tell it what duty cycles to use or something.
0 commit comments