Project: Remoteli – What’s wrong with this pin?!

Having soldered everything on the board, I tested everything. The IR receiver worked just fine which is good! And 10 of the 11 switch inputs worked fine, but one was always reporting as if it was pressed when it wasn’t.

The way these switch inputs work is that the pins are connected to the positive rail by an ~50kΩ pull-up resistor which means that in it’s normal state, the pin is “pulled up” to positive voltage. When the switch is depressed it connects the pin directly to ground, therefore forcing the voltage at the pin to be zero volts. The 50kΩ resistor is important because it stops the switch connecting the positive rail directly to ground which would short circuit the whole device, potentially causing damage.

The chip I am using has internal pull-up resistors which means that there is no need to add extra pull-up resistors to the board which saves space.


Schematic of I/O pin of Attiny1634. Taken from datasheet.

The schematic of an I/O pin on the Attiny1634 shows that a resistor in series with a MOSFET is connected to the pin. This is the internal pull-up resistor. When programming the chip, it is possible to turn this MOSFET on/off which enables/disables the internal pull-up resistor by connecting/disconnecting the resistor to/from the positive rail.

As a result of these pull-up resistors, you would expected to see approximately 5V on each of the inputs when the switch was open. This was the case for 10 of the 11 switches, but one switch sat at ~1.3V instead of ~5V. This meant that it was always treated as if the switch was being pressed because the voltage was so low. This was obviously a problem.

I assumed the problem must be due to short circuits on the board, but I just couldn’t find one. My next guess was that I had managed to fry the chip when I soldered it resulting in damage (it would be a nightmare to have to replace this chip). So I went to the AVRFreaks for help. You can see the thread here. Everyone was super helpful.

You can see the process that we went through in trying to diagnose the problem on the thread so I won’t go through it here but in the end a user named “js” pointed this out in the errata:


A comment in the errata of the Attiny1634 datasheet.

The errata is basically where Atmel post corrections to their datasheets when they discover errors in the datasheet or errors in the chip.

In this case, it turned out that this pin would not work correctly if you didn’t enable the Ultra Low Power oscillator. This is odd because you wouldn’t expect the ULP to have any effect of the operation of an input pin.

Anyway, by enabling the chip Watchdog Timer, the ULP was enabled and the pin began working! Luckily I will be using the Watchdog Timer in my project anyway to send the chip into sleep mode after a certain amount of idle time.

The lesson is to always read the errata when diagnosing bugs, and don’t always assume the worst!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s