Skip to content

Commit c644309

Browse files
committed
trivial fixes/docs
1 parent 3eb095d commit c644309

6 files changed

Lines changed: 58 additions & 45 deletions

File tree

ContributionGuidelines.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ We have a largely self-consistent code style used throughout the core and associ
7272
| size | signed | unsigned | grudging | avoid | avoid | avoid | Notes |
7373
|--------|---------|----------|----------|-------|-------|--------------|-------|
7474
| 8-bit | int8_t | uint8_t | . | short | byte | . | Use uint8_t's whenever possible |
75-
| 16-bit | int16_t | uint16_t | size_t | int | word | unsigned int | C likes to default things to int16_t - this is often undesirable. |
75+
| 16-bit | int16_t | uint16_t | size_t | int | word | unsigned int | C likes to default things to int16_t - this is almost invariably undesirable |
7676
| 32-bit | int32_t | uint32_t | . | long |unsigned long | Use 32-bit datatypes only when needed |
7777
| 32-bit | float | n/a | . | double| . | . | Avoid 'bloating' point values unless absolutely necessary. |
78-
| 64-bit | int64_t | uint64_t | . | long long | unsigned<br/>long long | . | The core only uses a uint64_t in one library, when non-default options pull in legacy code | |
78+
| 64-bit | int64_t | uint64_t | . | long long | unsigned<br/>long long | . | The core only uses a uint64_t in one library, when non-default options pull in legacy code |
7979

8080
a. Always use the smallest datatype appropriate for the data.
8181
b. If either a signed or unsigned value will work, use the unsigned one unless there is a reason not to; signed rollover is undefined behavior, and this has caused problems for many people. Most of the poor design decisions in C can be chalked up to humanity's inexperience with computing when it was designed. But I don't know what they were thinking w

megaavr/extras/EA48.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ The EA series, in general, got no new mux options:
6666
| ALT3 | PD4 | PD5 | PD6 | PD7 |
6767
| ALT4 | PC1 | PC2 | PC3 | - |
6868
| NONE | - | - | - | - |
69-
:
69+
7070

7171
#### USART1 mux options
7272
| All | TX | RX | XCK | XDIR |
@@ -108,7 +108,7 @@ The EA series, in general, got no new mux options:
108108
There's no TCD, but with two TCAs and 4 TCBs to back them up, you've still got a respectable 16 maximum independent outputs. TCA1 gained a few new mux options, but only 3-pin ones - but on the 48-pin parts, it can use the single 6-pin mapping!
109109

110110
#### TCA mux options
111-
The Type A timers (TCA0 and TCA1) can be mapped to different pins as a group only, and analogWrite() is PORTMUX-aware - you can set TCA0 to output on any port's pin 0-5, and TCA1 to PORTB, or in 3 channel mode to ports C, A or D. Using this feature is easy - but not quite as trivial as other parts, since there are two bitfields. You simply write to the portmux register `PORTMUX.TCAROUTEA = (TCA1 pinset) | (TCA0 pinset)` and then analogWrite() normally. TCA0 pinset is the port number (0-5 for ports A-F). The pinsets values for TCA1 are shown below (equivalent to (0, 1, 4, or 5) << 3 - option 2 is PORTE4:6, and option 3 is PORTG0:5 - all pins we don't have here.
111+
The Type A timers (TCA0 and TCA1) can be mapped to different pins as a group only, and analogWrite() is PORTMUX-aware - you can set TCA0 to output on any port's pin 0-5, and TCA1 to PORTB, or in 3 channel mode to ports C, A or D, and analogWrite() will figure it out. Using this feature is easy - but not quite as trivial as other parts, since there are two bitfields. You simply write to the portmux register `PORTMUX.TCAROUTEA = (TCA1 pinset) | (TCA0 pinset)` and then analogWrite() normally. TCA0 pinset is the port number (0-5 for ports A-F). The pinsets values for TCA1 are shown below (equivalent to (0, 1, 4, or 5) << 3 - option 2 is PORTE4:6, and option 3 is PORTG0:5 - all pins we don't have here.
112112

113113

