Replies: 7 comments
-
I thought the day was supposed to be able to sink about as much as it can
source. But that a pretty pathetic amount of current. Analog people and the
rest of us have very different ideas about what constitutes high current.
It is only usable as a reference voltage. If you need higher current out of
the DAC you need to spend the extra 15 cents for a DB instead of a DA, and
use the on-chip opamps to make your voltage. Set the opamp up as a voltage
follower with dac as positive input and you've got a 20mA or more analog
output.
Microchip marketeers are fond of boasting about how you can use that to
provide an arbitrary voltage to the DB's vddio2 pin as the mvio voltage,
though since that's where the current for the mvio pins comes from, you'll
see it start to sag if you tried to drive a large load with every pin on
portc or otherwise supply non-miniscule loads with it., but thats plenty
for a lot of sensors, especially those super things made...
But yeah, I think you have the same expectations I did for the dac. But you
can get that for 15 cents more per part or so (not counting quantity
discount) using a db with the opamps)
…____________
Spence Konde
Azzy’S Electronics
New products! Check them out at tindie.com/stores/DrAzzy
GitHub: github.com/SpenceKonde
ATTinyCore: Arduino support for almost every ATTiny microcontroller
Contact: ***@***.***
On Wed, Feb 1, 2023, 12:18 WebGH ***@***.***> wrote:
Hello world :-)
I have a VERY weird issue with the DAC output on PD6 ( default / only
physical DAC out of only DAC in this part ) :
If I output just any value, it comes out as expected ONLY if the output /
PA6 is either completely unloaded ( except Scope / multimeter ) OR has a
pulldown resistor to GND.
If I add a pullup, even a high one like 100kOhms, to 10VDC, the output
always clamps to 3.8V ( at 3.3V supply ) which is the output ESD protection
diode from output to Vdd.
I tried with analogWrite(); also as with the direct register setting code
from here in the discussions if you search for "DAC".
I also created a project in CodevisionAVR where I write "512" = middle of
10bit to the DAC, with the same result:
Vref/2 comes out if PA6 is unloaded or has a pulldown, but 3.8V comes out
if a 100k pullup to 10VDC is used.
SO: To me it seems the PA6 port, if used in "DAC out mode" cannot SINK any
current at all. It seems to be an "open collector PNP" style output, that
can only source current.
It CAN sucessfully pull down my 100kOhm pullup IF I set it to "digital
out" and write a LOW to it... As expected.
Has anyone any similar observations ? Do I miss any register magic ?
The datasheet of AVR32DA does say NOTHNG about the physical / electrical
design of the DAC out, it just states "buffered with high drive capability"
which seems a joke, considering what I see here...
The following code DOES toggle PA6 high/low with 1 Hz as expected, but
does NOT output the expected sawtooth...
I also did run the digital "section" first, including setting PA6 to
digital out, and then the analogWrite(), but decided it maybe a bad idea to
set a pin to digital out and then use analogwrite() on it, so I reversed
this... Makes no difference...
`void setup() {
// put your setup code here, to run once:
//pinMode(PIN_PD6,OUTPUT);
//digitalWrite(PIN_PD6,LOW);
DACReference(INTERNAL2V048);
}
void loop() {
int n;
int m;
delay(1000)
for (m=0;m<10;m++){
for (n=0;n<255;n++){
analogWrite(PIN_PD6,n);
delay(1);
}
}
pinMode(PIN_PD6,OUTPUT);
for(n=0;n<5;n++){
digitalWrite(PIN_PD6,LOW);
delay(1000);
digitalWrite(PIN_PD6,HIGH);
delay(1000);
}
}`
With best regards,
Wolfgang
—
Reply to this email directly, view it on GitHub
<#391>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTXEWYPFL75IWAFCLB6OO3WVKLG3ANCNFSM6AAAAAAUN72PXQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I ran into this DAC current drive issue on the AVR-DB parts. Drove me nuts for a few hours. The data sheet for the AVR-DA parts appears to be silent on the issue of DAC sink and source currents, but I assume the values are similar to that of the AVR-DB parts. The data sheet for the AVR-DB does include this data (section 39.19, Table 39.26 ) under Vout and then the conditions listed on the right side of the table shows the gottcha: DAC IOH max. (current sourcing) = 1 mA, DAC IOL max. (current sinking) = 0.001 mA(2). So the sinking current is 1 MICROAMPERE, which to my mind is effectively zero. Note (2) for Table 39.26 states "The DAC output has a limited current sinking capability. It is designed to drive against resistive loads connected to ground. It is recommended to increase the sinking capability by placing a suitable resistor between the DAC output pin and ground if the DAC peripheral may sink current." In my case I usually put a 5K from the DAC output to ground and then buffer with something (op-amp or in some cases an emitter follower). This wouldn't be so bad if the section of the data sheet that provides the overview of the DAC (Section 34) had a prominent notice stating what was said in note (2) of the Table. As for the AVR-DD parts, the data sheet for those parts (Table 38-23. DAC Electrical Specifications) is again silent on the current drive available from the DAC output. So for the AVR-DD parts we don't know if the DAC output only sources current (like the DA and DB parts) or if this part has similar sink and source currents. I'll test with my DD prototype board and report back what I empirically find the sink and source currents to be. |
Beta Was this translation helpful? Give feedback.
-
Dear Paul,
Yes, that is effectively what I expected. I opened a case at Microchip, but besides the usual autoresponder, there was no reaction so far.
All this would be sort of “ok” IF the datasheet would not state “high capability buffered output” which is a JOKE given the actual capabilities of this output.
Thanks for pointing to the DB series datasheet. Although it is not guaranteed that the DAC circuitry is the same, it is a valid assumption that this is the case.
With best regards,
Wolfgang
From: Paul Newland ***@***.***>
Sent: Friday, February 10, 2023 8:01 AM
To: SpenceKonde/DxCore ***@***.***>
Cc: Wolfgang Ebersbach ***@***.***>; Author ***@***.***>
Subject: Re: [SpenceKonde/DxCore] AVR32DA48 DAC on PD6 cannot sink any current ? (Discussion #391)
I ran into this DAC current drive issue on the AVR-DB parts. Drove me nuts for a few hours. The data sheet for the AVR-DA parts appears to be silent on the issue of DAC sink and source currents, but I assume the values are similar to that of the AVR-DB parts. The data sheet for the AVR-DB does include this data (section 39.19, Table 39.26 ) under Vout and then the conditions listed on the right side of the table shows the gottcha: DAC IOH max. (current sourcing) = 1 mA, DAC IOL max. (current sinking) = 0.001 mA(2). So the sinking current is 1 MICROAMPERE, which to my mind is effectively zero. Note (2) for Table 39.26 states "The DAC output has a limited current sinking capability. It is designed to drive against resistive loads connected to ground. It is recommended to increase the sinking capability by placing a suitable resistor between the DAC output pin and ground if the DAC peripheral may sink current." In my case I usually put a 5K from the DAC output to ground and then buffer with something (op-amp or in some cases an emitter follower). This wouldn't be so bad if the section of the data sheet that provides the overview of the DAC (Section 34) had a prominent notice stating what was said in note (2) of the Table.
As for the AVR-DD parts, the data sheet for those parts (Table 38-23. DAC Electrical Specifications) is again silent on the current drive available from the DAC output. So for the AVR-DD parts we don't know if the DAC output only sources current (like the DA and DB parts) or if this part has similar sink and source currents. I'll test with my DD prototype board and report back what I empirically find the sink and source currents to be.
—
Reply to this email directly, view it on GitHub<#391 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A32S4Q5HZYUL5H2UNO7TRUDWWXRTTANCNFSM6AAAAAAUN72PXQ>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
Beta Was this translation helpful? Give feedback.
-
I think in the time you two spent talking about it, if either of you had a DD, you could have written test code to empirically find the answer..... |
Beta Was this translation helpful? Give feedback.
-
I did some testing this morning with my home-brew AVR32DD14 proto board, running for this test at 5V for VDD. I programed the DAC to use VCC as the reference and then ran through a range of DAC voltages while watching on a DVM (to ensure that the DAC output was working as expected). I then change the program to put 0xFFC0 into the DAC (for 5V output) for 2 seconds and then 0x0000 (for 0V output) for 2 seconds, repeating. To test sourcing current I connected a resistor from the DAC output to ground and measured the voltage at the DAC output pin when the DAC output voltage was at/near 5VDC. For R = open the DAC pin voltage was 5.02 V, for R=100K the DAC voltage was 5.02V, for R=4.7K the DAC voltage was 5.00V, for R = 2.2K the DAC voltage was 4.97V. For the 4.7K resistor that calculates to 1.06 mA of sourcing current, and 2.26mA for the 2.2K resistor (with 3 mV of output droop). Next, to test sinking current I connected a resistor from the DAC output to VCC and measured the voltage at the DAC output pin when the DAC output voltage was (supposed to be) at/near 0VDC (thus, current would be flowing from VCC through the resistor and into the DAC pin). For R = open the DAC voltage was 0.00 V, for R=100K the DAC voltage was 3.23V, and I stopped there. So there was 3.23V of droop when the DAC was sinking 17.9 uA (5-3.23/100K), meaning that the DAC can't really sink any substantive amount of current. So the take away appears to be that, just like the DA and DB parts, there should/must be a pull down resistor on the DAC output to ground for the AVR-DD parts, with 5K seeming to be a good value for that. And that the external circuit load on the DAC pin should not source current into the DAC pin. As a side note, for the DB parts I've had good luck running the DAC output through a voltage-follower opamp within the DB device, to get some good sink/source current drive output. |
Beta Was this translation helpful? Give feedback.
-
Yes, this pretty much supports our guess: All AVR32 devices share the same DAC design. This should be noted somewhere in the datasheets and maybe the DxCore documentation should point this out clearly; because 1 microamp is “nothing” even for electronic guys.
From: Paul Newland ***@***.***>
Sent: Friday, February 10, 2023 4:56 PM
To: SpenceKonde/DxCore ***@***.***>
Cc: Wolfgang Ebersbach ***@***.***>; Author ***@***.***>
Subject: Re: [SpenceKonde/DxCore] AVR32DA48 DAC on PD6 cannot sink any current ? (Discussion #391)
I did some testing this morning with my home-brew AVR32DD14 proto board, running for this test at 5V for VDD.
I programed the DAC to use VCC as the reference and then ran through a range of DAC voltages while watching on a DVM (to ensure that the DAC output was working as expected). I then change the program to put 0xFFC0 into the DAC (for 5V output) for 2 seconds and then 0x0000 (for 0V output) for 2 seconds, repeating.
To test sourcing current I connected a resistor from the DAC output to ground and measured the voltage at the DAC output pin when the DAC output voltage was at/near 5VDC.
For R = open the DAC pin voltage was 5.02 V, for R=100K the DAC voltage was 5.02V, for R=4.7K the DAC voltage was 5.00V, for R = 2.2K the DAC voltage was 4.97V. For the 4.7K resistor that calculates to 1.06 mA of sourcing current, and 2.26mA for the 2.2K resistor (with 3 mV of output droop).
Next, to test sinking current I connected a resistor from the DAC output to VCC and measured the voltage at the DAC output pin when the DAC output voltage was (supposed to be) at/near 0VDC (thus, current would be flowing from VCC through the resistor and into the DAC pin).
For R = open the DAC voltage was 0.00 V, for R=100K the DAC voltage was 3.23V, and I stopped there. So there was 3.23V of droop when the DAC was sinking 17.9 uA (5-3.23/100K), meaning that the DAC can't really sink any substantive amount of current.
So the take away appears to be that just like the DA and DB parts, that there should/must be a pull down resistor on the DAC output to ground for the AVR-DD parts, with 5K seeming to be a good value for that. And that the external circuit load on the DAC pin should not source current into the DAC pin.
As a side note, for the DB parts I've had good luck running the DAC output through a voltage-follower opamp within the DB device, to get some good sink/source current drive output.
—
Reply to this email directly, view it on GitHub<#391 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A32S4QYRHXZ77VGTOG3PA3LWWZQI7ANCNFSM6AAAAAAUN72PXQ>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
Beta Was this translation helpful? Give feedback.
-
To close this case: I got official confirmation from Microchip: The DAC output is shit…
Microchip Technical Support has added a comment on Case# XXXXXX.
…________________________________
Case Link: XXXXXXXXXXXXX
________________________________
Latest Comment:
Hi Wolfgang,
Good day!
We appreciate your patience and continuous support.
We got some initial response from our internal team on the reported issue. Our internal team has confirmed your findings are correct with AVR DA devices. Will get back to you soon with update on other queries.
Best regards,
Jeevitha
From: Paul Newland ***@***.***>
Sent: Friday, February 10, 2023 4:56 PM
To: SpenceKonde/DxCore ***@***.***>
Cc: Wolfgang Ebersbach ***@***.***>; Author ***@***.***>
Subject: Re: [SpenceKonde/DxCore] AVR32DA48 DAC on PD6 cannot sink any current ? (Discussion #391)
I did some testing this morning with my home-brew AVR32DD14 proto board, running for this test at 5V for VDD.
I programed the DAC to use VCC as the reference and then ran through a range of DAC voltages while watching on a DVM (to ensure that the DAC output was working as expected). I then change the program to put 0xFFC0 into the DAC (for 5V output) for 2 seconds and then 0x0000 (for 0V output) for 2 seconds, repeating.
To test sourcing current I connected a resistor from the DAC output to ground and measured the voltage at the DAC output pin when the DAC output voltage was at/near 5VDC.
For R = open the DAC pin voltage was 5.02 V, for R=100K the DAC voltage was 5.02V, for R=4.7K the DAC voltage was 5.00V, for R = 2.2K the DAC voltage was 4.97V. For the 4.7K resistor that calculates to 1.06 mA of sourcing current, and 2.26mA for the 2.2K resistor (with 3 mV of output droop).
Next, to test sinking current I connected a resistor from the DAC output to VCC and measured the voltage at the DAC output pin when the DAC output voltage was (supposed to be) at/near 0VDC (thus, current would be flowing from VCC through the resistor and into the DAC pin).
For R = open the DAC voltage was 0.00 V, for R=100K the DAC voltage was 3.23V, and I stopped there. So there was 3.23V of droop when the DAC was sinking 17.9 uA (5-3.23/100K), meaning that the DAC can't really sink any substantive amount of current.
So the take away appears to be that just like the DA and DB parts, that there should/must be a pull down resistor on the DAC output to ground for the AVR-DD parts, with 5K seeming to be a good value for that. And that the external circuit load on the DAC pin should not source current into the DAC pin.
As a side note, for the DB parts I've had good luck running the DAC output through a voltage-follower opamp within the DB device, to get some good sink/source current drive output.
—
Reply to this email directly, view it on GitHub<#391 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A32S4QYRHXZ77VGTOG3PA3LWWZQI7ANCNFSM6AAAAAAUN72PXQ>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
Beta Was this translation helpful? Give feedback.
-
Hello world :-)
I have a VERY weird issue with the DAC output on PD6 ( default / only physical DAC out of only DAC in this part ) :
If I output just any value, it comes out as expected ONLY if the output / PA6 is either completely unloaded ( except Scope / multimeter ) OR has a pulldown resistor to GND.
If I add a pullup, even a high one like 100kOhms, to 10VDC, the output always clamps to 3.8V ( at 3.3V supply ) which is the output ESD protection diode from output to Vdd.
I tried with analogWrite(); also as with the direct register setting code from here in the discussions if you search for "DAC".
I also created a project in CodevisionAVR where I write "512" = middle of 10bit to the DAC, with the same result:
Vref/2 comes out if PA6 is unloaded or has a pulldown, but 3.8V comes out if a 100k pullup to 10VDC is used.
SO: To me it seems the PA6 port, if used in "DAC out mode" cannot SINK any current at all. It seems to be an "open collector PNP" style output, that can only source current.
It CAN sucessfully pull down my 100kOhm pullup IF I set it to "digital out" and write a LOW to it... As expected.
Has anyone any similar observations ? Do I miss any register magic ?
The datasheet of AVR32DA does say NOTHNG about the physical / electrical design of the DAC out, it just states "buffered with high drive capability" which seems a joke, considering what I see here...
The following code DOES toggle PA6 high/low with 1 Hz as expected, but does NOT output the expected sawtooth...
I also did run the digital "section" first, including setting PA6 to digital out, and then the analogWrite(), but decided it maybe a bad idea to set a pin to digital out and then use analogwrite() on it, so I reversed this... Makes no difference...
`void setup() {
// put your setup code here, to run once:
//pinMode(PIN_PD6,OUTPUT);
//digitalWrite(PIN_PD6,LOW);
DACReference(INTERNAL2V048);
}
void loop() {
int n;
int m;
delay(1000)
for (m=0;m<10;m++){
for (n=0;n<255;n++){
analogWrite(PIN_PD6,n);
delay(1);
}
}
pinMode(PIN_PD6,OUTPUT);
for(n=0;n<5;n++){
digitalWrite(PIN_PD6,LOW);
delay(1000);
digitalWrite(PIN_PD6,HIGH);
delay(1000);
}
}`
With best regards,
Wolfgang
Beta Was this translation helpful? Give feedback.
All reactions