I was experimenting the other day with my Arduino Nano 3.0 trying to make a 16-bit PWM output.
It actually worked quite well, but to get a decent frequency I had to switch the pin on/off very fast.
I used the 16-bit Timer1 and opted for no prescalers, thus resulting in a frequency of 31.25kHz.
( see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235060559/4#4 ).
I set the pin on when my timer overflowed and off when the timer matches a set compare value.
It actually worked great, my LED was fading very smoothly. Untill it suddenly became very dim (after experimenting about an hour or 2).
I thought it was just the pin that may have been faulty, but it turns out it happened on all the pins of PORTD (0-7).
So I figured the entire PORTD output was defective, and thought it was just some kind of manufacturing fault.
The other pins (8-13), which are PORTB, still worked fine and I continued developing my PWM output on those pins.
Until disaster struck and they became dim as well !
I tested the pins with a multimeter and still get normal voltage values, a nice +5V and a linear course with increasing PWM value.
However, the current it could output was only 4mA with a resistor of 120 ohms and a blue LED, where it should have been around 16-17!
I have no idea what just happened with my Arduino, did I switch the pin on/off too fast so the entire PORTB/PORTD became corrupt or some lanes melted or something?
Has anybody ever experienced this or has an idea how to solve this?
Turns out I accidentally deleted
pinMode(x, OUTPUT)
(apparently twice) which caused my PWM not to work on those pins !
I got it all figured out now, thanks for the help everyone.
In case anyone is interested, here's my code for realising 16-bit PWM on all digital pins (0-13).
Just attach an LED with a resistor and you'll see it fade extremely smooth
For use on an atmega328.