114114
| TCA0 | WO0 | WO1 | WO2 | WO3 | WO4 | WO5 | Pinset |
@@ -124,8 +124,10 @@ The Type A timers (TCA0 and TCA1) can be mapped to different pins as a group onl
124124
|---------|-----|-----|-----|-----|-----|-----|--------|
125125
| **PORTB** | **PB0** | **PB1** | **PB2** | **PB3** | **PB4** | **PB5** | 0x00 |
126126
| PORTC | PC4 | PC5 | PC6 | - | - | - | 0x08 |
127+
| PORTE |~PE4~|~PE5~|~PE6~| - | - | - | 0x10
128+
| PORTG |~PG0~|~PG1~|~PG2~|~PG3~|~PG4~|~PG5~| 0x18 |
127129
| PORTA | PA4 | PA5 | PA6 | - | - | - | 0x20 |
128-
| PORTD | PD5 | PD5 | PD6 | - | - | - | 0x28 |
130+
| PORTD | PD4 | PD5 | PD6 | - | - | - | 0x28 |
129131

130132
```c
131133
// Simple Assignment:

megaavr/extras/Ref_Errata.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ About 1 year after release, a "datasheet clarification" was issued for AVR128DA,
104104
* All serious programming issues fixed with B2/A2 die rev (B2 for 64k, since that's what they developed with and had to go through an entire major rev on before release. No wonder it was so late)).
105105

106106
Supposedly the flash endurance issues are temperature sensitive too, and it was implied that at room temperature, the original spec was met.
107+
107108
#### DU-series tried to get RWW working on the Dx-style NVMCTRL
108-
No dice!
109+
No dice - Not sure if this matters with careful program,miong. This method of programming sounds like it would be a lot harder than a page write machine.
109110
```text
110111
Read-While-Write Feature Non-Functional
111112
```
112113

113-
114114
Seems they've gotten most of the problems worked out, finally, other than the Dx-write endurance. 1000 rewrites is still enough though, and supposedly, the Dx-series parts meet the original (10k) spec at room temperature, just not over the whole temperature range (explaining why the problem had not been noticed for over a year)
115115

116116
## Unofficial Errata

megaavr/libraries/Logic/README.md

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,51 @@ All of the examples assume the use of megaTinyCore, MegaCoreX or DxCore as appro
66
More information about CCL can be found in the [Microchip Application Note TB3218](http://ww1.microchip.com/downloads/en/AppNotes/TB3218-Getting-Started-with-CCL-90003218A.pdf) and in the [megaAVR-0 family data sheet](http://ww1.microchip.com/downloads/en/DeviceDoc/megaAVR0-series-Family-Data-Sheet-DS40002015B.pdf) and the datasheet for the part in question.
77

88

9-
10-
## Pin availability and Quick Reference (Dx-series)
9+
## Pin availability and Quick Reference (Dx/Ex-series)
1110
Available pins for Dx and Ex have been unchanging. Inputs are always
12-
Logic Block | IN0-2 | OUT | ALT OUT | Availability | Notes:
13-
------------|---------|-----|---------|---------------|-----------------------------
14-
Logic0 | PA0-PA2 | PA3 | PA6 | All parts |
15-
Logic1 | PC0-PC2 | PC3 | PC6 | All parts |
16-
Logic2 | PD0-PD2 | PD3 | PD6 | All parts | There is no PD0, hence no input 0 on any DD, 28 pin DB, or 32-pin DB
17-
Logic3 | PF0-PF2 | PF3 | --- | All parts | Link input broken on many 32/28 pin DA/DB parts
18-
Logic4 | PB0-PB2 | PB3 | PB6 | 48+ pin DA/DB |
19-
Logic5 | PG0-PG2 | PG3 | PG6 | 48+ pin DA/DB |
20-
21-
Logic Block | Availability | 20-pin DD | 28 pin Dx | 32-pin Dx | 48-pin Dx | 64-pin Dx |
22-
------------ |---------------------------------------------------------------------------------------------------------------------------------------|
23-
Logic0 IN | IN0 and IN1 universal on non-tiny modern AVRs. IN2 present except at 14-pins. |
24-
Logic0 OUT | Output on PA3 and PA6 is available for all non-tiny modern AVRs with more than 14-pins. |
25-
Logic1 IN | DU has no pin inputs for logic block 1. AVR DD-series parts do not have IN0 on the 14-pin or 20-pin parts. |
26-
Logic1 OUT | Primary output present on all non-tiny modern AVRs. Alt output present on 48+ pin parts only. |
27-
Logic2 IN | 14/20 pin parts do not have IN1, IN2. 28/32 pin DB/DD/SD parts do not have IN0. |
28-
Logic2 OUT | Primary output unavailable on 14/20 pin parts. Alt output universal |
29-
Logic3 IN | 14/20 pin parts have no inputs, 28 pin has IN0 and IN1, and 32+ pin gets IN2. |
30-
Logic3 OUT | Primary output available on all parts with 32 or more pins. Alternate output not available |
31-
Logic4 | Present in AVR DA/DB parts with at least 48 pins, all of which have all inputs and primary output. |
32-
Logic4 OUT | Alt pin only available on 64-pin parts |
33-
Logic5 | Present in AVR DA/DB parts with at least 48 pins, pins only present on 64-pin parts. |
34-
35-
Notes on other new parts:
36-
The DU has only PC3 out of the entire port C left, the rest having been given over to USB. This obviously takes out the inputs for LUT1.
3711

3812

13+
|Logic Block | IN0-2 | OUT | ALT OUT | Availability | Notes:
14+
|------------|---------|-----|---------|---------------|-----------------------------
15+
|Logic0 | PA0-PA2 | PA3 | PA6 | All parts |
16+
|Logic1 | PC0-PC2 | PC3 | PC6 | All parts |
17+
|Logic2 | PD0-PD2 | PD3 | PD6 | All parts | There is no PD0, hence no input 0 on any DD, 28 pin DB, or 32-pin DB
18+
|Logic3 | PF0-PF2 | PF3 | --- | All parts | Link input broken on many 32/28 pin DA/DB parts
19+
|Logic4 | PB0-PB2 | PB3 | PB6 | 48+ pin DA/DB |
20+
|Logic5 | PG0-PG2 | PG3 | PG6 | 48+ pin DA/DB |
21+
22+
23+
24+
|Logic Block | Availability
25+
|-------------|-------------------------------------------------------------------------------------------------------------|
26+
|Logic0 IN | IN0 and IN1 universal on non-tiny modern AVRs. IN2 present except at 14-pins. |
27+
|Logic0 OUT | Output on PA3 and PA6 is available for all non-tiny modern AVRs with more than 14-pins. |
28+
|Logic1 IN | DU has no pin inputs for logic block 1. AVR DD-series parts do not have IN0 on the 14-pin or 20-pin parts. |
29+
|Logic1 OUT | Primary output present on all non-tiny modern AVRs. Alt output present on 48+ pin parts only. |
30+
|Logic2 IN | 14/20 pin parts do not have IN1, IN2. 28/32 pin DB/DD/SD parts do not have IN0. |
31+
|Logic2 OUT | Primary output unavailable on 14/20 pin parts. Alt output universal |
32+
|Logic3 IN | 14/20 pin parts have no inputs, 28 pin has IN0 and IN1, and 32+ pin gets IN2. |
33+
|Logic3 OUT | Primary output available on all parts with 32 or more pins. Alternate output not available |
34+
|Logic4 | Present in AVR DA/DB parts with at least 48 pins, all of which have all inputs and primary output. |
35+
|Logic4 OUT | Alt pin only available on 64-pin parts |
36+
|Logic5 | Present in AVR DA/DB parts with at least 48 pins, pins only present on 64-pin parts. |
37+
38+
39+
## Notes on other new parts:
40+
The DU has only PC3 out of the entire port C left, the rest having been given over to USB. This obviously takes out the inputs for LUT1.
3941
Notice how logic block 2 and 3 on 14/20 pin DD and logic block 5 on 48-pin parts have no dedicated pins. If you are not using pin input or output, use these logic blocks to conserve the more useful ones when not precluded by other considerations.
4042

43+
### The EVSYS has changed in ways most likely to be relevant to people using the CCL in the DU EA, EB, and presumably all future parts.
44+
Two high visibility event system features got big changes. See the [Event](../Event/Readme.md) library for more detail.
45+
46+
Previously, event channels were not equal: channels 0 and 1 could take event input from port A/B, 3 and 4 from C/D etcetera (the tiny2 did the obvious thing and linked them in a circle).
47+
48+
Now, each port has an EVGENCTRLA, which takes the form 0bAaaaBbbb where A and B enable event 0 and 1 respectively, and aaa and bbb are the number of the pin generating this event.
49+
50+
The same was done with the RTC event generator channels ,
51+
52+
53+
4154

4255
## Pin availability and Quick Reference (tinyAVR)
4356
This was simpler with 0/1-series (22 i/o pins, 10 CCL functions, none stacked onto the same pins), but with 2-series, 20 different CCL functions, crammed into just 22 GPIO pins, two of which have one blocks' input and one of the outputs for another. The ones with no inputs on lower pincount parts are more useful than one might expect; advanced use cases will often use mostly internal inputs - and the event system can always be used to get pin input in anyway - albeit at a cost of an event channel. If you do not require pin inputs, these should be used in preference to the logic blocks that do have them all else being equal
@@ -198,10 +211,13 @@ logic::in::tcb; // Connect to TCB0-2 output for input 0-2.
198211
logic::in::tca0; // Connect input to TCA0 WO0~2 for input 0~2
199212
logic::in::tca1; // Connect input to TCA1 WO0~2 for input 0~2 - unavailable on parts without a second TCA1
200213
logic::in::tca; // Synonym for tca0 (for compatibility with code written for tinyAVRs and megaAVR 0-series)
214+
logic::in::tce0; // On the EB, TCA0 is gone and TCE0 is in it's place; behavior frpm CCL perspective is near identical, the CCL can't even see the fourth channel.
215+
logic::in::tcf0; // Connect input to the waveform output of Timer/Counter F. input 1 gets the
201216
logic::in::tcd; // Connect input to TCD0 WOA, WOB, WOC (for input 0~2). Unavailable on EA-series as they don't have a TCD.
202217
logic::in::usart; // Connect input to TXD of USART 0~2 (for input 0~2). On parts with 2 USARTS, only works on inputs 0 and 1.
203-
logic::in::spi; // Connect input to whatever it is that SPI's event generator is. It is also unclear if this has changed.
218+
logic::in::spi; // Connect input to... is this just the clock of the SPI port in host mode only?! Why?!
204219
```
220+
205221
Notes specific to Dx-series:
206222
* Notice that only SPI0 can be used. SPI input is supported in master mode only.
207223
* Notice that only TCB0-2, USART 0-2, and TCA0/1 WO0-2 can be used in this way.
@@ -467,6 +483,7 @@ During development, it is often ~helpful~ necessary to draw out a table like:
467483
| 1 | 0 | 1 | 0 |
468484
| 1 | 1 | 0 | 1 |
469485
| 1 | 1 | 1 | 1 |
486+
470487
Which would translate into a truth value of 0b11010100 or 0xD4.
471488

