Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/SpenceKonde/DxCore
Browse files Browse the repository at this point in the history
  • Loading branch information
SpenceKonde committed Jun 11, 2023
2 parents 590825b + 0f8d224 commit 023672b
Show file tree
Hide file tree
Showing 22 changed files with 48 additions and 50 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DxCore - Arduino support for the AVR DA, DB-series and DD-series

## 1.5.7 - EA "support" in beta form is now available.
## 1.5.7 - EA "support" in beta form is now available
This is a very generous definition of the word - The first version where it is believed to be fully working will be numbered 1.6.0, and within a few patch versions of that, it likely will be.

There are lots of issues impacting this currently and I'm not going to even start listing them here, but make issues if you don't see em.
Expand All @@ -12,7 +12,7 @@ Expect particular issues with:
* Flash.h is not supposed to work on it - it needs a different library, and to write when optiboot is not in use will require a novel implementation, while writing via optiboot will require optiboot to work, which will not be easy - that the first EA's are impacted by excruciatingly severe silicon bugs that make writing to nvm more complicated makes this significantly more challenging


### Optiboot for EA does not look encouraging.
### Optiboot for EA does not look encouraging
Before the errata, I was pretty sure that it would be part definitions and a few lines of logic change in optiboot_x. oh ho ho no. No such luck, cause we can't do a bloody erase+write, the optiboot protocol doesn't know where a given page is going to be written (hence where to erase) to until the first bytes of the blob of data that was sent to it is hurtling towards it, and see the quoted section of the datasheet below. I am praying for an early die rev.

> The resulting data will be a binary AND operation between the new and the previous content of the page buffer. The page buffer will automatically be erased (all bits set) **after**:
Expand Down
2 changes: 1 addition & 1 deletion megaavr/cores/dxcore/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ void pinConfigure(const uint8_t digital_pin, const pin_configure_t mode, const M
_pinconfigure(digital_pin, pin_config);
}

