IMHO if I analogWrite(pwmpin,0) the pin should be connected to gnd , instead I'm gettin few mV of noise out of it .
Anyone care to comment ?
Anyone has a workaround ? either H/W of S/W is applicable
thx all
Sapo
I thought they fixed this, but you could try:
digitalWrite(pwmpin, 0);
and see if that takes care of it. If it does it has something to do with the pwm timers and I seem to recall that it only effects certain pwm pins.
instead I'm gettin few mV of noise out of it .
How are you measuring it? You need a scope.
How are you measuring it? You need a scope.
Yes Virginia ! I'm using an O'scope.
digitalWrite(pwmpin, 0);
and see if that takes care of it. If it does it has something to do with the pwm timers and I seem to recall that it only effects certain pwm pins.
That's what supposedly is doing analogWrite(pwmpin,0) is doing in the core code ( I looked at it )
IMHO it's an H/W problem inside the ATMEGA168 chip, but I'm not sure of this, I'm looking deeper into it today and will report here .
That's what supposedly is doing analogWrite(pwmpin,0) is doing in the core code ( I looked at it )
IMHO it's an H/W problem inside the ATMEGA168 chip, but I'm not sure of this, I'm looking deeper into it today and will report here
As posted by Digger, this was a previously found software bug in the IDE core code that I too thought was fixed in a later version of the IDE. But not sure.
Anyway I recall using my O-scope, analogWrite(pwmpin,0) and analogWrite(pwmpin,1) would display the same single count high output of the PWM waveform, you couldn't get the output to be 100% off.
What version of the Arduino IDE are you using?
Lefty
What version of the Arduino IDE are you using?
Arduino 0017
Checked again the core files and in cores/arduino/wiring_analog.c you can find the following line
if (val == 0) {
digitalWrite(pin, LOW);
} else {
// connect pwm to pin on timer 0, channel A
sbi(TCCR0A, COM0A1);
// set pwm duty
OCR0A = val;
}
valid for atmega168 and both timers, to it's looks like the pin should be to logic 0 ( this doesn't imply that the pin is connected to gnd btw).
There are , obviously, several h/w workaround one can go for, but I'm interested in finding a definitive answer to this.