I'm having a problem with a photon that has been working in the same application for about 3 years now. I have 4 analog inputs configured and they are connected to voltage dividers which use 3.3v, a fixed resistor, and resistive meat probes to measure temperature. One of the inputs suddenly started acting up and was reading high. On further investigation I found with the tinker app installed that all modes of analog and digital in and out work but analog in and digital in will read what ever the last analog out value was which is confirmed with a volt meter. So if I set the analog output at 4096 it will read 3.3v. Then when I switch it to be analog input it continues to read 3.3v or whatever voltage I had previously output to the pin. Did something die in my photon where the analog output is always switched on? Is there any thing I can try to revive it? The problem pin is the DAC pin which I'm using as A6.
As long as you are not calling
analogWrite() on the pin, I'd suspect hardware failure. The DAC pins (A3 and A6) are particularly sensitive and not 5V tolerant, so ESD or some other condition could have caused the DAC circuit on that pin to be damaged since other pins work and the software previously worked.
That's what I'm thinking. I have 2 photons and I swapped back and forth several times and the problem was only with one of them. I wondered if the DAC pins could be more sensitive since they have other functionality. Is there a typical circuit used to protect inputs?
The only other thing I could think of is if some portion of the flash became corrupted and there was a way to reset to factory and maybe get lucky. I tried a program with the eeprom clear() command but no change afterwards. My program saves values to eeprom so they are retained on a power cycle which I thought could have been related. But that seems like a stretch. I'll just have use a new pin since I luckily don't need all of them.
It's unlikely to be a software issue on the Photon.
I use a circuit like this on my analog inputs:
You add a 100Ω series resistor into the ADC, and a D1213A TVS which does two thiings: it protects against some ESD via the zener diode, and also protects against voltage above 3.3V or below 0V with the rail-to-rail diodes.
If the source is a voltage divider, you can skip the 100Ω series resistor (look farther up in that post).
Thanks for the info. I swapped my 2 photons between projects that used different analog inputs and its business as usual but I probably should add some protection. Although it might have been caused by pulling the photon off the bread board when troubleshooting a different problem I was having.