/* If you understand the preceeding code, studies show you are more likely than the average developer to
/* If you understand the preceding code, studies show you are more likely than the average developer to
* know C++, with a statistically significant relationship between how well you know the language and your likelihood of
* understanding that code. I got distracted after the first + and have yet to comprehend the above implementation.
* But it lets you separate arguments with commas instead of pipes, which is far more tasteful and graceful
Expand Down
4 changes: 2 additions & 2 deletions megaavr/cores/dxcore/wiring.c
Original file line number Diff line number Diff line change
Expand Up @@ -1812,8 +1812,8 @@ void nudge_millis(__attribute__((unused)) uint16_t nudgesize) {
*/
/* Some speeds not otherwise possible can be generated with the internal oscillator by prescaling
* This is done for 5 and 10 because those were common speeds to run 0 and 1-series parts at.
* The logic for setting clock to the other stupid frequencies that can be generated this way
* or for generating millis, micros, or delayMicroseconds() at those speeds is belived to be implented
* The logic for setting clock to the other stupid frequencies that can be generated this way
* or for generating millis, micros, or delayMicroseconds() at those speeds is believed to be implemented
* but has not been tested.
* If it fails to work at speeds evenly divisible by 1000000 and less than 8 MHz, that can be reported
* as a bug, though it will not be a priority one. We have no plans to support speeds with non-integer
Expand Down
2 changes: 1 addition & 1 deletion megaavr/extras/DA28.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Following precedent set by MegaCoreX, we declare that pin 7 - `PIN_PA7` shall be
Reset (PF6) can be set to work as an input (but never an output). The UPDI pin cannot be configured as an I/O pin.

### ADC pins in differential mode
Only pins on PORTD can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](REF_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only. On parts with more pins, PORTE can also be used for negative inputs. The Dx-ADC is better than a no-frills classic
Only pins on PORTD can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](Ref_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only. On parts with more pins, PORTE can also be used for negative inputs. The Dx-ADC is better than a no-frills classic
ADC - for one thing it gained two bits - but the differential mode is a little disappointing: It cannot be used if a voltage exceeds VRef: you get junk results even though the difference doesn't exceed VREF. This of course kills one of the popular uses of ADC differential mode = high side current sensing, where you'relooking at a voltage very close to Vdd, maybe you've turned up the gain and you'd use the lowest ref you had? Not if you're on a Dx-series you're not. No opamps here either to condition signals.


Expand Down
2 changes: 1 addition & 1 deletion megaavr/extras/DA32.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Following precedent set by MegaCoreX, we declare that pin 7 - `PIN_PA7` shall be
Reset (PF6) can be set to work as an input (but never an output). The UPDI pin cannot be configured as an I/O pin.

### ADC pins in differential mode
Only pins on PORTD can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](REF_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only. On parts with more pins, PORTE can also be used for negative inputs.
Only pins on PORTD can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](Ref_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only. On parts with more pins, PORTE can also be used for negative inputs.

## Official Documentation
When all else fails, read the real documentation. They keep moving the .pdf files around, so now I just link to the prduct page, from whence the datasheet, errata, and "technical briefs".
Expand Down
4 changes: 2 additions & 2 deletions megaavr/extras/DA48.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ PORTMUX.TCAROUTEA = (PORTMUX.TCAROUTEA & PORTMUX_TCA1_gm) | PORTMUX_TCA0_PORTD_g

These are NOT PORTMUX-aware. Only the **bold** pin can be used without modifying or creating a new variant file.

The type B timers are much better utility timers than PWM timers. TCB2 is the default millis timer and cannot be used for PWM in that mode. This configuration is recommended. See the [Timer Reference](REF_Timers.md) for more information
The type B timers are much better utility timers than PWM timers. TCB2 is the default millis timer and cannot be used for PWM in that mode. This configuration is recommended. See the [Timer Reference](Ref_Timers.md) for more information

#### TCD0 mux options
| TCD0 | WOA | WOB | WOC | WOD |
Expand All @@ -152,7 +152,7 @@ Following precedent set by MegaCoreX, we declare that pin 7 - `PIN_PA7` shall be
Reset (PF6) can be set to work as an input (but never an output). The UPDI pin cannot be configured as an I/O pin.

### ADC pins in differential mode
Only pins on PORTD and PORTE can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](REF_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only.
Only pins on PORTD and PORTE can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](Ref_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only.

## Official Documentation
When all else fails, read the real documentation. They keep moving the .pdf files around, so now I just link to the prduct page, from whence the datasheet, errata, and "technical briefs".
Expand Down
4 changes: 2 additions & 2 deletions megaavr/extras/DA64.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ PORTMUX.TCAROUTEA = (PORTMUX.TCAROUTEA & PORTMUX_TCA1_gm) | PORTMUX_TCA0_PORTD_g

These are NOT PORTMUX-aware. Only the **bold** pin can be used without modifying or creating a new variant file. TCAs take priority over TCBs, so without changing the TCA0 mapping, TCB2/TCB3 are not used.

The type B timers are much better utility timers than PWM timers. TCB2 is the default millis timer and cannot be used for PWM in that mode. This configuration is recommended. See the [Timer Reference](REF_Timers.md) for more information
The type B timers are much better utility timers than PWM timers. TCB2 is the default millis timer and cannot be used for PWM in that mode. This configuration is recommended. See the [Timer Reference](Ref_Timers.md) for more information

#### TCD0 mux options
| TCD0 | WOA | WOB | WOC | WOD |
Expand All @@ -159,7 +159,7 @@ Following precedent set by MegaCoreX, we declare that pin 7 - `PIN_PA7` shall be
Reset (PF6) can be set to work as an input (but never an output). The UPDI pin cannot be configured as an I/O pin.

### ADC pins in differential mode
Only pins on PORTD and PORTE can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](REF_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only.
Only pins on PORTD and PORTE can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](Ref_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only.

## Official Documentation
When all else fails, read the real documentation. They keep moving the .pdf files around, so now I just link to the prduct page, from whence the datasheet, errata, and "technical briefs".
Expand Down
2 changes: 1 addition & 1 deletion megaavr/extras/DB28.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Following precedent set by MegaCoreX, we declare that pin 7 - `PIN_PA7` shall be
Reset (PF6) can be set to work as an input (but never an output). The UPDI pin cannot be configured as an I/O pin.

### ADC pins in differential mode
Only pins on PORTD can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](REF_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only. On parts with more pins, PORTE can also be used for negative inputs.
Only pins on PORTD can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](Ref_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only. On parts with more pins, PORTE can also be used for negative inputs.

## Official Documentation
When all else fails, read the real documentation. They keep moving the .pdf files around, so now I just link to the prduct page, from whence the datasheet, errata, and "technical briefs".
Expand Down
4 changes: 2 additions & 2 deletions megaavr/extras/DB32.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Note that this differs from both the hardware default, as well as what would be

These are NOT PORTMUX-aware. Only the **bold** pin can be used without modifying or creating a new variant file.

The type B timers are much better utility timers than PWM timers. TCB2 is the default millis timer and cannot be used for PWM in that mode. This configuration is recommended. See the [Timer Reference](REF_Timers.md) for more information
The type B timers are much better utility timers than PWM timers. TCB2 is the default millis timer and cannot be used for PWM in that mode. This configuration is recommended. See the [Timer Reference](Ref_Timers.md) for more information


#### TCD0 mux options
Expand All @@ -137,7 +137,7 @@ Following precedent set by MegaCoreX, we declare that pin 7 - `PIN_PA7` shall be
Reset (PF6) can be set to work as an input (but never an output). The UPDI pin cannot be configured as an I/O pin.

### ADC pins in differential mode
Only pins on PORTD can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](REF_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only. On parts with more pins, PORTE can also be used for negative inputs.
Only pins on PORTD can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](Ref_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only. On parts with more pins, PORTE can also be used for negative inputs.

## Official Documentation
When all else fails, read the real documentation. They keep moving the .pdf files around, so now I just link to the prduct page, from whence the datasheet, errata, and "technical briefs".
Expand Down
2 changes: 1 addition & 1 deletion megaavr/extras/DB48.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Following precedent set by MegaCoreX, we declare that pin 7 - `PIN_PA7` shall be
Reset (PF6) can be set to work as an input (but never an output). The UPDI pin cannot be configured as an I/O pin.

### ADC pins in differential mode
Only pins on PORTD and PORTE can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](REF_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only.
Only pins on PORTD and PORTE can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](Ref_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only.

## Official Documentation
When all else fails, read the real documentation. They keep moving the .pdf files around, so now I just link to the prduct page, from whence the datasheet, errata, and "technical briefs".
Expand Down
2 changes: 1 addition & 1 deletion megaavr/extras/DB64.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Following precedent set by MegaCoreX, we declare that pin 7 - `PIN_PA7` shall be
Reset (PF6) can be set to work as an input *(but never an output)*. The UPDI pin cannot be configured as an I/O pin.

### ADC pins in differential mode
Only pins on PORTD and PORTE can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](REF_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only.
Only pins on PORTD and PORTE can be used as the negative side of a differential analog reading (`analogReadDiff()`, see [Analog Reference](Ref_Analog.md)). Pins on PORTF can be used as positive or single ended ADC inputs only.

## Official Documentation
When all else fails, read the real documentation. They keep moving the .pdf files around, so now I just link to the prduct page, from whence the datasheet, errata, and "technical briefs".
Expand Down
6 changes: 3 additions & 3 deletions megaavr/extras/Ref_Analog.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ In some cases the voltage determines the maximum ADC clock speed. Call analogRef
#### Limits of external refeences
External reference voltage should be between 1.8v and Vdd if CLK_ADC is higher than 500kHz (by default, it is), however if you slow the ADC clock down, external references as low as 1.0V (they gave 1.024V as the lower limit. It is unclear if the slower clock speed must also be used for the internal 1.024V reference.

This is not all bad news though on the 2-series and Ex, instead of having to slow down for some reference voltages, we get higher max CLK_ADC with external references!
This is not all bad news though on the 2-series and Ex, instead of having to slow down for some reference voltages, we get higher max CLK_ADC with external references!



Expand Down Expand Up @@ -81,7 +81,7 @@ If anyone reading this has performed any testing of this, I would appreciate it

To compensate for the faster ADC clock, we extend the sampling period so it ends up with a similar sampling period to classic AVRs, while still being significantly faster by virtue of the much shorter conversion time. But you can shorten that further (or extend it) using analogSampleDuration(). With minimum sample duration, external voltage reference in burst or freerun mode and maximum ADC clock, 450k sps may be possible at full resolution. You're unlikely to want that ofc, but that's a separate matter, just don't configure it like that if you don't want it. The fact remains that it is definitely the faster ADC.


## ADC Function Reference
This core includes the following ADC-related functions. Out of the box, analogRead() is intended to be directly compatible with the standard Arduino implementation. Additional functions are provided to use the advanced functionality of these parts and further tune the ADC to your application. Several functions are unique to the cores I maintain. The functions here not marked if they are simple implementations that duplicate the stock one. They are marked (semi-standard) if it is something that is standard on some arduino cores but not official AVR cores and/or which works differently here), or (one of more of mTC, DxC, and ATC - these are the three cores I maintain, megaTinyCore, DxCore and ATTinyCore).

Expand Down Expand Up @@ -368,7 +368,7 @@ ADC_CH(channel number) - converts channel numbers to analog channel ide
Try not to use these unless you're getting really deep into library development and direct interaction with the ADC; we provide all the constants you will need. listed above.

## A word of warning to capacitive touch sensing applications
Libraries exist that use trickery and the ADC to measure capacitance, hence detect touch/proximity. Most of these libraries (since Atmel always locked up QTouch) relied on the leftover charge in the ADC S&H cap. The magnitude of this source of error is much larger on classic AVRs. It is considered undesirable (this is why when changing ADC channels in the past, you were advised to throw out the first couple of readings!) and with each generation, this has been reduced. There are still ways to do this effectively on the 2series, but require very different approaches. Thankfully for parts that do have a PTC, great strides are being made. the tiny1-series has an active developer working on it, while Microchip itself will release a library based on qtouch for the DA.
Libraries exist that use trickery and the ADC to measure capacitance, hence detect touch/proximity. Most of these libraries (since Atmel always locked up QTouch) relied on the leftover charge in the ADC S&H cap. The magnitude of this source of error is much larger on classic AVRs. It is considered undesirable (this is why when changing ADC channels in the past, you were advised to throw out the first couple of readings!) and with each generation, this has been reduced. There are still ways to do this effectively on the 2series, but require very different approaches. Thankfully for parts that do have a PTC, great strides are being made. the tiny1-series has an active developer working on it, while Microchip itself will release a library based on qtouch for the DA.

## Microchip Documentation
Has been much expanded and I'm very happy to see this sort of document produced before the EA release. Wondering about the numbering? Well, TB stands for Technical Brief, which is different in some way from an Application Note (AN), and obviously a whitepaper or "Datasheet" (DS) is something else altogether. Even when they're about the same length and contain similar types of content. S
Expand Down
Loading

0 comments on commit 023672b

Please sign in to comment.