472489

megaavr/libraries/Opamp/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ The AVR DB-series parts with 48 or 64-pins have three built-in opamps, while the
77

88
See also chapter 35: OPAMP - Analog Signal Processing of the datasheet. Section 35.3.7, "Applications Usage" is particularly valuable, showing the equivalent circuit and settings required for all registers to achieve a number of common opamp use cases - voltage followers, inverting and non-inverting programmable gain amplifiers, integrators (requires an external resistor and capacitor), differential amplifiers, and using all three opamps, even an instrumentation amplifier (a differential amplifier with each input buffered by a voltage follower)
99

10+
1011
| Opamp | + Pin | - Pin | OUT | Comments |
1112
|--------|-------|-------|------|------------------------|
12-
| Opamp0 | PD1 | PD3 | PD2 | 48/64-pin parts only. |
13-
| Opamp1 | PD4 | PD7 | PD5 | PD6 is the DAC output. |
14-
| Opamp2 | PE1 | PD3 | PE2 | 48/64-pin parts only. |
13+
| Opamp0 | PD1 | PD3 | PD2 | 48/64-pin parts only |
14+
| Opamp1 | PD4 | PD7 | PD5 | PD6 is the DAC output |
15+
| Opamp2 | PE1 | PD3 | PE2 | 48/64-pin parts only |
1516

1617

1718
## Opamp class

megaavr/programmers.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,6 @@ edbg.program.protocol=xplainedpro_updi
6969
edbg.program.tool=avrdude
7070
edbg.program.extra_params=-Pusb
7171

72-
medbg.name=Atmel Xplained Mini (mEDBG/ATmega32u4 debug chip)
73-
medbg.communication=usb
74-
medbg.protocol=xplainedmini_updi
75-
medbg.program.protocol=xplainedmini_updi
76-
medbg.program.tool=avrdude
77-
medbg.program.extra_params=-Pusb
78-
7972
atmelice_updi.name=Atmel-ICE
8073
atmelice_updi.communication=usb
8174
atmelice_updi.protocol=atmelice_updi

0 commit comments

Comments
 (0)